Skip to content

stop_targeted_sentiment_detection_job

stop_targeted_sentiment_detection_job(
    job_id: JobId, *, config_overrides: Optional[ComprehendClientConfig] = None
) -> StopTargetedSentimentDetectionJobResponse

Stops a targeted sentiment detection job in progress.

If the job state is IN_PROGRESS, the job is marked for termination and put into the STOP_REQUESTED state. If the job completes before it can be stopped, it is put into the COMPLETED state; otherwise the job is be stopped and put into the STOPPED state.

If the job is in the COMPLETED or FAILED state when you call the StopDominantLanguageDetectionJob operation, the operation returns a 400 Internal Request Exception.

When a job is stopped, any documents already processed are written to the output location.

Parameters:

  • job_id (JobId) –

    The identifier of the targeted sentiment detection job to stop.

Raises:

Source code in docs_src/capo_comprehend/_services/comprehend.py
def stop_targeted_sentiment_detection_job(
    self,
    job_id: "capo_comprehend.types.job_id.JobId",
    *,
    config_overrides: Optional[ComprehendClientConfig] = None,
) -> "capo_comprehend.types.stop_targeted_sentiment_detection_job_response.StopTargetedSentimentDetectionJobResponse":
    """<p>Stops a targeted sentiment detection job in progress.</p> <p>If the job state is <code>IN_PROGRESS</code>, the job is marked for termination and put into the <code>STOP_REQUESTED</code> state. If the job completes before it can be stopped, it is put into the <code>COMPLETED</code> state; otherwise the job is be stopped and put into the <code>STOPPED</code> state.</p> <p>If the job is in the <code>COMPLETED</code> or <code>FAILED</code> state when you call the <code>StopDominantLanguageDetectionJob</code> operation, the operation returns a 400 Internal Request Exception. </p> <p>When a job is stopped, any documents already processed are written to the output location.</p>

    Args:
        job_id: <p>The identifier of the targeted sentiment detection job to stop.</p>

    Raises:
        capo_comprehend.errors.internal_server_exception.InternalServerException: <p>An internal server error occurred. Retry your request.</p>
        capo_comprehend.errors.invalid_request_exception.InvalidRequestException: <p>The request is invalid.</p>
        capo_comprehend.errors.job_not_found_exception.JobNotFoundException: <p>The specified job was not found. Check the job ID and try again.</p>
        capo_comprehend.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_comprehend.types.stop_targeted_sentiment_detection_job_request.StopTargetedSentimentDetectionJobRequest]",
    ) -> OperationResponse[
        "capo_comprehend.types.stop_targeted_sentiment_detection_job_response.StopTargetedSentimentDetectionJobResponse"
    ]:
        import capo_comprehend._operations.comprehend_20171127.stop_targeted_sentiment_detection_job

        output, http_response = (
            capo_comprehend._operations.comprehend_20171127.stop_targeted_sentiment_detection_job.stop_targeted_sentiment_detection_job(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("StopTargetedSentimentDetectionJob")
    )
    input_: capo_comprehend.types.stop_targeted_sentiment_detection_job_request.StopTargetedSentimentDetectionJobRequest = {
        "job_id": job_id
    }

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output