|
| 1 | +import logging |
1 | 2 | from dataclasses import field |
2 | 3 | from functools import cached_property |
3 | 4 | from typing import ClassVar, Optional |
4 | 5 |
|
5 | 6 | from pydantic.dataclasses import dataclass |
6 | 7 |
|
7 | | -from orca import logger |
8 | 8 | from orca.errors import ConfigError |
9 | 9 | from orca.services.base.ops import BaseOps |
10 | 10 | from orca.services.nextflowtower.client import NextflowTowerClient |
|
13 | 13 | from orca.services.nextflowtower.models import LaunchInfo, Workflow, WorkflowStatus |
14 | 14 | from orca.services.nextflowtower.utils import increment_suffix |
15 | 15 |
|
| 16 | +logger = logging.getLogger(__name__) |
| 17 | + |
16 | 18 |
|
17 | 19 | @dataclass(kw_only=False) |
18 | 20 | class NextflowTowerOps(BaseOps): |
@@ -133,19 +135,18 @@ def launch_workflow( |
133 | 135 | latest_run = self.get_latest_previous_workflow(launch_info) |
134 | 136 | if latest_run: |
135 | 137 | status = latest_run.status.value |
136 | | - run_repr = f"{latest_run.run_name} ({latest_run.id})" |
| 138 | + run_repr = f"{latest_run.run_name} (id='{latest_run.id}', {status=})" |
137 | 139 | # Return ID for latest run if ongoing, succeeded, or cancelled |
138 | | - skip_statuses = {"SUCCEEDED"} |
139 | 140 | if not latest_run.is_done: # pragma: no cover |
140 | 141 | logger.info(f"Found an ongoing previous run: {run_repr}") |
141 | 142 | return latest_run.id |
142 | | - if latest_run.status in skip_statuses: |
143 | | - logger.info(f"Found a previous ({status}) run: {run_repr}") |
| 143 | + if status in {"SUCCEEDED", "UNKNOWN"}: |
| 144 | + logger.info(f"Found a previous run: {run_repr}") |
144 | 145 | return latest_run.id |
145 | 146 | launch_info.fill_in("resume", True) |
146 | 147 | launch_info.fill_in("session_id", latest_run.session_id) |
147 | 148 | launch_info.run_name = increment_suffix(latest_run.run_name) |
148 | | - logger.info(f"Relaunching from a previous ({status}) run: {run_repr}") |
| 149 | + logger.info(f"Relaunching from a previous run: {run_repr}") |
149 | 150 |
|
150 | 151 | # Get relevant compute environment and its resource tags |
151 | 152 | compute_env_id = self.get_latest_compute_env(compute_env_filter) |
|
0 commit comments