Skip to content

Commit

Permalink
feat: replace ComputePlan EMPTY, TODO & WAITINGby CREATED
Browse files Browse the repository at this point in the history
Signed-off-by: Guilhem Barthés <guilhem.barthes@owkin.com>
  • Loading branch information
guilhem-barthes committed Feb 26, 2024
1 parent 0ecfbd6 commit 533b506
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 8 deletions.
6 changes: 3 additions & 3 deletions substra/sdk/backends/local/backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down
4 changes: 1 addition & 3 deletions substra/sdk/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
2 changes: 1 addition & 1 deletion tests/sdk/local/test_debug.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion tests/sdk/test_wait.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)
Expand Down

0 comments on commit 533b506

Please sign in to comment.