Skip to content

Commit

Permalink
replace dra with default_runtime_attributes to make it clearer
Browse files Browse the repository at this point in the history
  • Loading branch information
leepc12 committed Oct 25, 2021
1 parent 8eb80a4 commit a1a05a6
Showing 1 changed file with 25 additions and 19 deletions.
44 changes: 25 additions & 19 deletions caper/caper_workflow_opts.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,34 +93,36 @@ def __init__(
This will be appended to "bsub" command line.
"""
self._template = {CaperWorkflowOpts.DEFAULT_RUNTIME_ATTRIBUTES: dict()}
dra = self._template[CaperWorkflowOpts.DEFAULT_RUNTIME_ATTRIBUTES]
default_runtime_attributes = self._template[
CaperWorkflowOpts.DEFAULT_RUNTIME_ATTRIBUTES
]

if gcp_zones and not use_google_cloud_life_sciences:
dra['zones'] = ' '.join(gcp_zones)
default_runtime_attributes['zones'] = ' '.join(gcp_zones)

if slurm_partition:
dra['slurm_partition'] = slurm_partition
default_runtime_attributes['slurm_partition'] = slurm_partition
if slurm_account:
dra['slurm_account'] = slurm_account
default_runtime_attributes['slurm_account'] = slurm_account
if slurm_extra_param:
dra['slurm_extra_param'] = slurm_extra_param
default_runtime_attributes['slurm_extra_param'] = slurm_extra_param

if sge_pe:
dra['sge_pe'] = sge_pe
default_runtime_attributes['sge_pe'] = sge_pe
if sge_queue:
dra['sge_queue'] = sge_queue
default_runtime_attributes['sge_queue'] = sge_queue
if sge_extra_param:
dra['sge_extra_param'] = sge_extra_param
default_runtime_attributes['sge_extra_param'] = sge_extra_param

if pbs_queue:
dra['pbs_queue'] = pbs_queue
default_runtime_attributes['pbs_queue'] = pbs_queue
if pbs_extra_param:
dra['pbs_extra_param'] = pbs_extra_param
default_runtime_attributes['pbs_extra_param'] = pbs_extra_param

if lsf_queue:
dra['lsf_queue'] = lsf_queue
default_runtime_attributes['lsf_queue'] = lsf_queue
if lsf_extra_param:
dra['lsf_extra_param'] = lsf_extra_param
default_runtime_attributes['lsf_extra_param'] = lsf_extra_param

def create_file(
self,
Expand Down Expand Up @@ -187,7 +189,9 @@ def create_file(
raise ValueError('Cannot use both Singularity and Docker.')

template = copy.deepcopy(self._template)
dra = template[CaperWorkflowOpts.DEFAULT_RUNTIME_ATTRIBUTES]
default_runtime_attributes = template[
CaperWorkflowOpts.DEFAULT_RUNTIME_ATTRIBUTES
]

if backend:
template['backend'] = backend
Expand All @@ -212,7 +216,7 @@ def create_file(
environment = None

if environment:
dra['environment'] = environment
default_runtime_attributes['environment'] = environment

if docker == '' or backend in (BACKEND_GCP, BACKEND_AWS) and not docker:
# if used as a flag or cloud backend is chosen
Expand All @@ -230,7 +234,7 @@ def create_file(
)

if docker:
dra['docker'] = docker
default_runtime_attributes['docker'] = docker

if singularity == '':
# if used as a flag
Expand All @@ -254,9 +258,11 @@ def create_file(
)

if singularity:
dra['singularity'] = singularity
default_runtime_attributes['singularity'] = singularity
if inputs:
dra['singularity_bindpath'] = find_bindpath(inputs)
default_runtime_attributes['singularity_bindpath'] = find_bindpath(
inputs
)

if conda == '':
# if used as a flag
Expand All @@ -279,10 +285,10 @@ def create_file(
)

if conda:
dra['conda'] = conda
default_runtime_attributes['conda'] = conda

if max_retries is not None:
dra['maxRetries'] = max_retries
default_runtime_attributes['maxRetries'] = max_retries
# Cromwell's bug in memory-retry feature.
# Disabled until it's fixed on Cromwell's side.
# if memory_retry_multiplier is not None:
Expand Down

0 comments on commit a1a05a6

Please sign in to comment.