File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -493,7 +493,8 @@ def run_prefect_db_backup():
493493 ts = datetime .now (timezone .utc ).strftime ("%Y-%m-%dT%H%M%SZ" )
494494 OUTDIR = Path .home () / "prefect-backups"
495495 OUTDIR .mkdir (parents = True , exist_ok = True )
496- db_backup = OUTDIR / f"prefect-{ ts } .sql"
496+ db_file_name = f"prefect-{ ts } .sql"
497+ db_backup = OUTDIR / db_file_name
497498
498499 cmd = ["bash" , bkpscript , str (db_backup )]
499500 result = subprocess .run (cmd , capture_output = True , text = True )
@@ -513,9 +514,14 @@ def run_prefect_db_backup():
513514 )
514515 # --- Copy to CANFAR ---
515516 print ("Copying the backup to CANFAR..." )
516- client = Client ()
517- client .copy (str (db_backup ), "arc:projects/CIRADA/polarimetry/software/prefect-backups" )
518- print ("Backup completed successfully" )
517+ try :
518+ client = Client ()
519+ VOS_FOLDER = "arc:projects/CIRADA/polarimetry/software/prefect-backups"
520+ remote_file = f"{ VOS_FOLDER } /{ db_file_name } "
521+ client .copy (str (db_backup ), remote_file )
522+ print ("Backup completed successfully" )
523+ except Exception as e :
524+ print (f"Failed to copy backup to CANFAR: { e } " )
519525
520526if __name__ == "__main__" :
521527 parser = argparse .ArgumentParser (
You can’t perform that action at this time.
0 commit comments