Skip to content

Commit 24f68c4

Browse files
committed
fix(inactive cohorts): allow inactive from config
1 parent d611adc commit 24f68c4

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

src/cpg_flow/metamist.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -581,11 +581,12 @@ def get_cohort_sgs(cohort_id: str) -> dict:
581581
message = entries['errors'][0]['message']
582582
raise MetamistError(f'Error fetching cohort: {message}')
583583

584-
cohort_status = entries['cohorts'][0]['status']
585-
if cohort_status.lower() != 'active': # support upper and lower formats during migration
586-
raise MetamistError(
587-
f'Cohort {cohort_id} is {cohort_status}. Only active cohorts are allowed. Please check the input cohort list.'
588-
)
584+
# inactive cohorts were already flagged during check_for_inactive_cohorts().
585+
# This check is skipped completely if the configuration options allow for use of inactive cohorts
586+
if not config_retrieve(['workflow', 'permit_inactive_cohorts'], False):
587+
cohort_status = entries['cohorts'][0]['status']
588+
if cohort_status.lower() != 'active':
589+
raise MetamistError(f'Cohort {cohort_id} is {cohort_status}. Only active cohorts are allowed.')
589590

590591
cohort_name = entries['cohorts'][0]['name']
591592
cohort_dataset = entries['cohorts'][0]['project']['dataset']

0 commit comments

Comments
 (0)