Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions src/benchcab/benchcab.py
Original file line number Diff line number Diff line change
Expand Up @@ -453,3 +453,35 @@ def run(self, config_path: str, skip: list[str]):
self.spatial_setup_work_directory(config_path)
self.fluxsite_submit_job(config_path, skip)
self.spatial_run_tasks(config_path)

def meorg_transfer(self, config_path: str):
"""Endpoint for `benchcab meorg-transfer`"""

# Get a logger, load the config
logger = self._get_logger()
config = self._get_config(config_path)

# Check to ensure the tasks are complete
logger.debug("Checking task completion")
tasks = self._get_fluxsite_tasks(config)
num_tasks, num_complete, num_failed, all_complete = task_summary(tasks)
logger.debug(f"{num_complete}/{num_tasks} completed.")

# Bail out if incomplete
if not all_complete:
logger.error(f"{num_failed} tasks have failed, unable to transfer. Exiting.")
sys.exit(1)

# Check if the output name is set
if config.get("meorg_output_name") is None:
logger.error("meorg_output_name is not defined in config, unable to transfer files.")
sys.exit(1)

# Upload to meorg if meorg_output_name optional key is passed
logger.info("Submitting job for meorg transfer")
bm.do_meorg(
config,
upload_dir=internal.FLUXSITE_DIRS["OUTPUT"],
benchcab_bin=str(self.benchcab_exe_path),
benchcab_job_id=None,
)
10 changes: 10 additions & 0 deletions src/benchcab/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,4 +257,14 @@ def generate_parser(app: Benchcab) -> argparse.ArgumentParser:
add_help=False,
)
parser_codecov.set_defaults(func=app.gen_codecov)

# subcommand: 'benchcab meorg-transfer'
parser_meorg_transfer = subparsers.add_parser(
"meorg-transfer",
parents=[args_help, args_subcommand],
help="Manually transfer model outputs to modelevaluation.org",
add_help=False
)
parser_meorg_transfer.set_defaults(func=app.meorg_transfer)

return main_parser
Loading