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

Post Apocalypse Testing Round 4 - Restores

parent aec0eed2
No related branches found
No related tags found
1 merge request!359Post Apocalypse Testing Round 4 - Restores
Pipeline #2265 passed
...@@ -7,6 +7,8 @@ import sys ...@@ -7,6 +7,8 @@ import sys
import tarfile import tarfile
from pathlib import Path from pathlib import Path
from distutils.dir_util import copy_tree
from casa_envoy.schema import AbstractTextFile from casa_envoy.schema import AbstractTextFile
from casa_envoy.interfaces import FoundationIF from casa_envoy.interfaces import FoundationIF
...@@ -42,8 +44,10 @@ class RestoreFoundation(FoundationIF): ...@@ -42,8 +44,10 @@ class RestoreFoundation(FoundationIF):
if Path(cal_path).exists(): if Path(cal_path).exists():
calibration = tarfile.open(cal_path) calibration = tarfile.open(cal_path)
# extract to products # extract to products
calibration.extractall(path="./products") calibration.extractall("./rawdata")
calibration.close() calibration.close()
src = "./rawdata/products"
copy_tree(src, "./products/")
else: else:
self.logger.error(f"ERROR: calibration tar file {cal_name} not found in rawdata!") self.logger.error(f"ERROR: calibration tar file {cal_name} not found in rawdata!")
# abort since required data not found # abort since required data not found
......
...@@ -93,6 +93,10 @@ class CasaLauncher: ...@@ -93,6 +93,10 @@ class CasaLauncher:
for file in casa_logs: for file in casa_logs:
if re.match("^.*SEVERE\sflagmanager.*$", open(file).read()): if re.match("^.*SEVERE\sflagmanager.*$", open(file).read()):
self.logger.error("CASA ERROR!") self.logger.error("CASA ERROR!")
sys.exit(1)
elif re.match("Traceback (most recent call last):", open(file).read()):
self.logger.error("CASA ERROR!")
sys.exit(1)
else: else:
self.logger.info("CASA Success!") self.logger.info("CASA Success!")
......
...@@ -71,7 +71,7 @@ class CalibratedMS(SpooledProduct): ...@@ -71,7 +71,7 @@ class CalibratedMS(SpooledProduct):
return self.path.absolute().name return self.path.absolute().name
def deliver_to(self, destination: Destination): def deliver_to(self, destination: Destination):
destination.add_directory(self.path, self.cms_name[:-3]) destination.add_directory(self.path, self.cms_name)
def __str__(self): def __str__(self):
return f"calibrated MS {self.cms_name}" return f"calibrated MS {self.cms_name}"
......
"""correcting restore PPR
Revision ID: 7b284596590c
Revises: fd68d858d354
Create Date: 2021-07-20 16:18:25.909424
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = "7b284596590c"
down_revision = "fd68d858d354"
branch_labels = None
depends_on = None
ppr_content = """<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ns2:SciPipeRequest xmlns:ns2="Common/pipelinescience/SciPipeRequest">
<ProjectSummary>
<ProposalCode>VLA/{{projectCode}}</ProposalCode>
<Observatory>NRAO</Observatory>
<Telescope>VLA</Telescope>
<ProcessingSite>Socorro</ProcessingSite>
<Operator>vlapipe</Operator>
<Mode>SCIENCE</Mode>
<Version>NGRH-ALMA-10_8</Version>
<CreationTime>{{created_at}}</CreationTime>
</ProjectSummary>
<ProjectStructure>TBD</ProjectStructure>
<ProcessingRequests>
<RootDirectory>{{root_directory}}</RootDirectory>
<ProcessingRequest>
<ProcessingIntents/>
<ProcessingProcedure>
<ProcedureTitle>Workspaces Restore</ProcedureTitle>
<ProcessingCommand>
<Command>hifv_restoredata</Command>
<ParameterSet/>
</ProcessingCommand>
<ProcessingCommand>
<Command>hifv_statwt</Command>
<ParameterSet/>
</ProcessingCommand>
</ProcessingProcedure>
<DataSet>
<RelativePath>{{relative_path}}</RelativePath>
<SdmIdentifier>{{sdmId}}</SdmIdentifier>
<DataType>asdm</DataType>
</DataSet>
</ProcessingRequest>0
</ProcessingRequests>
</ns2:SciPipeRequest>
"""
old_ppr_content = """<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ns2:SciPipeRequest xmlns:ns2="Common/pipelinescience/SciPipeRequest">
<ProjectSummary>
<ProposalCode>VLA/null</ProposalCode>
<Observatory>NRAO</Observatory>
<Telescope>VLA</Telescope>
<ProcessingSite>Socorro</ProcessingSite>
<Operator>vlapipe</Operator>
<Mode>SCIENCE</Mode>
<Version>NGRH-ALMA-10_8</Version>
<CreationTime>{{created_at}}</CreationTime>
</ProjectSummary>
<ProjectStructure>TBD</ProjectStructure>
<ProcessingRequests>
<RootDirectory>{{root_directory}}</RootDirectory>
<ProcessingRequest>
<ProcessingIntents>
<Intents>
<Keyword>VLA_INTERFEROMETRY_STANDARD_OBSERVING_MODE</Keyword>
<Value>Undefined</Value>
</Intents>
</ProcessingIntents>
<ProcessingProcedure>
<ProcedureTitle>Workspaces Restore</ProcedureTitle>
<ProcessingCommand>
<Command>hifv_restoredata</Command>
<ParameterSet/>
</ProcessingCommand>
<ProcessingCommand>
<Command>hifv_statwt</Command>
<ParameterSet/>
</ProcessingCommand>
</ProcessingProcedure>
<DataSet>
<RelativePath>{{relative_path}}</RelativePath>
<SdmIdentifier>{{sdmId}}</SdmIdentifier>
<DataType>asdm</DataType>
</DataSet>
</ProcessingRequest>0
</ProcessingRequests>
<ResultsProcessing>
<ArchiveResults>false</ArchiveResults>
<CleanUpDisk>false</CleanUpDisk>
<UpdateProjectLifeCycle>false</UpdateProjectLifeCycle>
<NotifyOperatorWhenDone>false</NotifyOperatorWhenDone>
<SDMall>false</SDMall>
<SDMonly>false</SDMonly>
<PipelineOperatorAddress>Unknown</PipelineOperatorAddress>
</ResultsProcessing>
</ns2:SciPipeRequest>
"""
def upgrade():
op.execute(
f"""
UPDATE workflow_templates
SET content=E'{ppr_content}' WHERE filename='PPR.xml' AND workflow_name='restore_cms'
"""
)
def downgrade():
op.execute(
f"""
UPDATE workflow_templates
SET content=E'{old_ppr_content}' WHERE filename='PPR.xml' AND workflow_name='restore_cms'
"""
)
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