Skip to content
Merged
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
c6c2945
Fix: Implement one _refresh_memory_dict() function
jan-janssen Feb 9, 2026
b0255c1
Add _cancel_processes()
jan-janssen Feb 9, 2026
7910aca
Format black
pyiron-runner Feb 9, 2026
0502bc7
mypy fixes
jan-janssen Feb 9, 2026
866e3f6
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Feb 9, 2026
3f54559
more fixes
jan-janssen Feb 9, 2026
e4910bd
Merge branches 'refresh_memory_dict' and 'refresh_memory_dict' of git…
jan-janssen Feb 9, 2026
96a1599
Feature: Cancel processes of cancelled futures
jan-janssen Feb 9, 2026
cd044a2
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Feb 9, 2026
e4d0240
Merge branch 'main' into refresh_memory_dict
jan-janssen Feb 12, 2026
f4600e3
add more tests
jan-janssen Feb 12, 2026
facb353
fix
jan-janssen Feb 12, 2026
3233271
long running task
jan-janssen Feb 12, 2026
a323735
sleep
jan-janssen Feb 12, 2026
fc92d06
use context
jan-janssen Feb 12, 2026
ca5da07
use long running function
jan-janssen Feb 12, 2026
0c67872
fix file count
jan-janssen Feb 12, 2026
76d2b6b
cancel
jan-janssen Feb 12, 2026
e0c7b21
everything as it should
jan-janssen Feb 12, 2026
c526291
do not cancel
jan-janssen Feb 12, 2026
3d6be51
not cancelled
jan-janssen Feb 12, 2026
024e35a
no wait
jan-janssen Feb 12, 2026
5e1d637
sleep again
jan-janssen Feb 12, 2026
56e9da0
fixes
jan-janssen Feb 12, 2026
343c957
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Feb 12, 2026
44ff716
Merge branch 'main' into refresh_memory_dict
jan-janssen Feb 13, 2026
3fd7936
Merge branch 'refresh_memory_dict' into cancel_completed_processes
jan-janssen Feb 13, 2026
d0b0bf3
Merge branch 'main' into cancel_completed_processes
jan-janssen Feb 13, 2026
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
36 changes: 34 additions & 2 deletions src/executorlib/task_scheduler/file/shared.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,18 +93,26 @@ def execute_tasks_h5(
memory_dict = _refresh_memory_dict(
memory_dict=memory_dict,
cache_dir_dict=cache_dir_dict,
process_dict=process_dict,
terminate_function=terminate_function,
pysqa_config_directory=pysqa_config_directory,
backend=backend,
)
if not task_dict["cancel_futures"] and wait:
_cancel_processes(
terminate_function=terminate_function,
process_dict=process_dict,
terminate_function=terminate_function,
pysqa_config_directory=pysqa_config_directory,
backend=backend,
)
else:
memory_dict = _refresh_memory_dict(
memory_dict=memory_dict,
cache_dir_dict=cache_dir_dict,
process_dict=process_dict,
terminate_function=terminate_function,
pysqa_config_directory=pysqa_config_directory,
backend=backend,
)
for value in memory_dict.values():
if not value.done():
Expand Down Expand Up @@ -179,6 +187,10 @@ def execute_tasks_h5(
memory_dict = _refresh_memory_dict(
memory_dict=memory_dict,
cache_dir_dict=cache_dir_dict,
process_dict=process_dict,
terminate_function=terminate_function,
pysqa_config_directory=pysqa_config_directory,
backend=backend,
)


Expand Down Expand Up @@ -255,17 +267,37 @@ def _convert_args_and_kwargs(
return task_args, task_kwargs, future_wait_key_lst


def _refresh_memory_dict(memory_dict: dict, cache_dir_dict: dict) -> dict:
def _refresh_memory_dict(
memory_dict: dict,
cache_dir_dict: dict,
process_dict: dict,
terminate_function: Optional[Callable] = None,
pysqa_config_directory: Optional[str] = None,
backend: Optional[str] = None,
) -> dict:
"""
Refresh memory dictionary

Args:
memory_dict (dict): dictionary with task keys and future objects
cache_dir_dict (dict): dictionary with task keys and cache directories
process_dict (dict): dictionary with task keys and process reference.
terminate_function (callable): The function to terminate the tasks.
pysqa_config_directory (str): path to the pysqa config directory (only for pysqa based backend).
backend (str): name of the backend used to spawn tasks.

Returns:
dict: Updated memory dictionary
"""
cancelled_lst = [
key for key, value in memory_dict.items() if value.done() and value.cancelled()
]
_cancel_processes(
process_dict={k: v for k, v in process_dict.items() if k in cancelled_lst},
terminate_function=terminate_function,
pysqa_config_directory=pysqa_config_directory,
backend=backend,
)
return {
key: _check_task_output(
task_key=key,
Expand Down