Skip to content

Commit

Permalink
Merge branch 'main' into 298-cmor-process-ocean-tripolar-grid
Browse files Browse the repository at this point in the history
  • Loading branch information
ilaflott committed Jan 13, 2025
2 parents baf61dc + 70a6928 commit 8a71625
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
3 changes: 2 additions & 1 deletion fre/catalog/frecatalog.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,14 @@ def catalog_cli():
@click.option('--filter_realm', nargs = 1)
@click.option('--filter_freq', nargs = 1)
@click.option('--filter_chunk', nargs = 1)
@click.option('--verbose', is_flag = True, default = False)
@click.option('--overwrite', is_flag = True, default = False)
@click.option('--append', is_flag = True, default = False)
@click.option('--slow', is_flag = True, default = False,
help = "Open NetCDF files to retrieve additional vocabulary (standard_name and intrafile static variables")
@click.pass_context
def builder(context, input_path = None, output_path = None, config = None, filter_realm = None,
filter_freq = None, filter_chunk = None, overwrite = False, append = False, slow = False):
filter_freq = None, filter_chunk = None, verbose = False, overwrite = False, append = False, slow = False):
# pylint: disable=unused-argument
""" - Generate .csv and .json files for catalog """
context.forward(gen_intake_gfdl.create_catalog_cli)
Expand Down
16 changes: 16 additions & 0 deletions fre/pp/run_script.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
''' fre pp run '''

import subprocess
import time

def pp_run_subtool(experiment = None, platform = None, target = None):
"""
Expand All @@ -12,9 +13,24 @@ def pp_run_subtool(experiment = None, platform = None, target = None):
'currently, their values are...'
f'{experiment} / {platform} / {target}')

# Check to see if the workflow is already running
name = experiment + '__' + platform + '__' + target
result = subprocess.run(['cylc', 'scan', '--name', f"^{name}$"], capture_output=True).stdout.decode('utf-8')
if len(result):
print("Workflow already running!")
return

# If not running, start it
cmd = f"cylc play {name}"
subprocess.run(cmd, shell=True, check=True)

# wait 30 seconds for the scheduler to come up; then confirm
print("Workflow started; waiting 30 seconds to confirm")
time.sleep(30)
result = subprocess.run(['cylc', 'scan', '--name', f"^{name}$"], capture_output=True).stdout.decode('utf-8')

if not len(result):
raise Exception('Cylc scheduler was started without error but is not running after 30 seconds')

if __name__ == "__main__":
pp_run_subtool()

0 comments on commit 8a71625

Please sign in to comment.