Stops an asynchronous batch translation job that is in progress.
If the job's state is IN_PROGRESS, the job will be 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 put into the STOPPED state.
Asynchronous batch translation jobs are started with the StartTextTranslationJob operation. You can use the DescribeTextTranslationJob or ListTextTranslationJobs operations to get a batch translation job's JobId.
Parameters:
-
job_id
(JobId)
–
The job ID of the job to be stopped.
Raises:
-
InternalServerException
–
An internal server error occurred. Retry your request.
-
ResourceNotFoundException
–
The resource you are looking for has not been found. Review the resource you're looking for and see if a different resource will accomplish your needs before retrying the revised request.
-
TooManyRequestsException
–
You have made too many requests within a short period of time. Wait for a short time and then try your request again.
-
UnknownServiceError
–
The service returned an error code this client does not model.
Source code in docs_src/capo_translate/_services/translate.py
| def stop_text_translation_job(
self,
job_id: "capo_translate.types.job_id.JobId",
*,
config_overrides: Optional[TranslateClientConfig] = None,
) -> "capo_translate.types.stop_text_translation_job_response.StopTextTranslationJobResponse":
"""<p>Stops an asynchronous batch translation job that is in progress.</p> <p>If the job's state is <code>IN_PROGRESS</code>, the job will be 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 put into the <code>STOPPED</code> state.</p> <p>Asynchronous batch translation jobs are started with the <a>StartTextTranslationJob</a> operation. You can use the <a>DescribeTextTranslationJob</a> or <a>ListTextTranslationJobs</a> operations to get a batch translation job's <code>JobId</code>.</p>
Args:
job_id: <p>The job ID of the job to be stopped.</p>
Raises:
capo_translate.errors.internal_server_exception.InternalServerException: <p>An internal server error occurred. Retry your request.</p>
capo_translate.errors.resource_not_found_exception.ResourceNotFoundException: <p>The resource you are looking for has not been found. Review the resource you're looking for and see if a different resource will accomplish your needs before retrying the revised request.</p>
capo_translate.errors.too_many_requests_exception.TooManyRequestsException: <p> You have made too many requests within a short period of time. Wait for a short time and then try your request again.</p>
capo_translate.errors.UnknownServiceError: The service returned an error code this client does not model.
"""
def _handler(
req: "OperationRequest[capo_translate.types.stop_text_translation_job_request.StopTextTranslationJobRequest]",
) -> OperationResponse[
"capo_translate.types.stop_text_translation_job_response.StopTextTranslationJobResponse"
]:
import capo_translate._operations.aws_shine_frontend_service_20170701.stop_text_translation_job
output, http_response = (
capo_translate._operations.aws_shine_frontend_service_20170701.stop_text_translation_job.stop_text_translation_job(
req.options, req.input
)
)
return OperationResponse(output=output, response=http_response)
interceptors_, options_ = self.operation_options(
config_overrides, OperationLogging("StopTextTranslationJob")
)
input_: capo_translate.types.stop_text_translation_job_request.StopTextTranslationJobRequest = {
"job_id": job_id
}
response = execute_pipeline(
OperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
response.response.close()
return response.output
|