-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
271 additions
and
124 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,5 +14,5 @@ executor. | |
|
||
plugins | ||
recipes | ||
repository | ||
jobs | ||
repository |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
from .job import Job, JobArguments | ||
from .status import JobStatus | ||
from .job import Job, JobArguments, JobStatus | ||
from .run import RunStatus, StepStatus |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
"""Queenbee Results | ||
The results are a combination of step inputs and outputs for a list of | ||
runs. | ||
""" | ||
|
||
from typing import List, Dict, Union | ||
from ..io.inputs.step import StepStringInput, StepInputs | ||
from ..io.outputs.step import StepOutputs | ||
from .run import RunStatus | ||
|
||
class Results(List[Union[StepInputs, StepOutputs]]): | ||
|
||
@classmethod | ||
def from_runs(cls, runs: List[RunStatus]) -> 'Results': | ||
res = [] | ||
|
||
for run in runs: | ||
row = [ | ||
StepStringInput( | ||
name='job-id', | ||
description='The ID of the job that generated this run', | ||
value=run.job_id, | ||
), | ||
StepStringInput( | ||
name='run-id', | ||
description='The ID of the run this result row should be associated with', | ||
value=run.id, | ||
), | ||
StepStringInput( | ||
name='run-status', | ||
description='The stauts of the run this result row should be associated with', | ||
value=run.status, | ||
), | ||
] | ||
|
||
row.extend(run.inputs) | ||
row.extend(run.outputs) | ||
|
||
res.append(row) | ||
|
||
return res |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,121 @@ | ||
"""Queenbee run class. | ||
A Run contains the status of an individual recipe being executed | ||
""" | ||
from enum import Enum | ||
from datetime import datetime | ||
from pydantic import Field, constr | ||
from typing import List, Dict, Union | ||
|
||
from ..base.basemodel import BaseModel | ||
from ..io.common import IOBase | ||
from ..io.inputs.step import StepStringInput, StepInputs | ||
from ..io.outputs.step import StepOutputs | ||
from .status import BaseStatus | ||
|
||
|
||
class StatusType(str, Enum): | ||
"""Type enum for status type.""" | ||
Function = 'Function' | ||
|
||
DAG = 'DAG' | ||
|
||
Loop = 'Loop' | ||
|
||
Unknown = 'Unknown' | ||
|
||
|
||
class StepStatus(BaseStatus): | ||
"""The Status of a Job Step""" | ||
type: constr(regex='^StepStatus$') = 'StepStatus' | ||
|
||
id: str = Field( | ||
..., | ||
description='The step unique ID' | ||
) | ||
|
||
name: str = Field( | ||
..., | ||
description='A human readable name for the step. Usually defined by the ' | ||
'DAG task name but can be extended if the step is part of a loop for example. ' | ||
'This name is unique within the boundary of the DAG/Job that generated it.' | ||
) | ||
|
||
status_type: StatusType = Field( | ||
..., | ||
description='The type of step this status is for. Can be "Function", "DAG" or ' | ||
'"Loop"' | ||
) | ||
|
||
template_ref: str = Field( | ||
..., | ||
description='The name of the template that spawned this step' | ||
) | ||
|
||
command: str = Field( | ||
None, | ||
description='The command used to run this step. Only applies to Function steps.' | ||
) | ||
|
||
inputs: List[StepInputs] = Field( | ||
..., | ||
description='The inputs used by this step.' | ||
) | ||
|
||
outputs: List[StepOutputs] = Field( | ||
..., | ||
description='The outputs produced by this step.' | ||
) | ||
|
||
boundary_id: str = Field( | ||
None, | ||
description='This indicates the step ID of the associated template root \ | ||
step in which this step belongs to. A DAG step will have the id of the \ | ||
parent DAG for example.' | ||
) | ||
|
||
children_ids: List[str] = Field( | ||
..., | ||
description='A list of child step IDs' | ||
) | ||
|
||
outbound_steps: List[str] = Field( | ||
..., | ||
description='A list of the last step to ran in the context of this ' | ||
'step. In the case of a DAG or a job this will be the last step that has ' | ||
'been executed. It will remain empty for functions.' | ||
) | ||
|
||
|
||
class RunStatus(BaseStatus): | ||
"""Job Status.""" | ||
api_version: constr(regex='^v1beta1$') = Field('v1beta1', readOnly=True) | ||
|
||
type: constr(regex='^RunStatus$') = 'RunStatus' | ||
|
||
id: str = Field( | ||
..., | ||
description='The ID of the individual run.' | ||
) | ||
|
||
job_id: str = Field( | ||
..., | ||
description='The ID of the job that generated this run' | ||
) | ||
|
||
entrypoint: str = Field( | ||
None, | ||
description='The ID of the first step in the run.' | ||
) | ||
|
||
steps: Dict[str, StepStatus] = {} | ||
|
||
inputs: List[StepInputs] = Field( | ||
..., | ||
description='The inputs used for this run.' | ||
) | ||
|
||
outputs: List[StepOutputs] = Field( | ||
..., | ||
description='The outputs produced by this run.' | ||
) |
Oops, something went wrong.