Skip to content

Commit 7cab381

Browse files
authored
Merge pull request #3 from riniangreani/fix_copy_db
fix copying backup to canfar
2 parents ec8c228 + 8caf10a commit 7cab381

1 file changed

Lines changed: 10 additions & 4 deletions

File tree

possum_pipeline_control/check_status_and_launch_3Dpipeline_v2.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff 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

520526
if __name__ == "__main__":
521527
parser = argparse.ArgumentParser(

0 commit comments

Comments
 (0)