Skip to content

list_jobs_by_consumable_resource async

list_jobs_by_consumable_resource(
    *,
    config_overrides: Optional[AsyncBatchClientConfig] = None,
    consumable_resource: Optional[String] = None,
    filters: Optional[ListJobsByConsumableResourceFilterList] = None,
    max_results: Optional[Integer] = None,
    next_token: Optional[String] = None,
) -> ListJobsByConsumableResourceResponse

Returns a list of Batch jobs that require a specific consumable resource.

Parameters:

  • consumable_resource (Optional[String], default: None ) –

    The name or ARN of the consumable resource.

  • filters (Optional[ListJobsByConsumableResourceFilterList], default: None ) –

    The filters to apply to the job list query. If used, only those jobs requiring the specified consumable resource (consumableResource) and that match the value of the filters are listed. The filter names and values can be:

    • name: JOB_STATUS

      values: SUBMITTED | PENDING | RUNNABLE | STARTING | RUNNING | SUCCEEDED | FAILED

    • name: JOB_NAME

      The values are case-insensitive matches for the job name. If a filter value ends with an asterisk (*), it matches any job name that begins with the string before the '*'.

  • max_results (Optional[Integer], default: None ) –

    The maximum number of results returned by ListJobsByConsumableResource in paginated output. When this parameter is used, ListJobsByConsumableResource 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 ListJobsByConsumableResource request with the returned nextToken value. This value can be between 1 and 100. If this parameter isn't used, then ListJobsByConsumableResource returns up to 100 results and a nextToken value if applicable.

  • next_token (Optional[String], default: None ) –

    The nextToken value returned from a previous paginated ListJobsByConsumableResource 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 get a list of Batch jobs by consumable resource Returns a list of Batch jobs that require a specific consumable resource.

>>> await client.list_jobs_by_consumable_resource(consumable_resource='myConsumableResource', filters=[{'name': 'CONSUMABLE_RESOURCE_NAME', 'values': ['my*']}], max_results=123)
Source code in docs_src/capo_batch/_services/async_batch.py
async def list_jobs_by_consumable_resource(
    self,
    *,
    config_overrides: Optional[AsyncBatchClientConfig] = None,
    consumable_resource: Optional["capo_batch.types.string.String"] = None,
    filters: Optional[
        "capo_batch.types.list_jobs_by_consumable_resource_filter_list.ListJobsByConsumableResourceFilterList"
    ] = None,
    max_results: Optional["capo_batch.types.integer.Integer"] = None,
    next_token: Optional["capo_batch.types.string.String"] = None,
) -> "capo_batch.types.list_jobs_by_consumable_resource_response.ListJobsByConsumableResourceResponse":
    """<p>Returns a list of Batch jobs that require a specific consumable resource.</p>

    Args:
        consumable_resource: <p>The name or ARN of the consumable resource.</p>
        filters: <p>The filters to apply to the job list query. If used, only those jobs requiring the specified consumable resource (<code>consumableResource</code>) and that match the value of the filters are listed. The filter names and values can be:</p> <ul> <li> <p>name: <code>JOB_STATUS</code> </p> <p>values: <code>SUBMITTED | PENDING | RUNNABLE | STARTING | RUNNING | SUCCEEDED | FAILED</code> </p> </li> <li> <p>name: <code>JOB_NAME </code> </p> <p>The values are case-insensitive matches for the job name. If a filter value ends with an asterisk (*), it matches any job name that begins with the string before the '*'.</p> </li> </ul>
        max_results: <p>The maximum number of results returned by <code>ListJobsByConsumableResource</code> in paginated output. When this parameter is used, <code>ListJobsByConsumableResource</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>ListJobsByConsumableResource</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>ListJobsByConsumableResource</code> returns up to 100 results and a <code>nextToken</code> value if applicable.</p>
        next_token: <p>The <code>nextToken</code> value returned from a previous paginated <code>ListJobsByConsumableResource</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 get a list of Batch jobs by consumable resource
        Returns a list of Batch jobs that require a specific consumable resource.

        >>> await client.list_jobs_by_consumable_resource(consumable_resource='myConsumableResource', filters=[{'name': 'CONSUMABLE_RESOURCE_NAME', 'values': ['my*']}], max_results=123)
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_batch.types.list_jobs_by_consumable_resource_request.ListJobsByConsumableResourceRequest]",
    ) -> AsyncOperationResponse[
        "capo_batch.types.list_jobs_by_consumable_resource_response.ListJobsByConsumableResourceResponse"
    ]:
        import capo_batch._operations.aws_batch_v20160810.list_jobs_by_consumable_resource

        (
            output,
            http_response,
        ) = await capo_batch._operations.aws_batch_v20160810.list_jobs_by_consumable_resource.async_list_jobs_by_consumable_resource(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("ListJobsByConsumableResource")
    )
    input_: capo_batch.types.list_jobs_by_consumable_resource_request.ListJobsByConsumableResourceRequest = {}
    if consumable_resource is not None:
        input_["consumable_resource"] = consumable_resource
    if filters is not None:
        input_["filters"] = filters
    if max_results is not None:
        input_["max_results"] = max_results
    if next_token is not None:
        input_["next_token"] = next_token

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output