66from parsl .executors .base import ParslExecutor
77from parsl .utils import RepresentationMixin
88
9+ try :
10+ from globus_compute_sdk import Client , Executor
11+ _globus_compute_enabled = True
12+ except ImportError :
13+ _globus_compute_enabled = False
14+ Client : Any # type: ignore[no-redef]
15+
916UUID_LIKE_T = Union [uuid .UUID , str ]
1017
1118
@@ -27,6 +34,7 @@ def __init__(
2734 label : str = "GlobusComputeExecutor" ,
2835 batch_size : int = 128 ,
2936 amqp_port : Optional [int ] = None ,
37+ client : Optional [Client ] = None ,
3038 ** kwargs ,
3139 ):
3240 """
@@ -60,6 +68,10 @@ def __init__(
6068 Port to use when connecting to results queue. Note that the
6169 Compute web services only support 5671, 5672, and 443.
6270
71+ client:
72+ instance of globus_compute_sdk.Client to be used by the executor.
73+ If not provided, the executor will instantiate one with default arguments.
74+
6375 kwargs:
6476 Other kwargs listed will be passed through to globus_compute_sdk.Executor
6577 as is
@@ -72,14 +84,14 @@ def __init__(
7284 self .label = label
7385 self .batch_size = batch_size
7486 self .amqp_port = amqp_port
87+ self .client = client
7588
76- try :
77- from globus_compute_sdk import Executor
78- except ImportError :
89+ if not _globus_compute_enabled :
7990 raise OptionalModuleMissing (
8091 ['globus-compute-sdk' ],
8192 "GlobusComputeExecutor requires globus-compute-sdk installed"
8293 )
94+
8395 self ._executor : Executor = Executor (
8496 endpoint_id = endpoint_id ,
8597 task_group_id = task_group_id ,
@@ -88,6 +100,7 @@ def __init__(
88100 label = label ,
89101 batch_size = batch_size ,
90102 amqp_port = amqp_port ,
103+ client = self .client ,
91104 ** kwargs
92105 )
93106
0 commit comments