[Code scan] Avoid mutating caller step and executor configuration dictionaries
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 78/100
Research direction
Start with _prep_run_fp() in fpop/preprun_fp.py and init_executor() in fpop/utils/step_config.py, then run the minimal reproduction from the issue. Verify that the original prep and run configuration dictionaries retain their executor and type entries after constructing PrepRunFp and can be reused without losing the dispatcher executor.
Written by the indexing model from the issue text.
Description
This issue is a result of a Codex global code scan of deepmodeling/fpop at commit b05b337590c31a5237b2dcbd9c0833b841c08cd4.
Relevant code:
https://github.com/deepmodeling/fpop/blob/b05b337590c31a5237b2dcbd9c0833b841c08cd4/fpop/preprun_fp.py#L127-L138
https://github.com/deepmodeling/fpop/blob/b05b337590c31a5237b2dcbd9c0833b841c08cd4/fpop/utils/step_config.py#L5-L12
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.
- Dominant language
- Python
- Stars
- 3
- Forks
- 13
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from deepmodeling/fpop
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
deepmodeling/fpop#35 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
deepmodeling/fpop#32 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
deepmodeling/fpop#31 ·
-
bug
Difficulty 3/5 1-2 days Newbie friendliness 78/100
deepmodeling/fpop#36 ·
-
bug
Difficulty 3/5 1-2 days Newbie friendliness 72/100
deepmodeling/fpop#33 ·
All issues in deepmodeling/fpop
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100