|
1 | | -"""Celery task for branch start/stop/pause/resume lifecycle management. |
| 1 | +"""Celery task for branch start/stop lifecycle management. |
2 | 2 |
|
3 | | -For start/resume the task polls the health monitor until the branch is |
4 | | -ACTIVE_HEALTHY, then writes that status and clears itself from the branch. |
5 | | -For stop/pause the task waits for the NeonVM phase to reach stopped/succeeded. |
| 3 | +For start the task polls the health monitor until the branch is ACTIVE_HEALTHY, |
| 4 | +then writes that status and clears itself from the branch. |
| 5 | +For stop the task waits for the NeonVM phase to reach stopped/succeeded. |
6 | 6 | While the task is running any status query returns the in-progress shadow |
7 | | -status (STARTING/RESUMING/STOPPING/PAUSING) instead of the DB value. |
| 7 | +status (STARTING/STOPPING) instead of the DB value. |
8 | 8 | """ |
9 | 9 |
|
10 | 10 | import asyncio |
|
27 | 27 | logger = logging.getLogger(__name__) |
28 | 28 |
|
29 | 29 | _CONTROL_TO_POWER_STATE: dict[str, PowerState] = { |
30 | | - "pause": "Stopped", |
31 | | - "resume": "Running", |
32 | 30 | "start": "Running", |
33 | 31 | "stop": "Stopped", |
34 | 32 | } |
35 | 33 |
|
36 | 34 | _CONTROL_TRANSITION_INITIAL: dict[str, BranchServiceStatus] = { |
37 | | - "pause": BranchServiceStatus.PAUSING, |
38 | | - "resume": BranchServiceStatus.RESUMING, |
39 | 35 | "start": BranchServiceStatus.STARTING, |
40 | 36 | "stop": BranchServiceStatus.STOPPING, |
41 | 37 | } |
42 | 38 |
|
43 | 39 | _CONTROL_TRANSITION_FINAL: dict[str, BranchServiceStatus] = { |
44 | | - "pause": BranchServiceStatus.PAUSED, |
45 | 40 | "stop": BranchServiceStatus.STOPPED, |
46 | 41 | } |
47 | 42 |
|
48 | 43 | _DESIRED_PHASES: dict[str, set[Phase]] = { |
49 | 44 | "stop": {Phase.stopped, Phase.succeeded}, |
50 | | - "pause": {Phase.stopped, Phase.succeeded}, |
51 | 45 | } |
52 | 46 |
|
53 | 47 | _POLL_INTERVAL_SEC = 5 |
@@ -96,7 +90,7 @@ async def _async_perform_control(branch_id: str, action: str) -> dict: |
96 | 90 | try: |
97 | 91 | await set_virtualmachine_power_state(namespace, name, _CONTROL_TO_POWER_STATE[action]) |
98 | 92 |
|
99 | | - if action in ("start", "resume"): |
| 93 | + if action == "start": |
100 | 94 | while True: |
101 | 95 | current = await query_deployment_status(namespace, name) |
102 | 96 | if current == BranchServiceStatus.ACTIVE_HEALTHY: |
|
0 commit comments