@@ -453,3 +453,35 @@ def run(self, config_path: str, skip: list[str]):
453453 self .spatial_setup_work_directory (config_path )
454454 self .fluxsite_submit_job (config_path , skip )
455455 self .spatial_run_tasks (config_path )
456+
457+ def meorg_transfer (self , config_path : str ):
458+ """Endpoint for `benchcab meorg-transfer`"""
459+
460+ # Get a logger, load the config
461+ logger = self ._get_logger ()
462+ config = self ._get_config (config_path )
463+
464+ # Check to ensure the tasks are complete
465+ logger .debug ("Checking task completion" )
466+ tasks = self ._get_fluxsite_tasks (config )
467+ num_tasks , num_complete , num_failed , all_complete = task_summary (tasks )
468+ logger .debug (f"{ num_complete } /{ num_tasks } completed." )
469+
470+ # Bail out if incomplete
471+ if not all_complete :
472+ logger .error (f"{ num_failed } tasks have failed, unable to transfer. Exiting." )
473+ sys .exit (1 )
474+
475+ # Check if the output name is set
476+ if config .get ("meorg_output_name" ) is None :
477+ logger .error ("meorg_output_name is not defined in config, unable to transfer files." )
478+ sys .exit (1 )
479+
480+ # Upload to meorg if meorg_output_name optional key is passed
481+ logger .info ("Submitting job for meorg transfer" )
482+ bm .do_meorg (
483+ config ,
484+ upload_dir = internal .FLUXSITE_DIRS ["OUTPUT" ],
485+ benchcab_bin = str (self .benchcab_exe_path ),
486+ benchcab_job_id = None ,
487+ )
0 commit comments