diff --git a/flame_hub/_core_client.py b/flame_hub/_core_client.py index b9c8f33..cbd5447 100644 --- a/flame_hub/_core_client.py +++ b/flame_hub/_core_client.py @@ -26,7 +26,6 @@ from flame_hub._auth_flows import PasswordAuth, RobotAuth from flame_hub._storage_client import BucketFile - RegistryCommand = t.Literal["setup", "cleanup"] @@ -215,7 +214,8 @@ class Log(BaseModel): labels: dict[str, str | None] -ProcessStatus = t.Literal["starting", "started", "stopping", "stopped", "finished", "failed"] +AnalysisBuildStatus = t.Literal["starting", "started", "stopping", "stopped", "finished", "failed"] +AnalysisRunStatus = t.Literal["starting", "started", "running", "stopping", "stopped", "finished", "failed"] class CreateAnalysis(BaseModel): @@ -240,10 +240,8 @@ class Analysis(CreateAnalysis): configuration_node_aggregator_valid: bool configuration_node_default_valid: bool configuration_nodes_valid: bool - build_status: ProcessStatus | None - execution_status: ProcessStatus | None - distribution_status: ProcessStatus | None - execution_progress: int | None + build_status: AnalysisBuildStatus | None + run_status: AnalysisRunStatus | None created_at: datetime updated_at: datetime registry: t.Annotated[Registry | None, IsIncludable] = None @@ -290,8 +288,7 @@ class CreateAnalysisNode(BaseModel): class AnalysisNode(CreateAnalysisNode): id: uuid.UUID approval_status: AnalysisNodeApprovalStatus | None - execution_status: ProcessStatus | None - execution_progress: int | None + run_status: AnalysisNodeRunStatus | None comment: str | None artifact_tag: str | None artifact_digest: str | None @@ -306,8 +303,7 @@ class AnalysisNode(CreateAnalysisNode): class UpdateAnalysisNode(BaseModel): comment: str | None | UNSET_T = UNSET approval_status: AnalysisNodeApprovalStatus | None | UNSET_T = UNSET - execution_status: ProcessStatus | None | UNSET_T = UNSET - execution_progress: int | None | UNSET_T = UNSET + run_status: AnalysisNodeRunStatus | None | UNSET_T = UNSET class CreateAnalysisNodeLog(BaseModel): @@ -624,16 +620,14 @@ def update_analysis_node( analysis_node_id: AnalysisNode | uuid.UUID | str, comment: str | None | UNSET_T = UNSET, approval_status: AnalysisNodeApprovalStatus | None | UNSET_T = UNSET, - execution_status: ProcessStatus | None | UNSET_T = UNSET, - execution_progress: int | None | UNSET_T = UNSET, + run_status: AnalysisNodeRunStatus | None | UNSET_T = UNSET, ) -> AnalysisNode: return self._update_resource( AnalysisNode, UpdateAnalysisNode( comment=comment, approval_status=approval_status, - execution_status=execution_status, - execution_progress=execution_progress, + run_status=run_status, ), "analysis-nodes", analysis_node_id, diff --git a/flame_hub/types.py b/flame_hub/types.py index 3ca1b66..752ea4c 100644 --- a/flame_hub/types.py +++ b/flame_hub/types.py @@ -12,7 +12,8 @@ "RegistryProjectType", "MasterImageCommandArgument", "ProjectNodeApprovalStatus", - "ProcessStatus", + "AnalysisRunStatus", + "AnalysisBuildStatus", "AnalysisCommand", "AnalysisNodeApprovalStatus", "AnalysisNodeRunStatus", @@ -43,7 +44,8 @@ RegistryProjectType, MasterImageCommandArgument, ProjectNodeApprovalStatus, - ProcessStatus, + AnalysisRunStatus, + AnalysisBuildStatus, AnalysisCommand, AnalysisNodeApprovalStatus, AnalysisNodeRunStatus, diff --git a/tests/helpers.py b/tests/helpers.py index 5583f97..35971a0 100644 --- a/tests/helpers.py +++ b/tests/helpers.py @@ -31,12 +31,5 @@ def next_random_string(charset=string.ascii_letters, length: int = 20): return "".join([random.choice(charset) for _ in range(length)]) -def next_random_number(lower=0, upper=1, is_int=False): - if is_int: - return random.randint(lower, upper) - else: - return random.uniform(lower, upper) - - def next_uuid(): return str(uuid.uuid4()) diff --git a/tests/test_core.py b/tests/test_core.py index a65df66..975255d 100644 --- a/tests/test_core.py +++ b/tests/test_core.py @@ -18,7 +18,7 @@ AnalysisBucket, AnalysisBucketFile, ) -from tests.helpers import next_random_string, next_uuid, assert_eventually, next_random_number +from tests.helpers import next_random_string, next_uuid, assert_eventually pytestmark = pytest.mark.integration @@ -451,16 +451,13 @@ def _check_checking_event_in_logs(): def test_update_analysis_node(core_client, analysis_node): - progress = next_random_number(upper=100, is_int=True) new_analysis_node = core_client.update_analysis_node( analysis_node.id, - execution_status="starting", - execution_progress=progress, + run_status="starting", ) assert analysis_node != new_analysis_node - assert new_analysis_node.execution_status == "starting" - assert new_analysis_node.execution_progress == progress + assert new_analysis_node.run_status == "starting" def test_get_analysis_nodes(core_client, analysis_node, analysis_node_includables):