Skip to content
Snippets Groups Projects
Commit b62a522f authored by Charlotte Hausman's avatar Charlotte Hausman
Browse files

changes for integrated workflow

parent 4a869f8c
No related branches found
No related tags found
1 merge request!350changes for integrated workflow
Pipeline #2208 passed
......@@ -43,7 +43,7 @@ def get_fields_for(product_type: str, filename: str) -> list:
if ".xml" in filename:
return ppr_list
if ".json" in filename and "cal" in product_type:
if ".json" in filename and "cal" in product_type or product_type == "integrated":
return cal_metadata_list
elif ".json" in filename and "img" in product_type:
return img_metadata_list
......
......@@ -168,7 +168,12 @@ class ImagingLauncher(LauncherIF):
self.metadata = get_abs_file(parameters.get("metadata"))
def launch_casa(self):
if self.check_imageable():
if self.parameters["product_type"] == "integrated":
check_input = self.check_cal_and_imageable()
else:
check_input = self.check_imageable()
if check_input:
self.run_audit(self.parameters)
CasaLauncher(self.parameters).run()
else:
......@@ -185,6 +190,28 @@ class ImagingLauncher(LauncherIF):
self.logger.info("CMS ERROR: Imaging requires a valid CMS name and location!")
return False
def check_cal_and_imageable(self) -> bool:
wf_name = self.metadata.content["workflowName"]
spl = self.metadata.content["productLocator"]
if "restore" in wf_name:
cal_spl = self.metadata.content["calProductLocator"]
if "execblock" in spl and "calibration" in cal_spl:
return True
else:
self.logger.error(
"SPL ERROR: This set of product locators are not restorable! Please check your inputs"
)
elif "cal" in wf_name:
if "execblock" in spl:
return True
else:
self.logger.error(
"SPL ERROR: This product locator is not calibratable! Please check your inputs"
)
return False
def run_audit(self, parameters: Dict[str, str]):
dir_audit = AuditDirectories(self.ppr, parameters).audit
if dir_audit:
......
......@@ -22,6 +22,16 @@ img_parameters = {
"product_type": "standard-img",
}
restore_parameters = {
"useCasa": False,
"homeForReprocessing": "/home/casa/packages/pipeline/current",
"rootDirectory": "/tmp/workspaces_tmp/",
"processingDirectory": "tmpiox5trbp",
"metadata": "test/input_files/restore.json",
"ppr": "test/input_files/PPR.xml",
"product_type": "restore",
}
class TestCasaLauncher:
def test_setup_environment(self):
......@@ -72,3 +82,8 @@ class TestImagingLauncher:
def test_check_imageable(self):
check = ImagingLauncher(parameters=img_parameters).check_imageable()
assert check is True
def test_check_cal_and_imageable(self):
restore_parameters["product_type"] = "integrated"
check = ImagingLauncher(parameters=restore_parameters).check_cal_and_imageable()
assert check is True
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