executorlib 1.9.1__py3-none-any.whl → 1.9.2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- executorlib/_version.py +2 -2
- executorlib/executor/flux.py +3 -3
- executorlib/executor/slurm.py +2 -2
- executorlib/standalone/validate.py +1 -0
- executorlib/task_scheduler/interactive/blockallocation.py +57 -5
- executorlib/task_scheduler/interactive/spawner_pysqa.py +2 -0
- {executorlib-1.9.1.dist-info → executorlib-1.9.2.dist-info}/METADATA +1 -1
- {executorlib-1.9.1.dist-info → executorlib-1.9.2.dist-info}/RECORD +10 -10
- {executorlib-1.9.1.dist-info → executorlib-1.9.2.dist-info}/WHEEL +1 -1
- {executorlib-1.9.1.dist-info → executorlib-1.9.2.dist-info}/licenses/LICENSE +0 -0
executorlib/_version.py
CHANGED
|
@@ -28,7 +28,7 @@ version_tuple: VERSION_TUPLE
|
|
|
28
28
|
commit_id: COMMIT_ID
|
|
29
29
|
__commit_id__: COMMIT_ID
|
|
30
30
|
|
|
31
|
-
__version__ = version = '1.9.
|
|
32
|
-
__version_tuple__ = version_tuple = (1, 9,
|
|
31
|
+
__version__ = version = '1.9.2'
|
|
32
|
+
__version_tuple__ = version_tuple = (1, 9, 2)
|
|
33
33
|
|
|
34
34
|
__commit_id__ = commit_id = None
|
executorlib/executor/flux.py
CHANGED
|
@@ -55,7 +55,7 @@ class FluxJobExecutor(BaseExecutor):
|
|
|
55
55
|
allowed to take in seconds.
|
|
56
56
|
* priority (int): the queuing system priority assigned to a given Python function to
|
|
57
57
|
influence the scheduling.
|
|
58
|
-
|
|
58
|
+
* slurm_cmd_args (list): Additional command line arguments for the srun call (SLURM only)
|
|
59
59
|
pmi_mode (str): PMI interface to use (OpenMPI v5 requires pmix) default is None
|
|
60
60
|
flux_executor (flux.job.FluxExecutor): Flux Python interface to submit the workers to flux
|
|
61
61
|
flux_executor_nesting (bool): Provide hierarchically nested Flux job scheduler inside the submitted function.
|
|
@@ -287,7 +287,7 @@ class FluxClusterExecutor(BaseExecutor):
|
|
|
287
287
|
allowed to take in seconds.
|
|
288
288
|
* priority (int): the queuing system priority assigned to a given Python function to
|
|
289
289
|
influence the scheduling.
|
|
290
|
-
|
|
290
|
+
* slurm_cmd_args (list): Additional command line arguments for the srun call (SLURM only)
|
|
291
291
|
pysqa_config_directory (str, optional): path to the pysqa config directory (only for pysqa based backend).
|
|
292
292
|
pmi_mode (str): PMI interface to use (OpenMPI v5 requires pmix) default is None
|
|
293
293
|
hostname_localhost (boolean): use localhost instead of the hostname to establish the zmq connection. In the
|
|
@@ -544,7 +544,7 @@ def create_flux_executor(
|
|
|
544
544
|
allowed to take in seconds.
|
|
545
545
|
* priority (int): the queuing system priority assigned to a given Python function to
|
|
546
546
|
influence the scheduling.
|
|
547
|
-
|
|
547
|
+
* slurm_cmd_args (list): Additional command line arguments for the srun call (SLURM only)
|
|
548
548
|
pmi_mode (str): PMI interface to use (OpenMPI v5 requires pmix) default is None
|
|
549
549
|
flux_executor (flux.job.FluxExecutor): Flux Python interface to submit the workers to flux
|
|
550
550
|
flux_executor_nesting (bool): Provide hierarchically nested Flux job scheduler inside the submitted function.
|
executorlib/executor/slurm.py
CHANGED
|
@@ -56,7 +56,7 @@ class SlurmClusterExecutor(BaseExecutor):
|
|
|
56
56
|
allowed to take in seconds.
|
|
57
57
|
* priority (int): the queuing system priority assigned to a given Python function to
|
|
58
58
|
influence the scheduling.
|
|
59
|
-
|
|
59
|
+
* slurm_cmd_args (list): Additional command line arguments for the srun call (SLURM only)
|
|
60
60
|
pysqa_config_directory (str, optional): path to the pysqa config directory (only for pysqa based backend).
|
|
61
61
|
pmi_mode (str): PMI interface to use (OpenMPI v5 requires pmix) default is None
|
|
62
62
|
hostname_localhost (boolean): use localhost instead of the hostname to establish the zmq connection. In the
|
|
@@ -297,7 +297,7 @@ class SlurmJobExecutor(BaseExecutor):
|
|
|
297
297
|
allowed to take in seconds.
|
|
298
298
|
* priority (int): the queuing system priority assigned to a given Python function to
|
|
299
299
|
influence the scheduling.
|
|
300
|
-
|
|
300
|
+
* slurm_cmd_args (list): Additional command line arguments for the srun call (SLURM only)
|
|
301
301
|
pmi_mode (str): PMI interface to use (OpenMPI v5 requires pmix) default is None
|
|
302
302
|
hostname_localhost (boolean): use localhost instead of the hostname to establish the zmq connection. In the
|
|
303
303
|
context of an HPC cluster this essential to be able to communicate to an
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import queue
|
|
2
2
|
import random
|
|
3
3
|
from concurrent.futures import Future
|
|
4
|
-
from threading import Event, Thread
|
|
4
|
+
from threading import Event, Lock, Thread
|
|
5
5
|
from typing import Callable, Optional
|
|
6
6
|
|
|
7
7
|
from executorlib.standalone.command import get_interactive_execute_command
|
|
@@ -83,6 +83,8 @@ class BlockAllocationTaskScheduler(TaskSchedulerBase):
|
|
|
83
83
|
self_id = random.getrandbits(128)
|
|
84
84
|
self._self_id = self_id
|
|
85
85
|
_interrupt_bootup_dict[self._self_id] = False
|
|
86
|
+
alive_workers = [max_workers]
|
|
87
|
+
alive_workers_lock = Lock()
|
|
86
88
|
bootup_events = [Event() for _ in range(self._max_workers)]
|
|
87
89
|
bootup_events[0].set()
|
|
88
90
|
self._set_process(
|
|
@@ -99,6 +101,8 @@ class BlockAllocationTaskScheduler(TaskSchedulerBase):
|
|
|
99
101
|
if worker_id + 1 < self._max_workers
|
|
100
102
|
else None
|
|
101
103
|
),
|
|
104
|
+
"alive_workers": alive_workers,
|
|
105
|
+
"alive_workers_lock": alive_workers_lock,
|
|
102
106
|
},
|
|
103
107
|
)
|
|
104
108
|
for worker_id in range(self._max_workers)
|
|
@@ -227,6 +231,8 @@ def _execute_multiple_tasks(
|
|
|
227
231
|
restart_limit: int = 0,
|
|
228
232
|
bootup_event: Optional[Event] = None,
|
|
229
233
|
next_bootup_event: Optional[Event] = None,
|
|
234
|
+
alive_workers: Optional[list] = None,
|
|
235
|
+
alive_workers_lock: Optional[Lock] = None,
|
|
230
236
|
**kwargs,
|
|
231
237
|
) -> None:
|
|
232
238
|
"""
|
|
@@ -258,6 +264,9 @@ def _execute_multiple_tasks(
|
|
|
258
264
|
bootup_event (Event): Event to wait on before submitting the job to the scheduler, ensuring workers are
|
|
259
265
|
submitted in worker_id order.
|
|
260
266
|
next_bootup_event (Event): Event to signal after job submission, unblocking the next worker.
|
|
267
|
+
alive_workers (list): Single-element list [N] tracking how many worker threads are still alive. Shared across
|
|
268
|
+
all worker threads; decremented when a worker is permanently dead.
|
|
269
|
+
alive_workers_lock (Lock): Lock protecting alive_workers from concurrent modification.
|
|
261
270
|
"""
|
|
262
271
|
if bootup_event is not None:
|
|
263
272
|
bootup_event.wait()
|
|
@@ -279,11 +288,13 @@ def _execute_multiple_tasks(
|
|
|
279
288
|
)
|
|
280
289
|
restart_counter = 0
|
|
281
290
|
while True:
|
|
282
|
-
if not interface.status and restart_counter
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
291
|
+
if not interface.status and restart_counter >= restart_limit:
|
|
292
|
+
_drain_dead_worker(
|
|
293
|
+
future_queue=future_queue,
|
|
294
|
+
alive_workers=alive_workers,
|
|
295
|
+
alive_workers_lock=alive_workers_lock,
|
|
286
296
|
)
|
|
297
|
+
break
|
|
287
298
|
elif not interface.status:
|
|
288
299
|
interface.bootup()
|
|
289
300
|
interface_initialization_exception = _set_init_function(
|
|
@@ -321,6 +332,47 @@ def _execute_multiple_tasks(
|
|
|
321
332
|
task_done(future_queue=future_queue)
|
|
322
333
|
|
|
323
334
|
|
|
335
|
+
def _drain_dead_worker(
|
|
336
|
+
future_queue: queue.Queue,
|
|
337
|
+
alive_workers: Optional[list] = None,
|
|
338
|
+
alive_workers_lock: Optional[Lock] = None,
|
|
339
|
+
) -> None:
|
|
340
|
+
"""Handle a permanently dead worker by recycling or failing its tasks.
|
|
341
|
+
|
|
342
|
+
If healthy workers remain, tasks are recycled back into the shared queue
|
|
343
|
+
so they can be picked up. If all workers are dead, tasks are failed
|
|
344
|
+
immediately with ExecutorlibSocketError. In both cases, the worker's
|
|
345
|
+
shutdown message is consumed to prevent hangs in shutdown().
|
|
346
|
+
"""
|
|
347
|
+
if alive_workers is not None and alive_workers_lock is not None:
|
|
348
|
+
with alive_workers_lock:
|
|
349
|
+
if alive_workers[0] > 0:
|
|
350
|
+
alive_workers[0] -= 1
|
|
351
|
+
while True:
|
|
352
|
+
try:
|
|
353
|
+
task_dict = future_queue.get(timeout=1)
|
|
354
|
+
except queue.Empty:
|
|
355
|
+
continue
|
|
356
|
+
if "shutdown" in task_dict and task_dict["shutdown"]:
|
|
357
|
+
task_done(future_queue=future_queue)
|
|
358
|
+
break
|
|
359
|
+
elif "fn" in task_dict and "future" in task_dict:
|
|
360
|
+
if alive_workers is not None and alive_workers_lock is not None:
|
|
361
|
+
with alive_workers_lock:
|
|
362
|
+
has_healthy_workers = alive_workers[0] > 0
|
|
363
|
+
else:
|
|
364
|
+
has_healthy_workers = False
|
|
365
|
+
if has_healthy_workers:
|
|
366
|
+
future_queue.put(task_dict)
|
|
367
|
+
task_done(future_queue=future_queue)
|
|
368
|
+
else:
|
|
369
|
+
f = task_dict.pop("future")
|
|
370
|
+
f.set_exception(
|
|
371
|
+
ExecutorlibSocketError("SocketInterface crashed during execution.")
|
|
372
|
+
)
|
|
373
|
+
task_done(future_queue=future_queue)
|
|
374
|
+
|
|
375
|
+
|
|
324
376
|
def _set_init_function(
|
|
325
377
|
interface: SocketInterface,
|
|
326
378
|
init_function: Optional[Callable] = None,
|
|
@@ -238,6 +238,8 @@ def create_pysqa_block_allocation_scheduler(
|
|
|
238
238
|
cores_per_worker = executor_kwargs.get("cores", 1)
|
|
239
239
|
if "cwd" in executor_kwargs and executor_kwargs["cwd"] is not None:
|
|
240
240
|
executor_kwargs["cwd"] = os.path.abspath(executor_kwargs["cwd"])
|
|
241
|
+
elif cache_directory is not None:
|
|
242
|
+
executor_kwargs["cwd"] = os.path.abspath(cache_directory)
|
|
241
243
|
if cache_directory is not None:
|
|
242
244
|
executor_kwargs["cache_directory"] = os.path.abspath(cache_directory)
|
|
243
245
|
else:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: executorlib
|
|
3
|
-
Version: 1.9.
|
|
3
|
+
Version: 1.9.2
|
|
4
4
|
Summary: Up-scale python functions for high performance computing (HPC) with executorlib.
|
|
5
5
|
Project-URL: Homepage, https://github.com/pyiron/executorlib
|
|
6
6
|
Project-URL: Documentation, https://executorlib.readthedocs.io
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
executorlib/__init__.py,sha256=IY_DkT706LPIv2_iIe3whrQNGoDzaDFYBvXyUepoZpw,4780
|
|
2
|
-
executorlib/_version.py,sha256=
|
|
2
|
+
executorlib/_version.py,sha256=ZIdFbOeqiC-Wqy70vtAf_MO4asXmiASZByj2W0lijtI,704
|
|
3
3
|
executorlib/api.py,sha256=F6ibDJnVcPGxxPe-UScFJHprWHiVsETGhgAvS1T-9ZI,1365
|
|
4
4
|
executorlib/backend/__init__.py,sha256=2b_iwds4VUrJe92nKtQXkoGxkJiXeEDSlbvCRN_-de8,456
|
|
5
5
|
executorlib/backend/cache_parallel.py,sha256=ldb2iYzrhcXJZ0LcH75FpTLO_6F51mleU9JGAilF00k,2020
|
|
@@ -8,9 +8,9 @@ executorlib/backend/interactive_parallel.py,sha256=HimGnWOdTXInC3o7W4wMUSTTlj6Ms
|
|
|
8
8
|
executorlib/backend/interactive_serial.py,sha256=NxlSX566rQM-pHiy2rQja2rr3lFwdnv0EvIyXk8H7co,2982
|
|
9
9
|
executorlib/executor/__init__.py,sha256=oR2ABLAMYV_TNs1eG-3-MAKHFS7OKB-1KOzCqKNbtWA,310
|
|
10
10
|
executorlib/executor/base.py,sha256=vqNlVCjmQAsFQkSyjZ3gGTyQeN0khu4DkZBactr2Qz0,6559
|
|
11
|
-
executorlib/executor/flux.py,sha256=
|
|
11
|
+
executorlib/executor/flux.py,sha256=1uJGrHK3hswKdySVD2ESqOFjL2Xg1T4Ue_8pLUC2x6E,40797
|
|
12
12
|
executorlib/executor/single.py,sha256=QJMJtitTRU4Mo2TabFYWZCdnqE7iDiVNKhnyU6prMt8,36037
|
|
13
|
-
executorlib/executor/slurm.py,sha256=
|
|
13
|
+
executorlib/executor/slurm.py,sha256=DIBJ1elrQibi-JWg2Cj6HieFgIILBMuSUo-v136LFwU,38353
|
|
14
14
|
executorlib/standalone/__init__.py,sha256=n_Q4NUFu35Fn0qlWIhmoC_FyUkmFGlWn1cNc_7EscF0,290
|
|
15
15
|
executorlib/standalone/batched.py,sha256=Q2GPy4hPD_t5PflqF-m8ADjcHgeb56eJF31-XbsMMwM,990
|
|
16
16
|
executorlib/standalone/command.py,sha256=b4z2ODx0lVKg-SG-EtpnBYWH1lmA9OzyKE4iQUOGDis,6555
|
|
@@ -21,7 +21,7 @@ executorlib/standalone/queue.py,sha256=KFEBFQXGvcaf5qcuCjT5kaZg7ucWOTGOtrD96tIBl
|
|
|
21
21
|
executorlib/standalone/scheduler.py,sha256=LhCuIdaw9BjrP3GerbHUIqwsvxERdtH5JQoeyAqASIU,2325
|
|
22
22
|
executorlib/standalone/select.py,sha256=gn6N0E01qTfGFm8nDNE9bilXXmy4rk1Wb0P7rAk4y54,1770
|
|
23
23
|
executorlib/standalone/serialize.py,sha256=OEXQKYQ3P-pvbLHmOgF86oPgJkzR5vRWmL4gwnJwy94,4292
|
|
24
|
-
executorlib/standalone/validate.py,sha256=
|
|
24
|
+
executorlib/standalone/validate.py,sha256=mjlcLZTTFmbXNMkKGzLT82q1iokg7clWgVRlakA3cOw,1971
|
|
25
25
|
executorlib/standalone/interactive/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
26
26
|
executorlib/standalone/interactive/arguments.py,sha256=058jZ-4GVZo-YC5sYeZBSbIOzekdaK-PSp65WmA85Dg,2944
|
|
27
27
|
executorlib/standalone/interactive/backend.py,sha256=gGgcvER8w75bM_p1uplSsr6yCtBBlOS_6wR1iQNsntc,3006
|
|
@@ -36,15 +36,15 @@ executorlib/task_scheduler/file/spawner_pysqa.py,sha256=N1JIAvNXnmBqltTneyEfiYdR
|
|
|
36
36
|
executorlib/task_scheduler/file/spawner_subprocess.py,sha256=BejOMi5zLkIVUUywv5hl0YdnXkGujGo4nXMpmmuHq2k,3089
|
|
37
37
|
executorlib/task_scheduler/file/task_scheduler.py,sha256=c57K8d3Sfh4p--xvAy5LsCtTq9GOdymaUeN0h4POyS8,6019
|
|
38
38
|
executorlib/task_scheduler/interactive/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
39
|
-
executorlib/task_scheduler/interactive/blockallocation.py,sha256=
|
|
39
|
+
executorlib/task_scheduler/interactive/blockallocation.py,sha256=HcfrYEuopD7wLUoxuoawRRNdaH4dTsPnFTb7luR7G5Y,17738
|
|
40
40
|
executorlib/task_scheduler/interactive/dependency.py,sha256=fh402wEkXMhKxzFzsUGn1qQgNTB_KgPWIzevI89kLLg,13964
|
|
41
41
|
executorlib/task_scheduler/interactive/dependency_plot.py,sha256=iZBZ9UMDeYOMFjD2-kYOxOdKeodj7TuyshI4HbH4XCU,11788
|
|
42
42
|
executorlib/task_scheduler/interactive/onetoone.py,sha256=cTXgTXR9kKzzlx6EfGumMsEm7DUa7BD9JSeBpdPiupI,13312
|
|
43
43
|
executorlib/task_scheduler/interactive/shared.py,sha256=-krntmZFOOE5U0HdFwuU8JZPqZQmPW4-cePDWuvkTgM,6305
|
|
44
44
|
executorlib/task_scheduler/interactive/spawner_flux.py,sha256=WCN0t1VrXWdE5gl1P8cCxgK2NSQPvs-9g5uc-1m8P1E,7087
|
|
45
|
-
executorlib/task_scheduler/interactive/spawner_pysqa.py,sha256=
|
|
45
|
+
executorlib/task_scheduler/interactive/spawner_pysqa.py,sha256=fMATiEpX358z6GAr7JKalgnR8Ox9EUjMA71Uvx6bRis,10403
|
|
46
46
|
executorlib/task_scheduler/interactive/spawner_slurm.py,sha256=90qCLBdAohT3CimAmNC1MXz8cF17kAx4Ci3HDWEtg4k,3725
|
|
47
|
-
executorlib-1.9.
|
|
48
|
-
executorlib-1.9.
|
|
49
|
-
executorlib-1.9.
|
|
50
|
-
executorlib-1.9.
|
|
47
|
+
executorlib-1.9.2.dist-info/METADATA,sha256=8DCjL9RTk6WV7XL7RROijiJ62mn1BYcNYD-b8mcEP6k,15826
|
|
48
|
+
executorlib-1.9.2.dist-info/WHEEL,sha256=QccIxa26bgl1E6uMy58deGWi-0aeIkkangHcxk2kWfw,87
|
|
49
|
+
executorlib-1.9.2.dist-info/licenses/LICENSE,sha256=NkrhccIxPXCbbvp_upyVojt7DNTwZIco3z9wsYpSLqU,1511
|
|
50
|
+
executorlib-1.9.2.dist-info/RECORD,,
|
|
File without changes
|