Skip to content
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

Fixed jf flow list. #18

Merged
merged 2 commits into from
Aug 22, 2023
Merged
Show file tree
Hide file tree
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
5 changes: 3 additions & 2 deletions src/jobflow_remote/cli/flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
db_ids_opt,
end_date_opt,
flow_ids_opt,
flow_state_opt,
force_opt,
job_ids_opt,
job_state_opt,
Expand Down Expand Up @@ -42,7 +43,7 @@ def flows_list(
job_id: job_ids_opt = None,
db_id: db_ids_opt = None,
flow_id: flow_ids_opt = None,
state: job_state_opt = None,
state: flow_state_opt = None,
start_date: start_date_opt = None,
end_date: end_date_opt = None,
days: days_opt = None,
Expand Down Expand Up @@ -93,7 +94,7 @@ def delete(
job_id: job_ids_opt = None,
db_id: db_ids_opt = None,
flow_id: flow_ids_opt = None,
state: job_state_opt = None,
state: flow_state_opt = None,
start_date: start_date_opt = None,
end_date: end_date_opt = None,
days: days_opt = None,
Expand Down
12 changes: 11 additions & 1 deletion src/jobflow_remote/cli/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

from jobflow_remote.cli.utils import SerializeFileFormat, SortOption
from jobflow_remote.config.base import LogLevel
from jobflow_remote.jobs.state import JobState, RemoteState
from jobflow_remote.jobs.state import FlowState, JobState, RemoteState

job_ids_opt = Annotated[
Optional[List[str]],
Expand Down Expand Up @@ -50,6 +50,16 @@
]


flow_state_opt = Annotated[
Optional[FlowState],
typer.Option(
"--state",
"-s",
help="One of the Flow states",
),
]


remote_state_opt = Annotated[
Optional[RemoteState],
typer.Option(
Expand Down
4 changes: 3 additions & 1 deletion src/jobflow_remote/jobs/jobcontroller.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ def _build_query_wf(
not_in_states = list(Firework.STATE_RANKS.keys())
not_in_states.remove("WAITING")
query["fws.state"] = {"$nin": not_in_states}
if state == FlowState.PAUSED:
elif state == FlowState.PAUSED:
not_in_states = list(Firework.STATE_RANKS.keys())
not_in_states.remove("PAUSED")
query["fws.state"] = {"$nin": not_in_states}
Expand All @@ -162,6 +162,8 @@ def _build_query_wf(
}
},
]
else:
raise RuntimeError("Unknown flow state.")

# at variance with Firework doc, the dates in the Workflow are Date objects
if start_date:
Expand Down
Loading