Skip to content

create_scheduling_policy

create_scheduling_policy(
    *,
    config_overrides: Optional[BatchClientConfig] = None,
    name: Optional[String] = None,
    quota_share_policy: Optional[QuotaSharePolicy] = None,
    fairshare_policy: Optional[FairsharePolicy] = None,
    tags: Optional[TagrisTagsMap] = None,
) -> CreateSchedulingPolicyResponse

Creates an Batch scheduling policy.

Parameters:

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

    The name of the fair-share scheduling policy. It can be up to 128 letters long. It can contain uppercase and lowercase letters, numbers, hyphens (-), and underscores (_).

  • quota_share_policy (Optional[QuotaSharePolicy], default: None ) –

    The quota share scheduling policy details. Only one of fairsharePolicy or quotaSharePolicy can be set. Once set, this policy type cannot be removed or changed to a fairSharePolicy.

  • fairshare_policy (Optional[FairsharePolicy], default: None ) –

    The fair-share scheduling policy details. Only one of fairsharePolicy or quotaSharePolicy can be set. Once set, this policy type cannot be removed or changed to a quotaSharePolicy.

  • tags (Optional[TagrisTagsMap], default: None ) –

    The tags that you apply to the scheduling policy to help you categorize and organize your resources. Each tag consists of a key and an optional value. For more information, see Tagging Amazon Web Services Resources in Amazon Web Services General Reference.

    These tags can be updated or removed using the TagResource and UntagResource API operations.

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.

Source code in docs_src/capo_batch/_services/batch.py
def create_scheduling_policy(
    self,
    *,
    config_overrides: Optional[BatchClientConfig] = None,
    name: Optional["capo_batch.types.string.String"] = None,
    quota_share_policy: Optional[
        "capo_batch.types.quota_share_policy.QuotaSharePolicy"
    ] = None,
    fairshare_policy: Optional[
        "capo_batch.types.fairshare_policy.FairsharePolicy"
    ] = None,
    tags: Optional["capo_batch.types.tagris_tags_map.TagrisTagsMap"] = None,
) -> "capo_batch.types.create_scheduling_policy_response.CreateSchedulingPolicyResponse":
    """<p>Creates an Batch scheduling policy.</p>

    Args:
        name: <p>The name of the fair-share scheduling policy. It can be up to 128 letters long. It can contain uppercase and lowercase letters, numbers, hyphens (-), and underscores (_).</p>
        quota_share_policy: <p>The quota share scheduling policy details. Only one of fairsharePolicy or quotaSharePolicy can be set. Once set, this policy type cannot be removed or changed to a fairSharePolicy.</p>
        fairshare_policy: <p>The fair-share scheduling policy details. Only one of fairsharePolicy or quotaSharePolicy can be set. Once set, this policy type cannot be removed or changed to a quotaSharePolicy.</p>
        tags: <p>The tags that you apply to the scheduling policy to help you categorize and organize your resources. Each tag consists of a key and an optional value. For more information, see <a href="https://docs.aws.amazon.com/general/latest/gr/aws_tagging.html">Tagging Amazon Web Services Resources</a> in <i>Amazon Web Services General Reference</i>.</p> <p>These tags can be updated or removed using the <a href="https://docs.aws.amazon.com/batch/latest/APIReference/API_TagResource.html">TagResource</a> and <a href="https://docs.aws.amazon.com/batch/latest/APIReference/API_UntagResource.html">UntagResource</a> API operations.</p>

    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.
    """

    def _handler(
        req: "OperationRequest[capo_batch.types.create_scheduling_policy_request.CreateSchedulingPolicyRequest]",
    ) -> OperationResponse[
        "capo_batch.types.create_scheduling_policy_response.CreateSchedulingPolicyResponse"
    ]:
        import capo_batch._operations.aws_batch_v20160810.create_scheduling_policy

        output, http_response = (
            capo_batch._operations.aws_batch_v20160810.create_scheduling_policy.create_scheduling_policy(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateSchedulingPolicy")
    )
    input_: capo_batch.types.create_scheduling_policy_request.CreateSchedulingPolicyRequest = {}
    if name is not None:
        input_["name"] = name
    if quota_share_policy is not None:
        input_["quota_share_policy"] = quota_share_policy
    if fairshare_policy is not None:
        input_["fairshare_policy"] = fairshare_policy
    if tags is not None:
        input_["tags"] = tags

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