Skip to content

Commit 8caf10a

Browse files
committed
fix copying backup to canfar
1 parent 985b83e commit 8caf10a

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
@@ -483,7 +483,8 @@ def run_prefect_db_backup():
483483
ts = datetime.now(timezone.utc).strftime("%Y-%m-%dT%H%M%SZ")
484484
OUTDIR = Path.home() / "prefect-backups"
485485
OUTDIR.mkdir(parents=True, exist_ok=True)
486-
db_backup = OUTDIR / f"prefect-{ts}.sql"
486+
db_file_name = f"prefect-{ts}.sql"
487+
db_backup = OUTDIR / db_file_name
487488

488489
cmd = ["bash", bkpscript, str(db_backup)]
489490
result = subprocess.run(cmd, capture_output=True, text=True)
@@ -503,9 +504,14 @@ def run_prefect_db_backup():
503504
)
504505
# --- Copy to CANFAR ---
505506
print("Copying the backup to CANFAR...")
506-
client = Client()
507-
client.copy(str(db_backup), "arc:projects/CIRADA/polarimetry/software/prefect-backups")
508-
print("Backup completed successfully")
507+
try:
508+
client = Client()
509+
VOS_FOLDER = "arc:projects/CIRADA/polarimetry/software/prefect-backups"
510+
remote_file = f"{VOS_FOLDER}/{db_file_name}"
511+
client.copy(str(db_backup), remote_file)
512+
print("Backup completed successfully")
513+
except Exception as e:
514+
print(f"Failed to copy backup to CANFAR: {e}")
509515

510516
if __name__ == "__main__":
511517
parser = argparse.ArgumentParser(

0 commit comments

Comments
 (0)