Skip to content

Commit

Permalink
Merge pull request #18 from Matgenix/flow_info
Browse files Browse the repository at this point in the history
Fixed jf flow list.
  • Loading branch information
gpetretto authored Aug 22, 2023
2 parents a606cc6 + fe03b05 commit ff4b2ed
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 4 deletions.
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_indexes_opt = Annotated[
Optional[List[str]],
Expand Down Expand Up @@ -63,6 +63,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 @@ -147,7 +147,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 @@ -170,6 +170,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

0 comments on commit ff4b2ed

Please sign in to comment.