Skip to content

Commit

Permalink
Added --time option to fre pp wrapper, and standalone fre pp trigger
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris Blanton authored and Chris Blanton committed Nov 26, 2024
1 parent 01023ef commit 352c568
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 5 deletions.
29 changes: 26 additions & 3 deletions fre/pp/frepp.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from .validate import _validate_subtool
from .install import install_subtool
from .run import pp_run_subtool
from .trigger import _trigger
from .status import status_subtool
from .wrapper import runFre2pp

Expand Down Expand Up @@ -187,21 +188,43 @@ def configure_xml(context, xml, platform, target, experiment, do_analysis, histo
@click.option("-p", "--platform", type=str,
help="Platform name",
required=True)
@click.option("-t", "--target", type=str,
@click.option("-T", "--target", type=str,
help="Target name",
required=True)
@click.option("-c", "--config-file", type=str,
help="Path to a configuration file in either XML or YAML",
required=True)
@click.option("-t", "--time",
required=False,
help="Time whose history files are ready")
@click.option("-b", "--branch",
show_default=True,
required=False,
help="fre-workflows branch/tag to clone; default is $(fre --version)")
@click.pass_context
def wrapper(context, experiment, platform, target, config_file, branch=None):
def wrapper(context, experiment, platform, target, config_file, time=None, branch=None):
# pylint: disable=unused-argument
""" - Execute fre pp steps in order """
context.forward(runFre2pp)

@pp_cli.command()
@click.option("-e", "--experiment", type=str,
help="Experiment name",
required=True)
@click.option("-p", "--platform", type=str,
help="Platform name",
required=True)
@click.option("-T", "--target", type=str,
help="Target name",
required=True)
@click.option("-t", "--time",
required=True,
help="Time whose history files are ready")
@click.pass_context
def trigger(context, experiment, platform, target, time):
# pylint: disable=unused-argument
""" - Start postprocessing for a particular time """
context.forward(_trigger)

if __name__ == "__main__":
''' entry point for click to fre pp commands '''
pp_cli()
7 changes: 5 additions & 2 deletions fre/pp/wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@
from .configure_script_yaml import yamlInfo
from .install import install_subtool
from .run import pp_run_subtool
from .trigger import trigger
from .status import status_subtool

@click.command()
def runFre2pp(experiment, platform, target, config_file, branch):
def runFre2pp(experiment, platform, target, config_file, branch, time):
'''
Wrapper script for calling a FRE2 pp experiment with the canopy-style
infrastructure and fre-cli
time=0000
'''

config_file = os.path.abspath(config_file)
Expand All @@ -40,6 +40,9 @@ def runFre2pp(experiment, platform, target, config_file, branch):

pp_run_subtool(experiment, platform, target)

if time:
trigger(experiment, platform, target, time)

status_subtool(experiment, platform, target)

if __name__ == '__main__':
Expand Down

0 comments on commit 352c568

Please sign in to comment.