Skip to content

create_job async

create_job(
    farm_id: FarmId,
    queue_id: QueueId,
    priority: JobPriority,
    *,
    config_overrides: Optional[AsyncdeadlineClientConfig] = None,
    client_token: Optional[ClientToken] = None,
    template: Optional[JobTemplate] = None,
    template_type: Optional[JobTemplateType] = None,
    parameters: Optional[JobParameters] = None,
    attachments: Optional[Attachments] = None,
    storage_profile_id: Optional[StorageProfileId] = None,
    target_task_run_status: Optional[CreateJobTargetTaskRunStatus] = None,
    max_failed_tasks_count: Optional[MaxFailedTasksCount] = None,
    max_retries_per_task: Optional[MaxRetriesPerTask] = None,
    max_worker_count: Optional[MaxWorkerCount] = None,
    source_job_id: Optional[JobId] = None,
    name_override: Optional[JobName] = None,
    description_override: Optional[JobDescriptionOverride] = None,
    tags: Optional[Tags] = None,
) -> CreateJobResponse

Creates a job. A job is a set of instructions that Deadline Cloud uses to schedule and run work on available workers. For more information, see Deadline Cloud jobs.

Parameters:

  • farm_id (FarmId) –

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

  • queue_id (QueueId) –

    The ID of the queue that the job is submitted to.

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

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

  • template (Optional[JobTemplate], default: None ) –

    The job template to use for this job.

  • template_type (Optional[JobTemplateType], default: None ) –

    The file type for the job template.

  • priority (JobPriority) –

    The priority of the job. The highest priority (first scheduled) is 100. When two jobs have the same priority, the oldest job is scheduled first.

  • parameters (Optional[JobParameters], default: None ) –

    The parameters for the job.

  • attachments (Optional[Attachments], default: None ) –

    The attachments for the job. Attach files required for the job to run to a render job.

  • storage_profile_id (Optional[StorageProfileId], default: None ) –

    The storage profile ID for the storage profile to connect to the job.

  • target_task_run_status (Optional[CreateJobTargetTaskRunStatus], default: None ) –

    The initial job status when it is created. Jobs that are created with a SUSPENDED status will not run until manually requeued.

  • max_failed_tasks_count (Optional[MaxFailedTasksCount], default: None ) –

    The number of task failures before the job stops running and is marked as FAILED.

  • max_retries_per_task (Optional[MaxRetriesPerTask], default: None ) –

    The maximum number of retries for each task.

  • max_worker_count (Optional[MaxWorkerCount], default: None ) –

    The maximum number of worker hosts that can concurrently process a job. When the maxWorkerCount is reached, no more workers will be assigned to process the job, even if the fleets assigned to the job's queue has available workers.

    You can't set the maxWorkerCount to 0. If you set it to -1, there is no maximum number of workers.

    If you don't specify the maxWorkerCount, Deadline Cloud won't throttle the number of workers used to process the job.

  • source_job_id (Optional[JobId], default: None ) –

    The job ID for the source job.

  • name_override (Optional[JobName], default: None ) –

    A custom name to override the job name derived from the job template.

  • description_override (Optional[JobDescriptionOverride], default: None ) –

    A custom description to override the job description derived from the job template.

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

    The tags to add to your job. Each tag consists of a tag key and a tag value. Tag keys and values are both required, but tag values can be empty strings.

Raises:

Source code in docs_src/capo_deadline/_services/async_deadline.py
async def create_job(
    self,
    farm_id: "capo_deadline.types.farm_id.FarmId",
    queue_id: "capo_deadline.types.queue_id.QueueId",
    priority: "capo_deadline.types.job_priority.JobPriority",
    *,
    config_overrides: Optional[AsyncdeadlineClientConfig] = None,
    client_token: Optional["capo_deadline.types.client_token.ClientToken"] = None,
    template: Optional["capo_deadline.types.job_template.JobTemplate"] = None,
    template_type: Optional[
        "capo_deadline.types.job_template_type.JobTemplateType"
    ] = None,
    parameters: Optional["capo_deadline.types.job_parameters.JobParameters"] = None,
    attachments: Optional["capo_deadline.types.attachments.Attachments"] = None,
    storage_profile_id: Optional[
        "capo_deadline.types.storage_profile_id.StorageProfileId"
    ] = None,
    target_task_run_status: Optional[
        "capo_deadline.types.create_job_target_task_run_status.CreateJobTargetTaskRunStatus"
    ] = None,
    max_failed_tasks_count: Optional[
        "capo_deadline.types.max_failed_tasks_count.MaxFailedTasksCount"
    ] = None,
    max_retries_per_task: Optional[
        "capo_deadline.types.max_retries_per_task.MaxRetriesPerTask"
    ] = None,
    max_worker_count: Optional[
        "capo_deadline.types.max_worker_count.MaxWorkerCount"
    ] = None,
    source_job_id: Optional["capo_deadline.types.job_id.JobId"] = None,
    name_override: Optional["capo_deadline.types.job_name.JobName"] = None,
    description_override: Optional[
        "capo_deadline.types.job_description_override.JobDescriptionOverride"
    ] = None,
    tags: Optional["capo_deadline.types.tags.Tags"] = None,
) -> "capo_deadline.types.create_job_response.CreateJobResponse":
    """<p>Creates a job. A job is a set of instructions that Deadline Cloud uses to schedule and run work on available workers. For more information, see <a href="https://docs.aws.amazon.com/deadline-cloud/latest/userguide/deadline-cloud-jobs.html">Deadline Cloud jobs</a>.</p>

    Args:
        farm_id: <p>The farm ID of the farm to connect to the job.</p>
        queue_id: <p>The ID of the queue that the job is submitted to.</p>
        client_token: <p>The unique token which the server uses to recognize retries of the same request.</p>
        template: <p>The job template to use for this job.</p>
        template_type: <p>The file type for the job template.</p>
        priority: <p>The priority of the job. The highest priority (first scheduled) is 100. When two jobs have the same priority, the oldest job is scheduled first.</p>
        parameters: <p>The parameters for the job.</p>
        attachments: <p>The attachments for the job. Attach files required for the job to run to a render job.</p>
        storage_profile_id: <p>The storage profile ID for the storage profile to connect to the job.</p>
        target_task_run_status: <p>The initial job status when it is created. Jobs that are created with a <code>SUSPENDED</code> status will not run until manually requeued.</p>
        max_failed_tasks_count: <p>The number of task failures before the job stops running and is marked as <code>FAILED</code>.</p>
        max_retries_per_task: <p>The maximum number of retries for each task.</p>
        max_worker_count: <p>The maximum number of worker hosts that can concurrently process a job. When the <code>maxWorkerCount</code> is reached, no more workers will be assigned to process the job, even if the fleets assigned to the job's queue has available workers.</p> <p>You can't set the <code>maxWorkerCount</code> to 0. If you set it to -1, there is no maximum number of workers.</p> <p>If you don't specify the <code>maxWorkerCount</code>, Deadline Cloud won't throttle the number of workers used to process the job.</p>
        source_job_id: <p>The job ID for the source job.</p>
        name_override: <p>A custom name to override the job name derived from the job template.</p>
        description_override: <p>A custom description to override the job description derived from the job template.</p>
        tags: <p>The tags to add to your job. Each tag consists of a tag key and a tag value. Tag keys and values are both required, but tag values can be empty strings.</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.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_deadline.types.create_job_request.CreateJobRequest]",
    ) -> AsyncOperationResponse[
        "capo_deadline.types.create_job_response.CreateJobResponse"
    ]:
        import capo_deadline._operations.deadline.create_job

        (
            output,
            http_response,
        ) = await capo_deadline._operations.deadline.create_job.async_create_job(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

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

        return capo_deadline.types.create_job_request.redact_sensitive(input_)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateJob", redact_input=_redact_input)
    )
    input_: capo_deadline.types.create_job_request.CreateJobRequest = {
        "farm_id": farm_id,
        "queue_id": queue_id,
        "priority": priority,
    }
    if client_token is None:
        client_token = str(uuid.uuid4())
    input_["client_token"] = client_token
    if template is not None:
        input_["template"] = template
    if template_type is not None:
        input_["template_type"] = template_type
    if parameters is not None:
        input_["parameters"] = parameters
    if attachments is not None:
        input_["attachments"] = attachments
    if storage_profile_id is not None:
        input_["storage_profile_id"] = storage_profile_id
    if target_task_run_status is not None:
        input_["target_task_run_status"] = target_task_run_status
    if max_failed_tasks_count is not None:
        input_["max_failed_tasks_count"] = max_failed_tasks_count
    if max_retries_per_task is not None:
        input_["max_retries_per_task"] = max_retries_per_task
    if max_worker_count is not None:
        input_["max_worker_count"] = max_worker_count
    if source_job_id is not None:
        input_["source_job_id"] = source_job_id
    if name_override is not None:
        input_["name_override"] = name_override
    if description_override is not None:
        input_["description_override"] = description_override
    if tags is not None:
        input_["tags"] = tags

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