Skip to content

Commit

Permalink
feat!: update task status
Browse files Browse the repository at this point in the history
Signed-off-by: SdgJlbl <sarah.diot-girard@owkin.com>
  • Loading branch information
SdgJlbl committed Feb 14, 2024
1 parent d16042f commit 64d40e3
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed

- BREAKING: Renamed `function` field of the Function pydantic model to `archive`([#393](https://github.com/Substra/substra/pull/393))
- BREAKING: Renamed ComputeTask status ([#397](https://github.com/Substra/substra/pull/397))

### Added

Expand Down
5 changes: 3 additions & 2 deletions substra/sdk/backends/local/backend.py
Original file line number Diff line number Diff line change
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.todo_count += 1
compute_plan.status = models.Status.waiting
compute_plan.status = models.ComputePlanStatus.waiting

elif not spec.compute_plan_key and (spec.rank == 0 or spec.rank is None):
# Create a compute plan
Expand Down Expand Up @@ -426,7 +426,8 @@ def _add_task(self, key, spec, spec_options=None):
inputs=_schemas_list_to_models_list(spec.inputs, models.InputRef),
outputs=_output_from_spec(spec.outputs),
tag=spec.tag or "",
status=models.Status.waiting,
# TODO: the waiting status should be more granular now
status=models.Status.waiting_for_builder_slot,
metadata=spec.metadata if spec.metadata else dict(),
)

Expand Down
6 changes: 4 additions & 2 deletions substra/sdk/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,13 @@ class Status(str, enum.Enum):
"""Status of the task"""

unknown = "STATUS_UNKNOWN"
building = "STATUS_BUILDING"
doing = "STATUS_DOING"
done = "STATUS_DONE"
failed = "STATUS_FAILED"
todo = "STATUS_TODO"
waiting = "STATUS_WAITING"
waiting_for_executor_slot = "STATUS_WAITING_FOR_EXECUTOR_SLOT"
waiting_for_parent_tasks = "STATUS_WAITING_FOR_PARENT_TASKS"
waiting_for_builder_slot = "STATUS_WAITING_FOR_BUILDER_SLOT"
canceled = "STATUS_CANCELED"


Expand Down
4 changes: 3 additions & 1 deletion tests/sdk/test_wait.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,9 @@ def test_wait_task_failed(client, mocker):
@pytest.mark.parametrize(
("asset_dict", "function_name", "status"),
[
(datastore.TRAINTASK, "wait_task", Status.todo),
(datastore.TRAINTASK, "wait_task", Status.waiting_for_parent_tasks),
(datastore.TRAINTASK, "wait_task", Status.waiting_for_builder_slot),
(datastore.TRAINTASK, "wait_task", Status.waiting_for_executor_slot),
(datastore.COMPUTE_PLAN, "wait_compute_plan", ComputePlanStatus.todo),
],
ids=_param_name_maker,
Expand Down

0 comments on commit 64d40e3

Please sign in to comment.