Skip to content

Commit

Permalink
Align some click bindings
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 c2f17d3 commit 01023ef
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 35 deletions.
4 changes: 2 additions & 2 deletions fre/pp/install.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import subprocess
import click

def _install_subtool(experiment, platform, target):
def install_subtool(experiment, platform, target):
"""
Install the Cylc workflow definition located in
~/cylc-src/<experiment>__<platform>__<target>
Expand Down Expand Up @@ -37,6 +37,6 @@ def _install_subtool(experiment, platform, target):
subprocess.run(cmd, shell=True, check=True)

@click.command()
def install_subtool(experiment, platform, target):
def _install_subtool(experiment, platform, target):
''' entry point to install for click '''
return _install_subtool(experiment, platform, target)
4 changes: 2 additions & 2 deletions fre/pp/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import subprocess
import click

def _pp_run_subtool(experiment, platform, target):
def pp_run_subtool(experiment, platform, target):
"""
Start or restart the Cylc workflow identified by:
<experiment>__<platform>__<target>
Expand All @@ -15,6 +15,6 @@ def _pp_run_subtool(experiment, platform, target):
subprocess.run(cmd, shell=True, check=True)

@click.command()
def pp_run_subtool(experiment, platform, target):
def _pp_run_subtool(experiment, platform, target):
''' entry point to run for click '''
return _pp_run_subtool(experiment, platform, target)
4 changes: 2 additions & 2 deletions fre/pp/status.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import subprocess
import click

def _status_subtool(experiment, platform, target):
def status_subtool(experiment, platform, target):
"""
Report workflow state for the Cylc workflow
<experiment>__<platform>__<target>
Expand All @@ -16,6 +16,6 @@ def _status_subtool(experiment, platform, target):


@click.command()
def status_subtool(experiment, platform, target):
def _status_subtool(experiment, platform, target):
''' entry point to status for click '''
return _status_subtool(experiment, platform, target)
41 changes: 12 additions & 29 deletions fre/pp/wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
# Import from the local packages
from .checkoutScript import checkoutTemplate
from .configure_script_yaml import yamlInfo
from .install import _install_subtool
from .run import _pp_run_subtool
from .status import _status_subtool
from .install import install_subtool
from .run import pp_run_subtool
from .status import status_subtool

@click.command()
def runFre2pp(experiment, platform, target, config_file, branch):
Expand All @@ -32,32 +32,15 @@ def runFre2pp(experiment, platform, target, config_file, branch):

config_file = os.path.abspath(config_file)

#env_setup
#todo: check for experiment existing, call frepp_stop to clean experiment,
try:
checkoutTemplate(experiment, platform, target, branch)
except Exception as err:
raise

try:
yamlInfo(config_file, experiment, platform, target)
except Exception as err:
raise

try:
_install_subtool(experiment, platform, target)
except:
raise

try:
_pp_run_subtool(experiment, platform, target)
except Exception as err:
raise

try:
_status_subtool(experiment, platform, target)
except Exception as err:
raise
checkoutTemplate(experiment, platform, target, branch)

yamlInfo(config_file, experiment, platform, target)

install_subtool(experiment, platform, target)

pp_run_subtool(experiment, platform, target)

status_subtool(experiment, platform, target)

if __name__ == '__main__':
runFre2pp()

0 comments on commit 01023ef

Please sign in to comment.