Skip to content

Commit f435f5c

Browse files
committed
Align endpoint status choices with workstation session
1 parent 9911e6b commit f435f5c

4 files changed

Lines changed: 13 additions & 13 deletions

File tree

app/grandchallenge/algorithms/migrations/0099_remove_endpoint_endpoint_status_valid_and_more.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Generated by Django 5.2.14 on 2026-05-29 11:04
1+
# Generated by Django 5.2.14 on 2026-05-29 15:23
22

33
from django.conf import settings
44
from django.db import migrations, models
@@ -26,10 +26,10 @@ class Migration(migrations.Migration):
2626
field=models.CharField(
2727
choices=[
2828
("QUEUED", "Queued"),
29-
("STARTING", "Starting"),
29+
("STARTED", "Started"),
3030
("RUNNING", "Running"),
31-
("STOPPED", "Stopped"),
3231
("FAILED", "Failed"),
32+
("STOPPED", "Stopped"),
3333
],
3434
default="QUEUED",
3535
max_length=17,
@@ -41,7 +41,7 @@ class Migration(migrations.Migration):
4141
condition=models.Q(
4242
(
4343
"status__in",
44-
["QUEUED", "STARTING", "RUNNING", "STOPPED", "FAILED"],
44+
["QUEUED", "STARTED", "RUNNING", "FAILED", "STOPPED"],
4545
)
4646
),
4747
name="endpoint_status_valid",

app/grandchallenge/algorithms/models.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1544,16 +1544,16 @@ class Meta:
15441544

15451545
class EndpointStatusChoices(TextChoices):
15461546
QUEUED = "QUEUED", _("Queued")
1547-
STARTING = "STARTING", _("Starting")
1547+
STARTED = "STARTED", _("Started")
15481548
RUNNING = "RUNNING", _("Running")
1549-
STOPPED = "STOPPED", _("Stopped")
15501549
FAILED = "FAILED", _("Failed")
1550+
STOPPED = "STOPPED", _("Stopped")
15511551

15521552
@classmethod
15531553
def get_active_choices(cls):
15541554
return {
15551555
cls.QUEUED,
1556-
cls.STARTING,
1556+
cls.STARTED,
15571557
cls.RUNNING,
15581558
}
15591559

app/grandchallenge/components/tasks.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1682,7 +1682,7 @@ def start_endpoint(*, pk: uuid.UUID, app_label: str, model_name: str):
16821682
)
16831683

16841684
else:
1685-
endpoint.update_status(status=endpoint.StatusChoices.STARTING)
1685+
endpoint.update_status(status=endpoint.StatusChoices.STARTED)
16861686

16871687

16881688
@lambda_task(retry_on=(LockNotAcquiredException,))
@@ -1706,7 +1706,7 @@ def handle_endpoint_status_event(*, event: dict):
17061706
pk=params.pk
17071707
)
17081708

1709-
if endpoint.status != endpoint.StatusChoices.STARTING:
1709+
if endpoint.status != endpoint.StatusChoices.STARTED:
17101710
# Nothing to do
17111711
return
17121712

app/tests/components_tests/test_tasks.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1665,7 +1665,7 @@ def test_stop_expired_endpoints(
16651665
@pytest.mark.django_db
16661666
def test_handle_endpoint_status_in_service_event(settings):
16671667
endpoint = EndpointFactory(
1668-
status=EndpointStatusChoices.STARTING,
1668+
status=EndpointStatusChoices.STARTED,
16691669
)
16701670
event = {
16711671
"EndpointName": f"{settings.COMPONENTS_REGISTRY_PREFIX}-AE-{endpoint.pk}",
@@ -1681,7 +1681,7 @@ def test_handle_endpoint_status_in_service_event(settings):
16811681
@pytest.mark.django_db
16821682
def test_handle_endpoint_status_failed_events(settings, mocker):
16831683
endpoint = EndpointFactory(
1684-
status=EndpointStatusChoices.STARTING,
1684+
status=EndpointStatusChoices.STARTED,
16851685
)
16861686
event = {
16871687
"EndpointName": f"{settings.COMPONENTS_REGISTRY_PREFIX}-AE-{endpoint.pk}",
@@ -1703,7 +1703,7 @@ def test_handle_endpoint_status_failed_events(settings, mocker):
17031703
@pytest.mark.django_db
17041704
def test_handle_endpoint_status_invalid_events(settings, mocker):
17051705
endpoint = EndpointFactory(
1706-
status=EndpointStatusChoices.STARTING,
1706+
status=EndpointStatusChoices.STARTED,
17071707
)
17081708
event = {
17091709
"EndpointName": f"{settings.COMPONENTS_REGISTRY_PREFIX}-AE-{endpoint.pk}",
@@ -1724,7 +1724,7 @@ def test_handle_endpoint_status_invalid_events(settings, mocker):
17241724

17251725
@pytest.mark.parametrize(
17261726
"status",
1727-
set(EndpointStatusChoices).difference([EndpointStatusChoices.STARTING]),
1727+
set(EndpointStatusChoices).difference([EndpointStatusChoices.STARTED]),
17281728
)
17291729
@pytest.mark.django_db
17301730
def test_handle_endpoint_status_wrong_state_ignored(mocker, settings, status):

0 commit comments

Comments
 (0)