Skip to content

Commit 7676aca

Browse files
authored
Set priority for tower compute environment (#2765)(patch)
### Changed - Set compute environment according the case priority
1 parent f365f1a commit 7676aca

File tree

6 files changed

+16
-11
lines changed

6 files changed

+16
-11
lines changed

cg/cli/workflow/rnafusion/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ def run(
119119
case_id=case_id, params_file=params_file
120120
),
121121
"name": case_id,
122-
"compute_env": compute_env or analysis_api.compute_env,
122+
"compute_env": compute_env or analysis_api.get_compute_env(case_id=case_id),
123123
"revision": revision or analysis_api.revision,
124124
"wait": "SUBMITTED",
125125
"id": nf_tower_id,

cg/cli/workflow/taxprofiler/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ def run(
116116
case_id=case_id, params_file=params_file
117117
),
118118
"name": case_id,
119-
"compute_env": compute_env or analysis_api.compute_env,
119+
"compute_env": compute_env or analysis_api.get_compute_env(case_id=case_id),
120120
"revision": revision or analysis_api.revision,
121121
"wait": NfTowerStatus.SUBMITTED,
122122
"id": nf_tower_id,

cg/meta/workflow/nf_analysis.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
from pathlib import Path
55
from typing import Any
66

7-
from cg.store.models import Sample
8-
97
from cg.constants import Pipeline
108
from cg.constants.constants import FileExtensions, FileFormat, WorkflowManager
119
from cg.constants.nextflow import NFX_WORK_DIR
@@ -17,6 +15,7 @@
1715
from cg.models.cg_config import CGConfig
1816
from cg.models.nf_analysis import FileDeliverable, PipelineDeliverables
1917
from cg.models.rnafusion.rnafusion import CommandArgs
18+
from cg.store.models import Sample
2019
from cg.utils import Process
2120

2221
LOG = logging.getLogger(__name__)
@@ -38,7 +37,7 @@ def __init__(self, config: CGConfig, pipeline: Pipeline):
3837
self.tower_pipeline: str | None = None
3938
self.account: str | None = None
4039
self.email: str | None = None
41-
self.compute_env: str | None = None
40+
self.compute_env_base: str | None = None
4241
self.revision: str | None = None
4342
self.nextflow_binary_path: str | None = None
4443

@@ -80,6 +79,10 @@ def get_sample_sheet_path(self, case_id: str) -> Path:
8079
FileExtensions.CSV
8180
)
8281

82+
def get_compute_env(self, case_id: str) -> str:
83+
"""Get the compute environment for the head job based on the case priority."""
84+
return f"{self.compute_env_base}-{self.get_slurm_qos_for_case(case_id=case_id)}"
85+
8386
@staticmethod
8487
def get_nextflow_config_path(nextflow_config: str | None = None) -> Path | None:
8588
"""Path to Nextflow config file."""

cg/meta/workflow/rnafusion.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ def __init__(
5050
self.tower_pipeline: str = config.rnafusion.tower_pipeline
5151
self.account: str = config.rnafusion.slurm.account
5252
self.email: str = config.rnafusion.slurm.mail_user
53-
self.compute_env: str = config.rnafusion.compute_env
53+
self.compute_env_base: str = config.rnafusion.compute_env
5454
self.revision: str = config.rnafusion.revision
5555
self.nextflow_binary_path: str = config.rnafusion.binary_path
5656

cg/meta/workflow/taxprofiler.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ def __init__(
4040
self.account: str = config.taxprofiler.slurm.account
4141
self.email: str = config.taxprofiler.slurm.mail_user
4242
self.nextflow_binary_path: str = config.taxprofiler.binary_path
43+
self.compute_env_base: str = config.taxprofiler.compute_env
4344

4445
def get_sample_sheet_content_per_sample(
4546
self, sample: Sample, instrument_platform: SequencingPlatform.ILLUMINA, fasta: str = ""

cg/models/cg_config.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -179,15 +179,16 @@ class RnafusionConfig(CommonAppConfig):
179179

180180

181181
class TaxprofilerConfig(CommonAppConfig):
182-
root: str
183182
binary_path: str
183+
conda_binary: str | None = None
184184
conda_env: str
185-
profile: str
185+
compute_env: str
186+
databases: str
187+
hostremoval_reference: str
186188
pipeline_path: str
189+
profile: str
187190
revision: str
188-
conda_binary: str | None = None
189-
hostremoval_reference: str
190-
databases: str
191+
root: str
191192
slurm: SlurmConfig
192193
tower_binary_path: str
193194
tower_pipeline: str

0 commit comments

Comments
 (0)