Skip to content

feat(cli): add delete workflow restarts functionality#759

Open
michaelbuchar wants to merge 1 commit intoreanahub:masterfrom
michaelbuchar:feat/delete-restarted-workflow-removes-original-workflow
Open

feat(cli): add delete workflow restarts functionality#759
michaelbuchar wants to merge 1 commit intoreanahub:masterfrom
michaelbuchar:feat/delete-restarted-workflow-removes-original-workflow

Conversation

@michaelbuchar
Copy link

@michaelbuchar michaelbuchar commented Feb 3, 2026

michaelbuchar pushed a commit to michaelbuchar/reana-client that referenced this pull request Feb 3, 2026
@michaelbuchar michaelbuchar force-pushed the feat/delete-restarted-workflow-removes-original-workflow branch from aeae7b3 to c92a07f Compare February 3, 2026 11:12
michaelbuchar pushed a commit to michaelbuchar/reana-client that referenced this pull request Feb 3, 2026
@michaelbuchar michaelbuchar force-pushed the feat/delete-restarted-workflow-removes-original-workflow branch from c92a07f to b4ccb83 Compare February 3, 2026 13:56
michaelbuchar pushed a commit to michaelbuchar/reana-client that referenced this pull request Feb 3, 2026
@michaelbuchar michaelbuchar force-pushed the feat/delete-restarted-workflow-removes-original-workflow branch from b4ccb83 to d3749d9 Compare February 3, 2026 13:57
michaelbuchar pushed a commit to michaelbuchar/reana-client that referenced this pull request Feb 3, 2026
@michaelbuchar michaelbuchar force-pushed the feat/delete-restarted-workflow-removes-original-workflow branch from d3749d9 to af95380 Compare February 3, 2026 13:59


# Helpers for deleting restarted workflows
def _get_workspace_group(full_name: str) -> str | None:
Copy link
Member

Choose a reason for hiding this comment

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

If we abstract out the helper functions, let's give them meaningful names not starting with an underscore.

Also "workspace group" would be a novel concept. We can stick to names as we have them in reana-db regarding run numbers and run_number_major and run_number_minor?

Copy link
Member

Choose a reason for hiding this comment

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

Also, if we make the helper functions separate, please write unit tests for them.

Copy link
Author

Choose a reason for hiding this comment

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

Done!



# Helpers for deleting restarted workflows
def _get_workspace_group(full_name: str) -> str | None:
Copy link
Member

Choose a reason for hiding this comment

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

AI: str | None union syntax requires Python 3.10+.

This could be troublesome since we promise to support Python 3.8 and 3.9 still in the reana-client code base.

We could use Optional[str] here?

Copy link
Author

Choose a reason for hiding this comment

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

Should be resolved

return f"{base}.{numeric[0]}"


def _split_base_and_numeric(full_name: str):
Copy link
Member

Choose a reason for hiding this comment

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

AI: The function lacks return type hint. Something like Tuple[Optional[str], List[str]]?

Copy link
Author

Choose a reason for hiding this comment

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

Resolved

return f"#{'.'.join(numeric)}" if numeric else str(full_name)


def _format_run_list(labels, max_labels: int) -> str:
Copy link
Member

Choose a reason for hiding this comment

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

AI: Missing type hint on labels parameter. Perhaps List[str]?

Copy link
Author

Choose a reason for hiding this comment

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

Solved

access_token=access_token,
type="batch",
page=1,
size=1000,
Copy link
Member

Choose a reason for hiding this comment

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

Minor: 1000 is hard-coded here. Please extract it into config.py as we are usually doing for other hard-coded constants.

Copy link
Author

Choose a reason for hiding this comment

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

Done


if has_restart_series and include_all_restarts:
# Delete workspace once, mark related runs deleted without deleting workspace again
primary_identifier = wf_id or full_name
Copy link
Member

Choose a reason for hiding this comment

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

Nomenclature: Call the variable primary_id_or_full_name for clarity? Or workflow_id_or_name as we are calling it elsewhere in the code base.

Copy link
Author

Choose a reason for hiding this comment

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

Done


if workflow:
try:

Copy link
Member

Choose a reason for hiding this comment

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

Style: no black after try?

Copy link
Author

Choose a reason for hiding this comment

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

Done

michaelbuchar pushed a commit to michaelbuchar/reana-client that referenced this pull request Feb 5, 2026
@michaelbuchar michaelbuchar force-pushed the feat/delete-restarted-workflow-removes-original-workflow branch from af95380 to 9eea1a7 Compare February 5, 2026 14:31
michaelbuchar pushed a commit to michaelbuchar/reana-client that referenced this pull request Feb 5, 2026
@michaelbuchar michaelbuchar force-pushed the feat/delete-restarted-workflow-removes-original-workflow branch from 9eea1a7 to 4809e1f Compare February 5, 2026 14:35
michaelbuchar pushed a commit to michaelbuchar/reana-client that referenced this pull request Feb 5, 2026
@michaelbuchar michaelbuchar force-pushed the feat/delete-restarted-workflow-removes-original-workflow branch from 4809e1f to ae450f4 Compare February 5, 2026 14:36
michaelbuchar pushed a commit to michaelbuchar/reana-client that referenced this pull request Feb 5, 2026
@michaelbuchar michaelbuchar force-pushed the feat/delete-restarted-workflow-removes-original-workflow branch from ae450f4 to 17f013e Compare February 5, 2026 14:45
michaelbuchar pushed a commit to michaelbuchar/reana-client that referenced this pull request Feb 5, 2026
@michaelbuchar michaelbuchar force-pushed the feat/delete-restarted-workflow-removes-original-workflow branch from 17f013e to a0a4b1e Compare February 5, 2026 15:04
michaelbuchar pushed a commit to michaelbuchar/reana-client that referenced this pull request Feb 5, 2026
@michaelbuchar michaelbuchar force-pushed the feat/delete-restarted-workflow-removes-original-workflow branch from a0a4b1e to 1622f45 Compare February 5, 2026 15:08
@michaelbuchar michaelbuchar force-pushed the feat/delete-restarted-workflow-removes-original-workflow branch from 1622f45 to fa88484 Compare February 5, 2026 15:10
@michaelbuchar michaelbuchar marked this pull request as ready for review February 5, 2026 15:12
@michaelbuchar michaelbuchar self-assigned this Feb 5, 2026
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.

Deleting a restarted workflow run removes the original workflow workspace

2 participants