Describes a list of job definitions. You can specify a status (such as ACTIVE) to only return job definitions that match that status.
Parameters:
-
job_definitions
(Optional[StringList], default:
None
)
–
A list of up to 100 job definitions. Each entry in the list can either be an ARN in the format arn:aws:batch:${Region}:${Account}:job-definition/${JobDefinitionName}:${Revision} or a short version using the form ${JobDefinitionName}:${Revision}. This parameter can't be used with other parameters.
-
max_results
(Optional[Integer], default:
None
)
–
The maximum number of results returned by DescribeJobDefinitions in paginated output. When this parameter is used, DescribeJobDefinitions only returns maxResults results in a single page and a nextToken response element. The remaining results of the initial request can be seen by sending another DescribeJobDefinitions request with the returned nextToken value. This value can be between 1 and 100. If this parameter isn't used, then DescribeJobDefinitions returns up to 100 results and a nextToken value if applicable.
-
job_definition_name
(Optional[String], default:
None
)
–
The name of the job definition to describe.
-
status
(Optional[String], default:
None
)
–
The status used to filter job definitions.
-
next_token
(Optional[String], default:
None
)
–
The nextToken value returned from a previous paginated DescribeJobDefinitions request where maxResults was used and the results exceeded the value of that parameter. Pagination continues from the end of the previous results that returned the nextToken value. This value is null when there are no more results to return.
Treat this token as an opaque identifier that's only used to retrieve the next items in a list and not for other programmatic purposes.
Raises:
-
ClientException
–
These errors are usually caused by a client action. One example cause is using an action or resource on behalf of a user that doesn't have permissions to use the action or resource. Another cause is specifying an identifier that's not valid.
-
ServerException
–
These errors are usually caused by a server issue.
-
UnknownServiceError
–
The service returned an error code this client does not model.
Examples:
To describe active job definitions
This example describes all of your active job definitions.
>>> client.describe_job_definitions(status='ACTIVE')
Source code in docs_src/capo_batch/_services/batch.py
| def describe_job_definitions(
self,
*,
config_overrides: Optional[BatchClientConfig] = None,
job_definitions: Optional["capo_batch.types.string_list.StringList"] = None,
max_results: Optional["capo_batch.types.integer.Integer"] = None,
job_definition_name: Optional["capo_batch.types.string.String"] = None,
status: Optional["capo_batch.types.string.String"] = None,
next_token: Optional["capo_batch.types.string.String"] = None,
) -> "capo_batch.types.describe_job_definitions_response.DescribeJobDefinitionsResponse":
"""<p>Describes a list of job definitions. You can specify a <code>status</code> (such as <code>ACTIVE</code>) to only return job definitions that match that status.</p>
Args:
job_definitions: <p>A list of up to 100 job definitions. Each entry in the list can either be an ARN in the format <code>arn:aws:batch:${Region}:${Account}:job-definition/${JobDefinitionName}:${Revision}</code> or a short version using the form <code>${JobDefinitionName}:${Revision}</code>. This parameter can't be used with other parameters.</p>
max_results: <p>The maximum number of results returned by <code>DescribeJobDefinitions</code> in paginated output. When this parameter is used, <code>DescribeJobDefinitions</code> only returns <code>maxResults</code> results in a single page and a <code>nextToken</code> response element. The remaining results of the initial request can be seen by sending another <code>DescribeJobDefinitions</code> request with the returned <code>nextToken</code> value. This value can be between 1 and 100. If this parameter isn't used, then <code>DescribeJobDefinitions</code> returns up to 100 results and a <code>nextToken</code> value if applicable.</p>
job_definition_name: <p>The name of the job definition to describe.</p>
status: <p>The status used to filter job definitions.</p>
next_token: <p>The <code>nextToken</code> value returned from a previous paginated <code>DescribeJobDefinitions</code> request where <code>maxResults</code> was used and the results exceeded the value of that parameter. Pagination continues from the end of the previous results that returned the <code>nextToken</code> value. This value is <code>null</code> when there are no more results to return.</p> <note> <p>Treat this token as an opaque identifier that's only used to retrieve the next items in a list and not for other programmatic purposes.</p> </note>
Raises:
capo_batch.errors.client_exception.ClientException: <p>These errors are usually caused by a client action. One example cause is using an action or resource on behalf of a user that doesn't have permissions to use the action or resource. Another cause is specifying an identifier that's not valid.</p>
capo_batch.errors.server_exception.ServerException: <p>These errors are usually caused by a server issue.</p>
capo_batch.errors.UnknownServiceError: The service returned an error code this client does not model.
Examples:
To describe active job definitions
This example describes all of your active job definitions.
>>> client.describe_job_definitions(status='ACTIVE')
"""
def _handler(
req: "OperationRequest[capo_batch.types.describe_job_definitions_request.DescribeJobDefinitionsRequest]",
) -> OperationResponse[
"capo_batch.types.describe_job_definitions_response.DescribeJobDefinitionsResponse"
]:
import capo_batch._operations.aws_batch_v20160810.describe_job_definitions
output, http_response = (
capo_batch._operations.aws_batch_v20160810.describe_job_definitions.describe_job_definitions(
req.options, req.input
)
)
return OperationResponse(output=output, response=http_response)
interceptors_, options_ = self.operation_options(
config_overrides, OperationLogging("DescribeJobDefinitions")
)
input_: capo_batch.types.describe_job_definitions_request.DescribeJobDefinitionsRequest = {}
if job_definitions is not None:
input_["job_definitions"] = job_definitions
if max_results is not None:
input_["max_results"] = max_results
if job_definition_name is not None:
input_["job_definition_name"] = job_definition_name
if status is not None:
input_["status"] = status
if next_token is not None:
input_["next_token"] = next_token
response = execute_pipeline(
OperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
response.response.close()
return response.output
|