feat(cli): add delete workflow restarts functionality#759
feat(cli): add delete workflow restarts functionality#759michaelbuchar wants to merge 1 commit intoreanahub:masterfrom
Conversation
aeae7b3 to
c92a07f
Compare
c92a07f to
b4ccb83
Compare
b4ccb83 to
d3749d9
Compare
d3749d9 to
af95380
Compare
reana_client/cli/utils.py
Outdated
|
|
||
|
|
||
| # Helpers for deleting restarted workflows | ||
| def _get_workspace_group(full_name: str) -> str | None: |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Also, if we make the helper functions separate, please write unit tests for them.
reana_client/cli/utils.py
Outdated
|
|
||
|
|
||
| # Helpers for deleting restarted workflows | ||
| def _get_workspace_group(full_name: str) -> str | None: |
There was a problem hiding this comment.
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?
reana_client/cli/utils.py
Outdated
| return f"{base}.{numeric[0]}" | ||
|
|
||
|
|
||
| def _split_base_and_numeric(full_name: str): |
There was a problem hiding this comment.
AI: The function lacks return type hint. Something like Tuple[Optional[str], List[str]]?
reana_client/cli/utils.py
Outdated
| return f"#{'.'.join(numeric)}" if numeric else str(full_name) | ||
|
|
||
|
|
||
| def _format_run_list(labels, max_labels: int) -> str: |
There was a problem hiding this comment.
AI: Missing type hint on labels parameter. Perhaps List[str]?
reana_client/cli/workflow.py
Outdated
| access_token=access_token, | ||
| type="batch", | ||
| page=1, | ||
| size=1000, |
There was a problem hiding this comment.
Minor: 1000 is hard-coded here. Please extract it into config.py as we are usually doing for other hard-coded constants.
reana_client/cli/workflow.py
Outdated
|
|
||
| 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 |
There was a problem hiding this comment.
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.
reana_client/cli/workflow.py
Outdated
|
|
||
| if workflow: | ||
| try: | ||
|
|
af95380 to
9eea1a7
Compare
9eea1a7 to
4809e1f
Compare
4809e1f to
ae450f4
Compare
ae450f4 to
17f013e
Compare
17f013e to
a0a4b1e
Compare
a0a4b1e to
1622f45
Compare
1622f45 to
fa88484
Compare
Closes reanahub/reana-ui#448