Skip to content

Commit

Permalink
Hide development analyses
Browse files Browse the repository at this point in the history
  • Loading branch information
islean committed Sep 2, 2024
1 parent fd2a74f commit b3f801a
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
2 changes: 2 additions & 0 deletions cg/apps/tb/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ def add_pending_analysis(
ticket: str = None,
workflow_manager: str = WorkflowManager.Slurm,
tower_workflow_id: str | None = None,
is_hidden: bool = False,
) -> TrailblazerAnalysis:
request_body = {
"case_id": case_id,
Expand All @@ -132,6 +133,7 @@ def add_pending_analysis(
"ticket": ticket,
"workflow_manager": workflow_manager,
"tower_workflow_id": tower_workflow_id,
"is_hidden": is_hidden,
}
LOG.debug(f"Submitting job to Trailblazer: {request_body}")
if response := self.query_trailblazer(
Expand Down
3 changes: 3 additions & 0 deletions cg/constants/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -306,3 +306,6 @@ class SequencingQCStatus(Enum):
FAILED = auto()
PASSED = auto()
PENDING = auto()


DEVELOPMENT_CUSTOMER_ID = "cust000"
7 changes: 7 additions & 0 deletions cg/meta/workflow/analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
from cg.clients.chanjo2.models import CoverageMetrics
from cg.constants import EXIT_FAIL, EXIT_SUCCESS, Priority, SequencingFileTag, Workflow
from cg.constants.constants import (
DEVELOPMENT_CUSTOMER_ID,
AnalysisType,
CaseActions,
FileFormat,
Expand Down Expand Up @@ -292,6 +293,7 @@ def add_pending_trailblazer_analysis(
ticket: str = self.status_db.get_latest_ticket_from_case(case_id)
workflow: Workflow = self.workflow
workflow_manager: str = self.get_workflow_manager()
is_case_for_development: bool = self._is_case_for_development(case_id)
self.trailblazer_api.add_pending_analysis(
analysis_type=application_type,
case_id=case_id,
Expand All @@ -304,8 +306,13 @@ def add_pending_trailblazer_analysis(
workflow=workflow,
workflow_manager=workflow_manager,
tower_workflow_id=tower_workflow_id,
is_hidden=is_case_for_development,
)

def _is_case_for_development(self, case_id: str) -> bool:
case: Case = self.status_db.get_case_by_internal_id(case_id)
return case.customer.internal_id == DEVELOPMENT_CUSTOMER_ID

def _get_order_id_from_case_id(self, case_id) -> int:
case: Case = self.status_db.get_case_by_internal_id(case_id)
return case.latest_order.id
Expand Down

0 comments on commit b3f801a

Please sign in to comment.