Skip to content
Snippets Groups Projects
Commit 9b387513 authored by Sam Kagan's avatar Sam Kagan
Browse files

Drafted change to stick piperestorescript in the right place

parent 1c26be09
No related branches found
No related tags found
2 merge requests!1706merge 2.8.4 to main,!1657Got EVLA CMS restores working via casa_envoy, using casa_restorepipescript.py when it exists
......@@ -23,11 +23,12 @@ import json
import logging
import os
import shutil
import sys
import tarfile
from distutils.dir_util import copy_tree
from pathlib import Path
from posixpath import isfile
from typing import Optional
from casa_envoy.interfaces import FoundationIF
from casa_envoy.schema import AbstractTextFile
......@@ -89,6 +90,7 @@ class RestoreFoundation(FoundationIF):
self.parameters = parameters
self.parent_path = parameters["parent_path"]
self.content = json.loads(metadata.content)
self._path_to_piperestorescript: Optional[Path] = None
def data_foundation(self):
"""
......@@ -107,8 +109,19 @@ class RestoreFoundation(FoundationIF):
path = Path("./products")
self.logger.info("Ensuring correct file permissions....")
set_permissions(path)
CASAPIPERESTORESCRIPT = "casa_piperestorescript.py"
self.logger.info(f"Checking for {CASAPIPERESTORESCRIPT})...")
if (path / CASAPIPERESTORESCRIPT).is_file():
dest = Path(f"working/{CASAPIPERESTORESCRIPT}")
shutil.copyfile(path / CASAPIPERESTORESCRIPT, dest)
self._path_to_piperestorescript = dest
self.logger.info(f"Found {CASAPIPERESTORESCRIPT}, copied it to {dest}")
self.logger.info("Restore data foundation complete!")
@property
def path_to_piperestorescript(self) -> Optional[Path]:
return self._path_to_piperestorescript
def extract_cal(self):
self.logger.info("Extracting calibration tar file to products directory...")
cal_name = self.content["fileSetIds"][1]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment