Skip to content

Commit

Permalink
Add Client as a kwarg for GlobusComputeExecutor.
Browse files Browse the repository at this point in the history
  • Loading branch information
yadudoc committed Nov 7, 2024
1 parent eea47e8 commit 5cd1e2a
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions parsl/executors/globus_compute.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@
from parsl.executors.base import ParslExecutor
from parsl.utils import RepresentationMixin

try:
from globus_compute_sdk import Client, Executor
_globus_compute_enabled = True
except ImportError:
_globus_compute_enabled = False
Client: Any # type: ignore[no-redef]

UUID_LIKE_T = Union[uuid.UUID, str]


Expand All @@ -27,6 +34,7 @@ def __init__(
label: str = "GlobusComputeExecutor",
batch_size: int = 128,
amqp_port: Optional[int] = None,
client: Optional[Client] = None,
**kwargs,
):
"""
Expand Down Expand Up @@ -60,6 +68,10 @@ def __init__(
Port to use when connecting to results queue. Note that the
Compute web services only support 5671, 5672, and 443.
client:
instance of globus_compute_sdk.Client to be used by the executor.
If not provided, the executor will instantiate one with default arguments.
kwargs:
Other kwargs listed will be passed through to globus_compute_sdk.Executor
as is
Expand All @@ -72,14 +84,14 @@ def __init__(
self.label = label
self.batch_size = batch_size
self.amqp_port = amqp_port
self.client = client

try:
from globus_compute_sdk import Executor
except ImportError:
if not _globus_compute_enabled:
raise OptionalModuleMissing(
['globus-compute-sdk'],
"GlobusComputeExecutor requires globus-compute-sdk installed"
)

self._executor: Executor = Executor(
endpoint_id=endpoint_id,
task_group_id=task_group_id,
Expand All @@ -88,6 +100,7 @@ def __init__(
label=label,
batch_size=batch_size,
amqp_port=amqp_port,
client=self.client,
**kwargs
)

Expand Down

0 comments on commit 5cd1e2a

Please sign in to comment.