From b19ebc21b32699fb69de8757ce5825b032e5f294 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guilhem=20Barth=C3=A9s?= Date: Mon, 19 Feb 2024 12:30:11 +0100 Subject: [PATCH] feat: replace ComputePlan `EMPTY`, `TODO` & `WAITING`by `CREATED` MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Guilhem Barthés --- substra/sdk/backends/local/backend.py | 6 +++--- substra/sdk/models.py | 4 +--- tests/sdk/local/test_debug.py | 2 +- tests/sdk/test_wait.py | 2 +- 4 files changed, 6 insertions(+), 8 deletions(-) diff --git a/substra/sdk/backends/local/backend.py b/substra/sdk/backends/local/backend.py index 7c29261f..c52d64ec 100644 --- a/substra/sdk/backends/local/backend.py +++ b/substra/sdk/backends/local/backend.py @@ -213,7 +213,7 @@ def __add_compute_plan( key=key, creation_date=self.__now(), start_date=self.__now(), - status=models.ComputePlanStatus.waiting, + status=models.ComputePlanStatus.created, tag="", name=key, task_count=task_count, @@ -244,7 +244,7 @@ def __create_compute_plan_from_task(self, spec, in_tasks): # Add to the compute plan compute_plan.task_count += 1 compute_plan.waiting_executor_slot_count += 1 - compute_plan.status = models.ComputePlanStatus.waiting + compute_plan.status = models.ComputePlanStatus.created elif not spec.compute_plan_key and (spec.rank == 0 or spec.rank is None): # Create a compute plan @@ -388,7 +388,7 @@ def _add_compute_plan(self, spec: schemas.ComputePlanSpec, spec_options: dict = start_date=self.__now(), tag=spec.tag or "", name=spec.name, - status=models.ComputePlanStatus.empty, + status=models.ComputePlanStatus.created, metadata=spec.metadata or dict(), task_count=0, waiting_builder_slot_count=0, diff --git a/substra/sdk/models.py b/substra/sdk/models.py index 25fd4eff..40f84ab5 100644 --- a/substra/sdk/models.py +++ b/substra/sdk/models.py @@ -51,10 +51,8 @@ class ComputePlanStatus(str, enum.Enum): doing = "PLAN_STATUS_DOING" done = "PLAN_STATUS_DONE" failed = "PLAN_STATUS_FAILED" - todo = "PLAN_STATUS_TODO" - waiting = "PLAN_STATUS_WAITING" + created = "PLAN_STATUS_CREATED" canceled = "PLAN_STATUS_CANCELED" - empty = "PLAN_STATUS_EMPTY" class FunctionStatus(str, enum.Enum): diff --git a/tests/sdk/local/test_debug.py b/tests/sdk/local/test_debug.py index b28235e5..58d26dbc 100644 --- a/tests/sdk/local/test_debug.py +++ b/tests/sdk/local/test_debug.py @@ -82,7 +82,7 @@ def test_compute_plan_add_update_tasks(self, asset_factory, clients): ) ) - assert compute_plan.status == models.ComputePlanStatus.empty + assert compute_plan.status == models.ComputePlanStatus.created dataset_query = asset_factory.create_dataset() dataset_key = client.add_dataset(dataset_query) diff --git a/tests/sdk/test_wait.py b/tests/sdk/test_wait.py index 9e7204b7..2182593f 100644 --- a/tests/sdk/test_wait.py +++ b/tests/sdk/test_wait.py @@ -61,7 +61,7 @@ def test_wait_task_failed(client, mocker): (datastore.TRAINTASK, "wait_task", ComputeTaskStatus.waiting_for_parent_tasks), (datastore.TRAINTASK, "wait_task", ComputeTaskStatus.waiting_for_builder_slot), (datastore.TRAINTASK, "wait_task", ComputeTaskStatus.waiting_for_executor_slot), - (datastore.COMPUTE_PLAN, "wait_compute_plan", ComputePlanStatus.todo), + (datastore.COMPUTE_PLAN, "wait_compute_plan", ComputePlanStatus.created), ], ids=_param_name_maker, )