Skip to content

Commit

Permalink
Add init_walltime input to parallelize WorkChains (#62)
Browse files Browse the repository at this point in the history
The `HpParallelizeQpointsWorkChain` and the  `HpParallelizeAtomsWorkChain` had an hard-coded
walltime for the  `HpBaseWorkChain` used for initialization, set to 3600 seconds. This might cause
some problems on certain HPC partitions (e.g. debug, tests, ...) where the maximum walltime can
lower than 1 hour. To make this more flexible, a new **non-db** input is added to both WorkChains 
with a default of 1 hour.
  • Loading branch information
t-reents authored Apr 11, 2024
1 parent 8aec5dc commit ecc631c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ def define(cls, spec):
spec.expose_inputs(HpBaseWorkChain, exclude=('only_initialization', 'clean_workdir'))
spec.input('parallelize_qpoints', valid_type=orm.Bool, default=lambda: orm.Bool(False))
spec.input('max_concurrent_base_workchains', valid_type=orm.Int, required=False)
spec.input(
'init_walltime', valid_type=int, default=3600, non_db=True,
help='The walltime of the initialization `HpBaseWorkChain` in seconds (default: 3600).'
)
spec.input('clean_workdir', valid_type=orm.Bool, default=lambda: orm.Bool(False),
help='If `True`, work directories of all called calculation will be cleaned at the end of execution.')
spec.outline(
Expand Down Expand Up @@ -56,7 +60,7 @@ def run_init(self):
inputs = AttributeDict(self.exposed_inputs(HpBaseWorkChain))
inputs.only_initialization = orm.Bool(True)
inputs.clean_workdir = self.inputs.clean_workdir
inputs.hp.metadata.options.max_wallclock_seconds = 3600 # 1 hour is more than enough
inputs.hp.metadata.options.max_wallclock_seconds = self.inputs.init_walltime
inputs.metadata.call_link_label = 'initialization'

node = self.submit(HpBaseWorkChain, **inputs)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ def define(cls, spec):
super().define(spec)
spec.expose_inputs(HpBaseWorkChain, exclude=('only_initialization', 'clean_workdir'))
spec.input('max_concurrent_base_workchains', valid_type=orm.Int, required=False)
spec.input(
'init_walltime', valid_type=int, default=3600, non_db=True,
help='The walltime of the initialization `HpBaseWorkChain` in seconds (default: 3600).'
)
spec.input('clean_workdir', valid_type=orm.Bool, default=lambda: orm.Bool(False),
help='If `True`, work directories of all called calculation will be cleaned at the end of execution.')
spec.outline(
Expand Down Expand Up @@ -63,7 +67,7 @@ def run_init(self):
inputs.hp.parameters = orm.Dict(parameters)
inputs.clean_workdir = self.inputs.clean_workdir

inputs.hp.metadata.options.max_wallclock_seconds = 3600 # 1 hour is more than enough
inputs.hp.metadata.options.max_wallclock_seconds = self.inputs.init_walltime
inputs.metadata.call_link_label = 'initialization'

node = self.submit(HpBaseWorkChain, **inputs)
Expand Down

0 comments on commit ecc631c

Please sign in to comment.