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.
The canonical ComputeClient
is a subclass of ComputeClientV2
,
which supports version 2 of the Globus Compute API. When feasible, new projects
should use ComputeClientV3
, which supports version 3 and includes the
latest API features and improvements.
- class globus_sdk.ComputeClient(*, environment=None, base_url=None, app=None, app_scopes=None, authorizer=None, app_name=None, transport_params=None)[source]¶
Bases:
ComputeClientV2
Canonical client for the Globus Compute API, with support exclusively for API version 2.
- Parameters:
app (GlobusApp | None) – A
GlobusApp
which will be used for handling authorization and storing and validating tokens. Passing anapp
will automatically include a client’s default scopes in theapp
’s scope requirements unless specificapp_scopes
are given. Ifapp_name
is not given, theapp
’sapp_name
will be used. Mutually exclusive withauthorizer
.app_scopes (list[Scope] | None) – Optional list of
Scope
objects to be added toapp
’s scope requirements instead ofdefault_scope_requirements
. Requiresapp
.authorizer (GlobusAuthorizer | None) – A
GlobusAuthorizer
which will generate Authorization headers. Mutually exclusive withapp
.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) – 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
- 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 anapp
will automatically include a client’s default scopes in theapp
’s scope requirements unless specificapp_scopes
are given. Ifapp_name
is not given, theapp
’sapp_name
will be used. Mutually exclusive withauthorizer
.app_scopes (list[Scope] | None) – Optional list of
Scope
objects to be added toapp
’s scope requirements instead ofdefault_scope_requirements
. Requiresapp
.authorizer (GlobusAuthorizer | None) – A
GlobusAuthorizer
which will generate Authorization headers. Mutually exclusive withapp
.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) – 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>>> ComputeClient.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:
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:
- register_endpoint(data)[source]¶
Register a new endpoint.
- Parameters:
- Return type:
See Register Endpoint in the API documentation for details.
- get_endpoint(endpoint_id)[source]¶
Get information about a registered endpoint.
See Get Endpoint in the API documentation for details.
- get_endpoint_status(endpoint_id)[source]¶
Get the status of a registered endpoint.
See Get Endpoint Status in the API documentation for details.
- get_endpoints()[source]¶
Get a list of registered endpoints associated with the authenticated user.
See Get Endpoints in the API documentation for details.
- Return type:
- delete_endpoint(endpoint_id)[source]¶
Delete a registered endpoint.
See Delete Endpoint in the API documentation for details.
- lock_endpoint(endpoint_id)[source]¶
Temporarily block registration requests for the endpoint.
See Lock Endpoint in the API documentation for details.
- register_function(function_data)[source]¶
Register a new function.
See Register Function in the API documentation for details.
- get_function(function_id)[source]¶
Get information about a registered function.
- Parameters:
- Return type:
See Get Function in the API documentation for details.
- delete_function(function_id)[source]¶
Delete a registered function.
- Parameters:
- Return type:
See Delete Function in the API documentation for details.
- get_task(task_id)[source]¶
Get information about a task.
- Parameters:
- Return type:
See Get Task in the API documentation for details.
- get_task_batch(task_ids)[source]¶
Get information about a batch of tasks.
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:
- Return type:
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:
- Return type:
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>>> ComputeClient.scopes.all
Supported Scopes
all
- register_endpoint(data)[source]¶
Register a new endpoint.
- Parameters:
- Return type:
See Register Endpoint in the API documentation for details.
- update_endpoint(endpoint_id, data)[source]¶
Update an endpoint.
- Parameters:
- Return type:
See Update Endpoint in the API documentation for details.
- lock_endpoint(endpoint_id)[source]¶
Temporarily block registration requests for the endpoint.
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.
See Get Endpoint Allowlist in the API documentation for details.
- register_function(data)[source]¶
Register a new function.
- Parameters:
- Return type:
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:
- Return type:
See Submit Batch in the API documentation for details.
Client Errors¶
When an error occurs, a ComputeClient
will raise a ComputeAPIError
.
- class globus_sdk.ComputeAPIError(r, *args, **kwargs)[source]¶
Bases:
GlobusAPIError