This issue is a result of a Codex global code scan of deepmodeling/fpop at commit b05b337590c31a5237b2dcbd9c0833b841c08cd4.
Relevant code:
|
if not prep_template_config: prep_template_config = {} |
|
if not prep_step_config: prep_step_config = {} |
|
if not run_template_config: run_template_config = {} |
|
if not run_slice_config: run_slice_config = {} |
|
if not run_step_config: run_step_config = {} |
|
if "executor" in prep_step_config.keys(): |
|
prep_executor = init_executor(prep_step_config.pop("executor")) |
|
else: |
|
prep_executor = None |
|
if "executor" in run_step_config.keys(): |
|
run_executor = init_executor(run_step_config.pop("executor")) |
|
else: |
|
def init_executor( |
|
executor_dict, |
|
): |
|
if executor_dict is None or config["mode"] == "debug": |
|
return None |
|
etype = executor_dict.pop("type") |
|
if etype == "dispatcher": |
|
return DispatcherExecutor(**executor_dict) |
Problem:
_prep_run_fp() and init_executor() destructively modify caller-owned configuration dictionaries:
prep_executor = init_executor(prep_step_config.pop("executor"))
run_executor = init_executor(run_step_config.pop("executor"))
etype = executor_dict.pop("type")
After constructing one PrepRunFp, the original prep_step_config / run_step_config no longer contain executor, and the nested executor dict no longer contains type. Reusing the same config object for another workflow can silently drop the dispatcher executor or fail with KeyError.
Minimal reproduction:
run_step_config = {"executor": {"type": "dispatcher", "machine_dict": {...}}}
PrepRunFp(..., run_step_config=run_step_config)
print(run_step_config)
# {'executor'} has been removed from the caller's dict
Expected behavior:
The workflow builder should copy configuration dictionaries before removing internal keys, preserving caller-owned input objects for reuse and inspection.
This issue is a result of a Codex global code scan of
deepmodeling/fpopat commitb05b337590c31a5237b2dcbd9c0833b841c08cd4.Relevant code:
fpop/fpop/preprun_fp.py
Lines 127 to 138 in b05b337
fpop/fpop/utils/step_config.py
Lines 5 to 12 in b05b337
Problem:
_prep_run_fp()andinit_executor()destructively modify caller-owned configuration dictionaries:After constructing one
PrepRunFp, the originalprep_step_config/run_step_configno longer containexecutor, and the nested executor dict no longer containstype. Reusing the same config object for another workflow can silently drop the dispatcher executor or fail withKeyError.Minimal reproduction:
Expected behavior:
The workflow builder should copy configuration dictionaries before removing internal keys, preserving caller-owned input objects for reuse and inspection.