Skip to content

create_queue_environment

create_queue_environment(
    farm_id: FarmId,
    queue_id: QueueId,
    priority: Priority,
    template_type: EnvironmentTemplateType,
    template: EnvironmentTemplate,
    *,
    config_overrides: Optional[deadlineClientConfig] = None,
    client_token: Optional[ClientToken] = None,
) -> CreateQueueEnvironmentResponse

Creates an environment for a queue that defines how jobs in the queue run.

Parameters:

  • farm_id (FarmId) –

    The farm ID of the farm to connect to the environment.

  • queue_id (QueueId) –

    The queue ID to connect the queue and environment.

  • client_token (Optional[ClientToken], default: None ) –

    The unique token which the server uses to recognize retries of the same request.

  • priority (Priority) –

    Sets the priority of the environments in the queue from 0 to 10,000, where 0 is the highest priority (activated first and deactivated last). If two environments share the same priority value, the environment created first takes higher priority.

  • template_type (EnvironmentTemplateType) –

    The template's file type, JSON or YAML.

  • template (EnvironmentTemplate) –

    The environment template to use in the queue.

Raises:

Source code in docs_src/capo_deadline/_services/deadline.py
def create_queue_environment(
    self,
    farm_id: "capo_deadline.types.farm_id.FarmId",
    queue_id: "capo_deadline.types.queue_id.QueueId",
    priority: "capo_deadline.types.priority.Priority",
    template_type: "capo_deadline.types.environment_template_type.EnvironmentTemplateType",
    template: "capo_deadline.types.environment_template.EnvironmentTemplate",
    *,
    config_overrides: Optional[deadlineClientConfig] = None,
    client_token: Optional["capo_deadline.types.client_token.ClientToken"] = None,
) -> "capo_deadline.types.create_queue_environment_response.CreateQueueEnvironmentResponse":
    """<p>Creates an environment for a queue that defines how jobs in the queue run.</p>

    Args:
        farm_id: <p>The farm ID of the farm to connect to the environment.</p>
        queue_id: <p>The queue ID to connect the queue and environment.</p>
        client_token: <p>The unique token which the server uses to recognize retries of the same request.</p>
        priority: <p>Sets the priority of the environments in the queue from 0 to 10,000, where 0 is the highest priority (activated first and deactivated last). If two environments share the same priority value, the environment created first takes higher priority.</p>
        template_type: <p>The template's file type, <code>JSON</code> or <code>YAML</code>.</p>
        template: <p>The environment template to use in the queue.</p>

    Raises:
        capo_deadline.errors.access_denied_exception.AccessDeniedException: <p>You don't have permission to perform the action.</p>
        capo_deadline.errors.internal_server_error_exception.InternalServerErrorException: <p>Deadline Cloud can't process your request right now. Try again later.</p>
        capo_deadline.errors.resource_not_found_exception.ResourceNotFoundException: <p>The requested resource can't be found.</p>
        capo_deadline.errors.service_quota_exceeded_exception.ServiceQuotaExceededException: <p>You exceeded your service quota. Service quotas, also referred to as limits, are the maximum number of service resources or operations for your Amazon Web Services account.</p>
        capo_deadline.errors.throttling_exception.ThrottlingException: <p>Your request exceeded a request rate quota.</p>
        capo_deadline.errors.validation_exception.ValidationException: <p>The request isn't valid. This can occur if your request contains malformed JSON or unsupported characters.</p>
        capo_deadline.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_deadline.types.create_queue_environment_request.CreateQueueEnvironmentRequest]",
    ) -> OperationResponse[
        "capo_deadline.types.create_queue_environment_response.CreateQueueEnvironmentResponse"
    ]:
        import capo_deadline._operations.deadline.create_queue_environment

        output, http_response = (
            capo_deadline._operations.deadline.create_queue_environment.create_queue_environment(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    def _redact_input(
        input_: "capo_deadline.types.create_queue_environment_request.CreateQueueEnvironmentRequest",
    ) -> dict[str, Any]:
        import capo_deadline.types.create_queue_environment_request

        return (
            capo_deadline.types.create_queue_environment_request.redact_sensitive(
                input_
            )
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging("CreateQueueEnvironment", redact_input=_redact_input),
    )
    input_: capo_deadline.types.create_queue_environment_request.CreateQueueEnvironmentRequest = {
        "farm_id": farm_id,
        "queue_id": queue_id,
        "priority": priority,
        "template_type": template_type,
        "template": template,
    }
    if client_token is None:
        client_token = str(uuid.uuid4())
    input_["client_token"] = client_token

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