Skip to content

Commit ce97e8b

Browse files
committed
attempt at fixing weird atexit bug
1 parent 6c0a996 commit ce97e8b

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

psiflow/__init__.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,16 @@
1-
import parsl
1+
# def wait():
2+
# print('asdlfkjaslkdf')
3+
# import time
4+
# time.sleep(3)
5+
# #import parsl
6+
# #parsl.wait_for_current_tasks()
7+
#
8+
# import atexit
9+
# atexit.register(wait)
210

311
from .execution import ExecutionContextLoader, load_from_yaml # noqa: F401
412

513
load = ExecutionContextLoader.load
614
parse_config = ExecutionContextLoader.parse_config
715
context = ExecutionContextLoader.context
8-
wait = parsl.wait_for_current_tasks
16+
wait = ExecutionContextLoader.wait

psiflow/execution.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
from __future__ import annotations # necessary for type-guarding class methods
22

3-
import atexit
43
import copy
54
import logging
65
import math
@@ -447,7 +446,6 @@ def load(
447446
)
448447
path_context = path / "context_dir"
449448
cls._context = ExecutionContext(config, definitions, path_context)
450-
atexit.register(parsl.wait_for_current_tasks)
451449
return cls._context
452450

453451
@classmethod
@@ -456,6 +454,10 @@ def context(cls):
456454
raise RuntimeError("No ExecutionContext is currently loaded")
457455
return cls._context
458456

457+
@classmethod
458+
def wait(cls):
459+
parsl.wait_for_current_tasks()
460+
459461

460462
def load_from_yaml(path: Union[str, Path]) -> ExecutionContext:
461463
assert ExecutionContextLoader._context is None # no previously loaded context

0 commit comments

Comments
 (0)