Skip to content

create_worker

create_worker(
    farm_id: FarmId,
    fleet_id: FleetId,
    *,
    config_overrides: Optional[deadlineClientConfig] = None,
    host_properties: Optional[HostPropertiesRequest] = None,
    client_token: Optional[ClientToken] = None,
    tags: Optional[Tags] = None,
) -> CreateWorkerResponse

Creates a worker. A worker tells your instance how much processing power (vCPU), and memory (GiB) you’ll need to assemble the digital assets held within a particular instance. You can specify certain instance types to use, or let the worker know which instances types to exclude.

Deadline Cloud limits the number of workers to less than or equal to the fleet's maximum worker count. The service maintains eventual consistency for the worker count. If you make multiple rapid calls to CreateWorker before the field updates, you might exceed your fleet's maximum worker count. For example, if your maxWorkerCount is 10 and you currently have 9 workers, making two quick CreateWorker calls might successfully create 2 workers instead of 1, resulting in 11 total workers.

Parameters:

  • farm_id (FarmId) –

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

  • fleet_id (FleetId) –

    The fleet ID to connect to the worker.

  • host_properties (Optional[HostPropertiesRequest], default: None ) –

    The IP address and host name of the worker.

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

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

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

    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/deadline.py
def create_worker(
    self,
    farm_id: "capo_deadline.types.farm_id.FarmId",
    fleet_id: "capo_deadline.types.fleet_id.FleetId",
    *,
    config_overrides: Optional[deadlineClientConfig] = None,
    host_properties: Optional[
        "capo_deadline.types.host_properties_request.HostPropertiesRequest"
    ] = None,
    client_token: Optional["capo_deadline.types.client_token.ClientToken"] = None,
    tags: Optional["capo_deadline.types.tags.Tags"] = None,
) -> "capo_deadline.types.create_worker_response.CreateWorkerResponse":
    """<p>Creates a worker. A worker tells your instance how much processing power (vCPU), and memory (GiB) you’ll need to assemble the digital assets held within a particular instance. You can specify certain instance types to use, or let the worker know which instances types to exclude.</p> <p>Deadline Cloud limits the number of workers to less than or equal to the fleet's maximum worker count. The service maintains eventual consistency for the worker count. If you make multiple rapid calls to <code>CreateWorker</code> before the field updates, you might exceed your fleet's maximum worker count. For example, if your <code>maxWorkerCount</code> is 10 and you currently have 9 workers, making two quick <code>CreateWorker</code> calls might successfully create 2 workers instead of 1, resulting in 11 total workers.</p>

    Args:
        farm_id: <p>The farm ID of the farm to connect to the worker.</p>
        fleet_id: <p>The fleet ID to connect to the worker.</p>
        host_properties: <p>The IP address and host name of the worker.</p>
        client_token: <p>The unique token which the server uses to recognize retries of the same request.</p>
        tags: <p>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.conflict_exception.ConflictException: <p>Your request has conflicting operations. This can occur if you're trying to perform more than one operation on the same resource at the same time.</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.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_worker_request.CreateWorkerRequest]",
    ) -> OperationResponse[
        "capo_deadline.types.create_worker_response.CreateWorkerResponse"
    ]:
        import capo_deadline._operations.deadline.create_worker

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

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateWorker")
    )
    input_: capo_deadline.types.create_worker_request.CreateWorkerRequest = {
        "farm_id": farm_id,
        "fleet_id": fleet_id,
    }
    if host_properties is not None:
        input_["host_properties"] = host_properties
    if client_token is None:
        client_token = str(uuid.uuid4())
    input_["client_token"] = client_token
    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