Skip to content

feat(cli): add -w/--workchains option to verdi calcjob cleanworkdir - #7673

Open
guhou-hvi wants to merge 1 commit into
aiidateam:mainfrom
guhou-hvi:fix/cleanworkdir-workchain
Open

guhou-hvi wants to merge 1 commit into
aiidateam:mainfrom
guhou-hvi:fix/cleanworkdir-workchain

Conversation

@guhou-hvi

Copy link
Copy Markdown

Adds a -w/--workchains option to verdi calcjob cleanworkdir so that the remote work directories of every CalcJobNode in a workchain's called_descendants subtree can be cleaned in one command, without having to enumerate the individual calcjob PKs.

Example

verdi calcjob cleanworkdir -w <WORKCHAIN_PK>
verdi calcjob cleanworkdir -w <WORKCHAIN_PK> -w <OTHER_UUID> -f

Behaviour

  • Each value is parsed by ProcessParamType (accepts PK or UUID) and restricted to WorkChainNode subclasses.
  • The option is multiple=True; results from every workchain are unioned with any explicit calcjob arguments.
  • If a workchain list is provided but yields no CalcJobNode descendants, the command aborts with an explicit message rather than falling through to the unfiltered query (which would otherwise match every calcjob in the profile).

Addresses #4693.

Allow cleaning the remote work directories of all calcjobs that are descendants
of specified workchains via a new `-w/--workchains` option. Each workchain is
identified by its PK or UUID and its full `called_descendants` subtree is
traversed; only `CalcJobNode` instances are selected. The option can be given
multiple times.

The selection is unioned with any explicit calcjob arguments. If a workchain
list is provided but resolves to no calcjob descendants, the command aborts
with a clear message rather than falling through to the unfiltered query.

Addresses aiidateam#4693.
@coderabbitai

coderabbitai Bot commented Sep 19, 2026

Copy link
Copy Markdown

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository: aiidateam/aiida-core/.coderabbit.yaml

Review profile: QUIET

Plan: Advanced

Run ID: c359a8f4-0eb7-4a85-9cc6-2d56188764b1

📥 Commits

Reviewing files that changed from the base of the PR and between a1e01a8 and 176a00e.

📒 Files selected for processing (2)
  • src/aiida/cmdline/commands/cmd_calcjob.py
  • tests/cmdline/commands/test_calcjob.py

Included review availability: Your plan provides up to 4 included reviews per hour; 3 remain after this review.


📝 Walkthrough

Walkthrough

The calcjob cleanworkdir command now accepts multiple workchains by PK or UUID. It cleans remote directories for their CalcJob descendants, rejects workchains without descendants, and avoids unfiltered queries when no selection exists.

Changes

Workchain cleanup

Layer / File(s) Summary
Workchain selection contract
src/aiida/cmdline/commands/cmd_calcjob.py
Adds the -w/--workchains option and accepts workchains as an alternative filter.
Descendant selection and validation
src/aiida/cmdline/commands/cmd_calcjob.py, tests/cmdline/commands/test_calcjob.py
Collects descendant CalcJobNode PKs, rejects workchains without CalcJob descendants, passes None for an empty selection, and tests related and unrelated CalcJobs.

Priority: ⬇️ Low

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  participant CLI
  participant WorkChain
  participant CalcJobRemotePaths
  CLI->>WorkChain: resolve selected workchains
  WorkChain-->>CLI: return CalcJob descendant PKs
  CLI->>CalcJobRemotePaths: request remote paths for selected PKs
Loading

Suggested reviewers: agoscinski

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 75.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 2 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely identifies the new -w/--workchains option for verdi calcjob cleanworkdir, which is the main change.
Description check ✅ Passed The description accurately explains the new option, accepted identifiers, descendant selection, combined filters, error behavior, and usage examples.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
  • Fix all pre-merge checks with AI

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant