Skip to content

Commit

Permalink
Set priority for tower compute environment (#2765)(patch)
Browse files Browse the repository at this point in the history
### Changed
- Set compute environment according the case priority
  • Loading branch information
fevac authored Dec 13, 2023
1 parent f365f1a commit 7676aca
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 11 deletions.
2 changes: 1 addition & 1 deletion cg/cli/workflow/rnafusion/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ def run(
case_id=case_id, params_file=params_file
),
"name": case_id,
"compute_env": compute_env or analysis_api.compute_env,
"compute_env": compute_env or analysis_api.get_compute_env(case_id=case_id),
"revision": revision or analysis_api.revision,
"wait": "SUBMITTED",
"id": nf_tower_id,
Expand Down
2 changes: 1 addition & 1 deletion cg/cli/workflow/taxprofiler/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ def run(
case_id=case_id, params_file=params_file
),
"name": case_id,
"compute_env": compute_env or analysis_api.compute_env,
"compute_env": compute_env or analysis_api.get_compute_env(case_id=case_id),
"revision": revision or analysis_api.revision,
"wait": NfTowerStatus.SUBMITTED,
"id": nf_tower_id,
Expand Down
9 changes: 6 additions & 3 deletions cg/meta/workflow/nf_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
from pathlib import Path
from typing import Any

from cg.store.models import Sample

from cg.constants import Pipeline
from cg.constants.constants import FileExtensions, FileFormat, WorkflowManager
from cg.constants.nextflow import NFX_WORK_DIR
Expand All @@ -17,6 +15,7 @@
from cg.models.cg_config import CGConfig
from cg.models.nf_analysis import FileDeliverable, PipelineDeliverables
from cg.models.rnafusion.rnafusion import CommandArgs
from cg.store.models import Sample
from cg.utils import Process

LOG = logging.getLogger(__name__)
Expand All @@ -38,7 +37,7 @@ def __init__(self, config: CGConfig, pipeline: Pipeline):
self.tower_pipeline: str | None = None
self.account: str | None = None
self.email: str | None = None
self.compute_env: str | None = None
self.compute_env_base: str | None = None
self.revision: str | None = None
self.nextflow_binary_path: str | None = None

Expand Down Expand Up @@ -80,6 +79,10 @@ def get_sample_sheet_path(self, case_id: str) -> Path:
FileExtensions.CSV
)

def get_compute_env(self, case_id: str) -> str:
"""Get the compute environment for the head job based on the case priority."""
return f"{self.compute_env_base}-{self.get_slurm_qos_for_case(case_id=case_id)}"

@staticmethod
def get_nextflow_config_path(nextflow_config: str | None = None) -> Path | None:
"""Path to Nextflow config file."""
Expand Down
2 changes: 1 addition & 1 deletion cg/meta/workflow/rnafusion.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def __init__(
self.tower_pipeline: str = config.rnafusion.tower_pipeline
self.account: str = config.rnafusion.slurm.account
self.email: str = config.rnafusion.slurm.mail_user
self.compute_env: str = config.rnafusion.compute_env
self.compute_env_base: str = config.rnafusion.compute_env
self.revision: str = config.rnafusion.revision
self.nextflow_binary_path: str = config.rnafusion.binary_path

Expand Down
1 change: 1 addition & 0 deletions cg/meta/workflow/taxprofiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ def __init__(
self.account: str = config.taxprofiler.slurm.account
self.email: str = config.taxprofiler.slurm.mail_user
self.nextflow_binary_path: str = config.taxprofiler.binary_path
self.compute_env_base: str = config.taxprofiler.compute_env

def get_sample_sheet_content_per_sample(
self, sample: Sample, instrument_platform: SequencingPlatform.ILLUMINA, fasta: str = ""
Expand Down
11 changes: 6 additions & 5 deletions cg/models/cg_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,15 +179,16 @@ class RnafusionConfig(CommonAppConfig):


class TaxprofilerConfig(CommonAppConfig):
root: str
binary_path: str
conda_binary: str | None = None
conda_env: str
profile: str
compute_env: str
databases: str
hostremoval_reference: str
pipeline_path: str
profile: str
revision: str
conda_binary: str | None = None
hostremoval_reference: str
databases: str
root: str
slurm: SlurmConfig
tower_binary_path: str
tower_pipeline: str
Expand Down

0 comments on commit 7676aca

Please sign in to comment.