Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move FluxExecutor ZMQ into thread and explicitly clean it up #3517

Merged
merged 3 commits into from
Jul 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions parsl/executors/flux/executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,6 @@ def __init__(
raise EnvironmentError("Cannot find Flux installation in PATH")
self.flux_path = os.path.abspath(flux_path)
self._task_id_counter = itertools.count()
self._socket = zmq.Context().socket(zmq.REP)
# Assumes a launch command cannot be None or empty
self.launch_cmd = launch_cmd or self.DEFAULT_LAUNCH_CMD
self._submission_queue: queue.Queue = queue.Queue()
Expand All @@ -213,7 +212,6 @@ def __init__(
args=(
self._submission_queue,
self._stop_event,
self._socket,
self.working_dir,
self.flux_executor_kwargs,
self.provider,
Expand Down Expand Up @@ -306,11 +304,13 @@ def _submit_wrapper(

If an exception is thrown, error out all submitted tasks.
"""
try:
_submit_flux_jobs(submission_queue, stop_event, *args, **kwargs)
except Exception as exc:
_error_out_jobs(submission_queue, stop_event, exc)
raise
with zmq.Context() as ctx:
with ctx.socket(zmq.REP) as socket:
try:
_submit_flux_jobs(submission_queue, stop_event, socket, *args, **kwargs)
except Exception as exc:
_error_out_jobs(submission_queue, stop_event, exc)
raise


def _error_out_jobs(
Expand Down
Loading