Globus Compute

The standard way to interact with the Globus Compute service is through the Globus Compute SDK, a separate, specialized toolkit that offers enhanced functionality for Globus Compute. Under the hood, the Globus Compute SDK uses the following clients to interact with the Globus Compute API. Advanced users may choose to work directly with these clients for custom implementations.

There are two client classes, supporting versions 2 and 3 of the Globus Compute API. Where feasible, new projects should use ComputeClientV3, which supports the latest API features and improvements.

class globus_sdk.ComputeClientV2(*, environment=None, base_url=None, app=None, app_scopes=None, authorizer=None, app_name=None, transport_params=None)[source]

Bases: BaseClient

Client for the Globus Compute API, version 2.

Parameters:
  • app (GlobusApp | None) – A GlobusApp which will be used for handling authorization and storing and validating tokens. Passing an app will automatically include a client’s default scopes in the app’s scope requirements unless specific app_scopes are given. If app_name is not given, the app’s app_name will be used. Mutually exclusive with authorizer.

  • app_scopes (list[Scope] | None) – Optional list of Scope objects to be added to app’s scope requirements instead of default_scope_requirements. Requires app.

  • authorizer (GlobusAuthorizer | None) – A GlobusAuthorizer which will generate Authorization headers. Mutually exclusive with app.

  • app_name (str | None) – Optional “nice name” for the application. Has no bearing on the semantics of client actions. It is just passed as part of the User-Agent string, and may be useful when debugging issues with the Globus Team. If both``app`` and app_name are given, this value takes priority.

  • base_url (str | None) – The URL for the service. Most client types initialize this value intelligently by default. Set it when inheriting from BaseClient or communicating through a proxy. This value takes precedence over the class attribute of the same name.

  • transport_params (dict[str, t.Any] | None) – Options to pass to the transport for this client

Methods

scopes

Various scopes are available as attributes of this object. For example, access the all scope with

>>> ComputeClientV2.scopes.all

Supported Scopes

  • all

get_version(service=None)[source]

Get the current version of the API and other services.

Parameters:

service (str | None) – Service for which to get version information.

Return type:

GlobusHTTPResponse

See Get Version in the API documentation for details.

get_result_amqp_url()[source]

Generate new credentials (in the form of a connection URL) for connecting to the AMQP service.

See Get Result AMQP URL in the API documentation for details.

Return type:

GlobusHTTPResponse

register_endpoint(data)[source]

Register a new endpoint.

Parameters:

data (dict[str, Any]) – An endpoint registration document.

Return type:

GlobusHTTPResponse

See Register Endpoint in the API documentation for details.

get_endpoint(endpoint_id)[source]

Get information about a registered endpoint.

Parameters:

endpoint_id (UUID | str) – The ID of the Globus Compute endpoint.

Return type:

GlobusHTTPResponse

See Get Endpoint in the API documentation for details.

get_endpoint_status(endpoint_id)[source]

Get the status of a registered endpoint.

Parameters:

endpoint_id (UUID | str) – The ID of the Globus Compute endpoint.

Return type:

GlobusHTTPResponse

See Get Endpoint Status in the API documentation for details.

get_endpoints(role=MISSING)[source]

Get a list of registered endpoints associated with the authenticated user.

Parameters:

role (str | MissingType) – Role of the user in relation to endpoints. (e.g.: owner, any)

Return type:

GlobusHTTPResponse

See Get Endpoints in the API documentation for details.

delete_endpoint(endpoint_id)[source]

Delete a registered endpoint.

Parameters:

endpoint_id (UUID | str) – The ID of the Globus Compute endpoint.

Return type:

GlobusHTTPResponse

See Delete Endpoint in the API documentation for details.

lock_endpoint(endpoint_id)[source]

Temporarily block registration requests for the endpoint.

Parameters:

endpoint_id (UUID | str) – The ID of the Globus Compute endpoint.

Return type:

GlobusHTTPResponse

See Lock Endpoint in the API documentation for details.

register_function(function_data)[source]

Register a new function.

Parameters:

function_data (dict[str, Any]) – A function registration document.

Return type:

GlobusHTTPResponse

See Register Function in the API documentation for details.

get_function(function_id)[source]

Get information about a registered function.

Parameters:

function_id (UUID | str) – The ID of the function.

Return type:

GlobusHTTPResponse

See Get Function in the API documentation for details.

delete_function(function_id)[source]

Delete a registered function.

Parameters:

function_id (UUID | str) – The ID of the function.

Return type:

GlobusHTTPResponse

See Delete Function in the API documentation for details.

get_task(task_id)[source]

Get information about a task.

Parameters:

task_id (UUID | str) – The ID of the task.

Return type:

GlobusHTTPResponse

See Get Task in the API documentation for details.

get_task_batch(task_ids)[source]

Get information about a batch of tasks.

Parameters:

task_ids (UUID | str | Iterable[UUID | str]) – The IDs of the tasks.

Return type:

GlobusHTTPResponse

See Get Task Batch in the API documentation for details.

get_task_group(task_group_id)[source]

Get a list of task IDs associated with a task group.

Parameters:

task_group_id (UUID | str) – The ID of the task group.

Return type:

GlobusHTTPResponse

See Get Task Group Tasks in the API documentation for details.

submit(data)[source]

Submit a batch of tasks to a Globus Compute endpoint.

Parameters:

data (dict[str, Any]) – The task batch document.

Return type:

GlobusHTTPResponse

See Submit Batch in the API documentation for details.

class globus_sdk.ComputeClientV3(*, environment=None, base_url=None, app=None, app_scopes=None, authorizer=None, app_name=None, transport_params=None)[source]

Bases: BaseClient

Client for the Globus Compute API, version 3.

Methods

scopes

Various scopes are available as attributes of this object. For example, access the all scope with

>>> ComputeClientV3.scopes.all

Supported Scopes

  • all

register_endpoint(data)[source]

Register a new endpoint.

Parameters:

data (dict[str, Any]) – An endpoint registration document.

Return type:

GlobusHTTPResponse

See Register Endpoint in the API documentation for details.

update_endpoint(endpoint_id, data)[source]

Update an endpoint.

Parameters:
  • endpoint_id (UUID | str) – The ID of the endpoint.

  • data (dict[str, Any]) – An endpoint update document.

Return type:

GlobusHTTPResponse

See Update Endpoint in the API documentation for details.

lock_endpoint(endpoint_id)[source]

Temporarily block registration requests for the endpoint.

Parameters:

endpoint_id (UUID | str) – The ID of the Globus Compute endpoint.

Return type:

GlobusHTTPResponse

See Lock Endpoint in the API documentation for details.

get_endpoint_allowlist(endpoint_id)[source]

Get a list of IDs for functions allowed to run on an endpoint.

Parameters:

endpoint_id (UUID | str) – The ID of the Globus Compute endpoint.

Return type:

GlobusHTTPResponse

See Get Endpoint Allowlist in the API documentation for details.

register_function(data)[source]

Register a new function.

Parameters:

data (dict[str, Any]) – A function registration document.

Return type:

GlobusHTTPResponse

See Register Function in the API documentation for details.

submit(endpoint_id, data)[source]

Submit a batch of tasks to a Globus Compute endpoint.

Parameters:
  • endpoint_id (UUID | str) – The ID of the Globus Compute endpoint.

  • data (dict[str, Any]) – The task batch document.

Return type:

GlobusHTTPResponse

See Submit Batch in the API documentation for details.

class globus_sdk.ComputeClient[source]

A deprecated alias for ComputeClientV2.

Warning

This class will be removed in globus-sdk version 4. Users should migrate to one of the explicitly-versioned classes.

Client Errors

When an API error occurs, ComputeClientV2 and ComputeClientV3 will raise ComputeAPIError.

class globus_sdk.ComputeAPIError(r, *args, **kwargs)[source]

Bases: GlobusAPIError