Skip to content

Commit

Permalink
Lighter-weight invocation view for polling from list.
Browse files Browse the repository at this point in the history
  • Loading branch information
jmchilton committed Mar 13, 2024
1 parent 84fc0c6 commit a410c8d
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 5 deletions.
59 changes: 57 additions & 2 deletions client/src/api/schema/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7436,7 +7436,7 @@ export interface components {
* InvocationSerializationView
* @enum {string}
*/
InvocationSerializationView: "element" | "collection";
InvocationSerializationView: "element" | "collection" | "step_states";
/**
* InvocationSortByEnum
* @enum {string}
Expand Down Expand Up @@ -12451,7 +12451,8 @@ export interface components {
WorkflowInvocationResponse:
| components["schemas"]["WorkflowInvocationElementView"]
| components["schemas"]["LegacyWorkflowInvocationElementView"]
| components["schemas"]["WorkflowInvocationCollectionView"];
| components["schemas"]["WorkflowInvocationCollectionView"]
| components["schemas"]["WorkflowInvocationStepStateView"];
/** WorkflowInvocationStateSummary */
WorkflowInvocationStateSummary: {
/**
Expand Down Expand Up @@ -12479,6 +12480,60 @@ export interface components {
[key: string]: number | undefined;
};
};
/** WorkflowInvocationStepStateView */
WorkflowInvocationStepStateView: {
/**
* Create Time
* Format: date-time
* @description The time and date this item was created.
*/
create_time: string;
/**
* History ID
* @description The encoded ID of the history associated with the invocation.
* @example 0123456789ABCDEF
*/
history_id: string;
/**
* ID
* @description The encoded ID of the workflow invocation.
* @example 0123456789ABCDEF
*/
id: string;
/**
* Model class
* @description The name of the database model class.
* @constant
*/
model_class: "WorkflowInvocation";
/**
* Invocation state
* @description State of workflow invocation.
*/
state: components["schemas"]["InvocationState"];
/**
* Steps
* @description Steps of the workflow invocation.
*/
steps: components["schemas"]["InvocationStep"][];
/**
* Update Time
* Format: date-time
* @description The last time and date this item was updated.
*/
update_time: string;
/**
* UUID
* @description Universal unique identifier of the workflow invocation.
*/
uuid?: string | string | null;
/**
* Workflow ID
* @description The encoded Workflow ID associated with the invocation.
* @example 0123456789ABCDEF
*/
workflow_id: string;
};
/**
* WorkflowModuleType
* @description Available types of modules that represent a step in a Workflow.
Expand Down
4 changes: 2 additions & 2 deletions lib/galaxy/model/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8650,7 +8650,7 @@ def to_dict(self, view="collection", value_mapper=None, step_details=False, lega
if rval["state"] is None:
# bugs could result in no state being set
rval["state"] = self.states.FAILED
if view == "element":
if view in ["element", "step_states"]:
steps = []
for step in self.steps:
if step_details:
Expand All @@ -8671,7 +8671,7 @@ def to_dict(self, view="collection", value_mapper=None, step_details=False, lega
else:
steps.append(v)
rval["steps"] = steps

if view == "element":
inputs = {}
for input_item_association in self.input_datasets + self.input_dataset_collections:
if input_item_association.history_content_type == "dataset":
Expand Down
9 changes: 8 additions & 1 deletion lib/galaxy/schema/invocation.py
Original file line number Diff line number Diff line change
Expand Up @@ -566,6 +566,10 @@ class WorkflowInvocationCollectionView(Model, WithModelClass):
model_class: INVOCATION_MODEL_CLASS = ModelClassField(INVOCATION_MODEL_CLASS)


class WorkflowInvocationStepStateView(WorkflowInvocationCollectionView):
steps: List[InvocationStep] = Field(default=..., title="Steps", description="Steps of the workflow invocation.")


class BaseWorkflowInvocationElementView(WorkflowInvocationCollectionView):
inputs: Dict[str, InvocationInput] = Field(
default=..., title="Inputs", description="Input datasets/dataset collections of the workflow invocation."
Expand Down Expand Up @@ -603,7 +607,7 @@ class WorkflowInvocationElementView(BaseWorkflowInvocationElementView):

class WorkflowInvocationResponse(RootModel):
root: Annotated[
Union[WorkflowInvocationElementView, LegacyWorkflowInvocationElementView, WorkflowInvocationCollectionView],
Union[WorkflowInvocationElementView, LegacyWorkflowInvocationElementView, WorkflowInvocationCollectionView, WorkflowInvocationStepStateView],
Field(union_mode="left_to_right"),
]

Expand All @@ -614,6 +618,8 @@ def from_dict(as_dict: Dict[str, Any], view: "InvocationSerializationView", lega
# performant, and will likely yield clearer error messages.
if view == InvocationSerializationView.collection:
root = WorkflowInvocationCollectionView(**as_dict)
elif view == InvocationSerializationView.step_states:
root = WorkflowInvocationStepStateView(**as_dict)
elif legacy_job_state:
root = LegacyWorkflowInvocationElementView(**as_dict)
else:
Expand Down Expand Up @@ -658,6 +664,7 @@ class CreateInvocationFromStore(StoreContentSource):
class InvocationSerializationView(str, Enum):
element = "element"
collection = "collection"
step_states = "step_states" # collection + steps - for monitoring, lighter than element


class InvocationSerializationParams(BaseModel):
Expand Down

0 comments on commit a410c8d

Please sign in to comment.