Skip to content

Commit

Permalink
fail if data required to run use case or diff test cannot be download…
Browse files Browse the repository at this point in the history
…ed so GHA error logs are more clear -- previously use cases or diff tests would fail and it was not clear why
  • Loading branch information
georgemccabe committed Nov 2, 2023
1 parent b786e94 commit db72d85
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
11 changes: 8 additions & 3 deletions .github/jobs/get_data_volumes.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def main(args):
branch_name = get_branch_name()
if not branch_name:
print("Could not get current branch. Exiting.")
sys.exit(1)
return None

# remove -ref from end of branch name if found
if branch_name.endswith('-ref'):
Expand Down Expand Up @@ -88,7 +88,7 @@ def main(args):
# use it, otherwise use develop version of data volume
elif (metplus_version == 'develop' and
f'{branch_name}-{model_app_name}' in available_volumes):
volume_name = f'{branch_name}-{model_app_name}'
volume_name = f'{branch_name}-{model_app_name}'
else:
volume_name = f'{metplus_version}-{model_app_name}'

Expand All @@ -97,18 +97,23 @@ def main(args):
cmd = (f'docker create --name {model_app_name} '
f'{full_volume_name}')
if not run_commands(cmd):
continue
print(f'ERROR: Could not create data volume for {full_volume_name}')
return None

# add name to volumes from list to pass to docker build
volume_list.append(f'--volumes-from {model_app_name}')

return ' '.join(volume_list)


if __name__ == "__main__":
# split up command line args that have commas before passing into main
args = []

for arg in sys.argv[1:]:
args.extend(arg.split(','))
out = main(args)
if out is None:
print("ERROR: Something went wrong")
sys.exit(1)
print(out)
3 changes: 3 additions & 0 deletions .github/jobs/setup_and_run_diff.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@
output_category = f"output-{output_data_branch}-{artifact_name}"

VOLUMES_FROM = get_data_volumes.main([output_category])
if VOLUMES_FROM is None:
print("ERROR: Could not get truth data to run diff")
sys.exit(1)

print(f"Output Volumes: {VOLUMES_FROM}")

Expand Down
4 changes: 4 additions & 0 deletions .github/jobs/setup_and_run_use_cases.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ def main():
)
# get input data volumes
volumes_from = get_data_volumes.main(categories_list)
if volumes_from is None:
print('ERROR: Could not get input data to run use cases')
sys.exit(1)

print(f"Input Volumes: {volumes_from}")

# build Docker image with conda environment and METplus branch image
Expand Down

0 comments on commit db72d85

Please sign in to comment.