Skip to content

Commit

Permalink
Merge pull request #144 from rolfverberg/main
Browse files Browse the repository at this point in the history
add: allow sub pipeline selection in the pipeline config
  • Loading branch information
rolfverberg authored Oct 11, 2024
2 parents bd6dae8 + 77abbed commit a013457
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions CHAP/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,9 @@ def parser():
"""
pparser = argparse.ArgumentParser(prog='PROG')
pparser.add_argument(
'config', action='store', default='',
help='Input configuration file')
'config', action='store', default='', help='Input configuration file')
pparser.add_argument(
'-p', '--pipeline', nargs='*', help='Pipeline name')
return pparser

def main():
Expand All @@ -111,7 +112,7 @@ def main():
config = safe_load(file)

# Check if run was a worker spawned by another Processor
run_config = RunConfig(config.get('config'), comm)
run_config = RunConfig(config.pop('config'), comm)
if have_mpi and run_config.spawn:
sub_comm = MPI.Comm.Get_parent()
common_comm = sub_comm.Merge(True)
Expand All @@ -128,7 +129,19 @@ def main():
common_comm = comm

# Get the pipeline configurations
pipeline_config = config.get('pipeline', [])
pipeline = args.pipeline
pipeline_config = []
if pipeline is None:
for sub_pipeline in config.values():
pipeline_config += sub_pipeline
else:
for sub_pipeline in pipeline:
if sub_pipeline in config:
pipeline_config += config.get(sub_pipeline)
else:
raise ValueError(
f'Invalid pipeline option: \'{sub_pipeline}\' missing in '
f'the pipeline configuration ({list(config.keys())})')

# Profiling setup
if run_config.profile:
Expand Down

0 comments on commit a013457

Please sign in to comment.