Skip to content

Filter active processes for the default user when running verdi process repair #6879

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion src/aiida/cmdline/commands/cmd_process.py
Original file line number Diff line number Diff line change
Expand Up @@ -525,7 +525,7 @@ def process_repair(manager, broker, dry_run):
"""
from aiida.engine.processes.control import get_active_processes, get_process_tasks, iterate_process_tasks

active_processes = get_active_processes(project='id')
active_processes = [process.pk for process in get_active_processes() if process.user.is_default]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
active_processes = [process.pk for process in get_active_processes() if process.user.is_default]
active_processes = (process.pk for process in get_active_processes() if process.user.is_default)

the process will be evaluated and the list can be large, use iterator instead.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, haven't had a chance to get back to this. The thing is, somehow in the tests, process is evaluated as an int. Unclear why. Also, maybe best to modify the active process query to optionally filter by the default user, so this list comprehension filtering could be avoided all together. Will think about this later this week.

process_tasks = get_process_tasks(broker)

set_active_processes = set(active_processes)
Expand Down
Loading