Skip to content
Snippets Groups Projects
Commit 8ed768e0 authored by Jörn Künsemöller's avatar Jörn Künsemöller
Browse files

TMSS-2173: update external siputils with changes made in LOFAR TMSS master over time

parent 7cbe3407
No related branches found
No related tags found
1 merge request!5Resolve TMSS-2173
Pipeline #87113 failed
...@@ -25,4 +25,4 @@ But there is some inline documentation in [lib/siplib.py](siplib.py) and you may ...@@ -25,4 +25,4 @@ But there is some inline documentation in [lib/siplib.py](siplib.py) and you may
The initial version of the siblib in this repo is version 0.4 The initial version of the siblib in this repo is version 0.4
Because the siplib is strongly coupled to the SIP xsd, the version numbering of the siplib will match with the version of the xsd schema which is 2.8.0 now. Because the siplib is strongly coupled to the SIP xsd, the version numbering of the siplib will match with the version of the xsd schema which is 2.8.1 now.
\ No newline at end of file \ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<xs:schema targetNamespace="http://www.astron.nl/SIP-Lofar" version="2.8.0" xmlns="http://www.astron.nl/SIP-Lofar" xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xs:schema targetNamespace="http://www.astron.nl/SIP-Lofar" version="2.8.1" xmlns="http://www.astron.nl/SIP-Lofar" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:annotation> <xs:annotation>
<xs:documentation> <xs:documentation>
XML Schema for data model Submission Information Package LOFAR Long Term Archive XML Schema for data model Submission Information Package LOFAR Long Term Archive
...@@ -616,7 +616,7 @@ ...@@ -616,7 +616,7 @@
<xs:element name="dataProductIdentifier" type="IdentifierType" maxOccurs="unbounded"/> <xs:element name="dataProductIdentifier" type="IdentifierType" maxOccurs="unbounded"/>
</xs:sequence> </xs:sequence>
</xs:complexType> </xs:complexType>
<xs:complexType name="PipelineRun"> <xs:complexType name="PipelineRun" abstract="true">
<xs:complexContent> <xs:complexContent>
<xs:extension base="Process"> <xs:extension base="Process">
<xs:sequence> <xs:sequence>
......
...@@ -5,6 +5,18 @@ ...@@ -5,6 +5,18 @@
# Namespace http://www.astron.nl/SIP-Lofar # Namespace http://www.astron.nl/SIP-Lofar
   
from __future__ import unicode_literals from __future__ import unicode_literals
try:
import pyxb.binding
except AttributeError:
import sys
if sys.version_info.major == 3 and sys.version_info.minor >= 10:
# MutableSequence, Iterable was moved in pyton 3.10
# make pyxb work with 3.10
import collections
collections.MutableSequence = collections.abc.MutableSequence
collections.Iterable = collections.abc.Iterable
import pyxb import pyxb
import pyxb.binding import pyxb.binding
import pyxb.binding.saxer import pyxb.binding.saxer
...@@ -3610,7 +3622,7 @@ class PipelineRun(Process): ...@@ -3610,7 +3622,7 @@ class PipelineRun(Process):
"""Complex type {http://www.astron.nl/SIP-Lofar}PipelineRun with content type ELEMENT_ONLY""" """Complex type {http://www.astron.nl/SIP-Lofar}PipelineRun with content type ELEMENT_ONLY"""
_TypeDefinition = None _TypeDefinition = None
_ContentTypeTag = pyxb.binding.basis.complexTypeDefinition._CT_ELEMENT_ONLY _ContentTypeTag = pyxb.binding.basis.complexTypeDefinition._CT_ELEMENT_ONLY
_Abstract = False _Abstract = True
_ExpandedName = pyxb.namespace.ExpandedName(Namespace, 'PipelineRun') _ExpandedName = pyxb.namespace.ExpandedName(Namespace, 'PipelineRun')
_XSDLocation = pyxb.utils.utility.Location(DEFAULT_SIP_XSD_PATH, 619, 1) _XSDLocation = pyxb.utils.utility.Location(DEFAULT_SIP_XSD_PATH, 619, 1)
_ElementMap = Process._ElementMap.copy() _ElementMap = Process._ElementMap.copy()
......
...@@ -39,7 +39,7 @@ import logging ...@@ -39,7 +39,7 @@ import logging
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
VERSION = "SIPlib 2.8.0" VERSION = "SIPlib 2.8.1"
ltasip.Namespace.setPrefix('sip') ltasip.Namespace.setPrefix('sip')
...@@ -896,7 +896,7 @@ class CorrelatorProcessing(): ...@@ -896,7 +896,7 @@ class CorrelatorProcessing():
__channelwidth = None __channelwidth = None
if channelwidth_frequency and channelwidth_frequencyunit: if channelwidth_frequency and channelwidth_frequencyunit:
__channelwidth = ltasip.Frequency(channelwidth_frequency, units=channelwidth_frequencyunit), __channelwidth = ltasip.Frequency(channelwidth_frequency, units=channelwidth_frequencyunit)
self.__pyxb_rtprocessing = ltasip.Correlator( self.__pyxb_rtprocessing = ltasip.Correlator(
integrationInterval=ltasip.Time(integrationinterval, units=integrationinterval_unit), integrationInterval=ltasip.Time(integrationinterval, units=integrationinterval_unit),
...@@ -963,7 +963,7 @@ class CoherentStokesProcessing(): ...@@ -963,7 +963,7 @@ class CoherentStokesProcessing():
processingType=processingtype) processingType=processingtype)
# Somehow this does not work in the constructor: # Somehow this does not work in the constructor:
self.__pyxb_rtprocessing.channelwidth = __channelwidth self.__pyxb_rtprocessing.channelWidth = __channelwidth
def _get_pyxb_rtprocessing(self, suppress_warning=False): def _get_pyxb_rtprocessing(self, suppress_warning=False):
if not suppress_warning: if not suppress_warning:
...@@ -998,7 +998,7 @@ class IncoherentStokesProcessing(): ...@@ -998,7 +998,7 @@ class IncoherentStokesProcessing():
__channelwidth = None __channelwidth = None
if channelwidth_frequency and channelwidth_frequencyunit: if channelwidth_frequency and channelwidth_frequencyunit:
__channelwidth = ltasip.Frequency(channelwidth_frequency, units=channelwidth_frequencyunit), __channelwidth = ltasip.Frequency(channelwidth_frequency, units=channelwidth_frequencyunit)
self.__pyxb_rtprocessing = ltasip.IncoherentStokes( self.__pyxb_rtprocessing = ltasip.IncoherentStokes(
rawSamplingTime=ltasip.Time(rawsamplingtime, units=rawsamplingtime_unit), rawSamplingTime=ltasip.Time(rawsamplingtime, units=rawsamplingtime_unit),
...@@ -1016,7 +1016,7 @@ class IncoherentStokesProcessing(): ...@@ -1016,7 +1016,7 @@ class IncoherentStokesProcessing():
cobaltPipelineNumber=cobaltpipelinenumber, cobaltPipelineNumber=cobaltpipelinenumber,
processingType = processingtype) processingType = processingtype)
# Somehow this does not work in the constructor: # Somehow this does not work in the constructor:
self.__pyxb_rtprocessing.channelwidth = __channelwidth self.__pyxb_rtprocessing.channelWidth = __channelwidth
def _get_pyxb_rtprocessing(self, suppress_warning=False): def _get_pyxb_rtprocessing(self, suppress_warning=False):
if not suppress_warning: if not suppress_warning:
...@@ -1059,7 +1059,7 @@ class FlysEyeProcessing(): ...@@ -1059,7 +1059,7 @@ class FlysEyeProcessing():
# Somehow this does not work in the constructor: # Somehow this does not work in the constructor:
self.__pyxb_rtprocessing.channelwidth = __channelwidth self.__pyxb_rtprocessing.channelWidth = __channelwidth
def _get_pyxb_rtprocessing(self, suppress_warning=False): def _get_pyxb_rtprocessing(self, suppress_warning=False):
if not suppress_warning: if not suppress_warning:
...@@ -1347,8 +1347,8 @@ class Observation(): ...@@ -1347,8 +1347,8 @@ class Observation():
# Somehow this does not work in the constructor: # Somehow this does not work in the constructor:
if channelwidth_frequency and channelwidth_frequencyunit: if channelwidth_frequency and channelwidth_frequencyunit:
self.__pyxb_observation.channelwidth = ltasip.Frequency(channelwidth_frequency, self.__pyxb_observation.channelWidth = ltasip.Frequency(channelwidth_frequency,
units=channelwidth_frequencyunit), units=channelwidth_frequencyunit)
def _get_pyxb_observation(self, suppress_warning=False): def _get_pyxb_observation(self, suppress_warning=False):
if not suppress_warning: if not suppress_warning:
...@@ -1446,7 +1446,7 @@ class Sip(object): ...@@ -1446,7 +1446,7 @@ class Sip(object):
observingmode, observingmode,
description, description,
process_map, process_map,
): return_xml=True):
up = ltasip.UnspecifiedProcess( up = ltasip.UnspecifiedProcess(
observingMode=observingmode, observingMode=observingmode,
...@@ -1454,21 +1454,22 @@ class Sip(object): ...@@ -1454,21 +1454,22 @@ class Sip(object):
**process_map.get_dict() **process_map.get_dict()
) )
self.__sip.unspecifiedProcess.append(up) self.__sip.unspecifiedProcess.append(up)
if return_xml:
return self.get_prettyxml() return self.get_prettyxml()
def add_parset(self, def add_parset(self,
identifier, identifier,
contents): contents,
return_xml=True):
self.__sip.parset.append(ltasip.Parset( self.__sip.parset.append(ltasip.Parset(
identifier=identifier._get_pyxb_identifier(suppress_warning=True), identifier=identifier._get_pyxb_identifier(suppress_warning=True),
contents=contents contents=contents
)) ))
if return_xml:
return self.get_prettyxml() return self.get_prettyxml()
def add_related_dataproduct_with_history(self, relateddataproduct_sip): def add_related_dataproduct_with_history(self, relateddataproduct_sip, return_xml=True):
# add the dataproduct described by the SIP (if not there) # add the dataproduct described by the SIP (if not there)
if not any( if not any(
x.dataProductIdentifier.identifier == relateddataproduct_sip.__sip.dataProduct.dataProductIdentifier.identifier x.dataProductIdentifier.identifier == relateddataproduct_sip.__sip.dataProduct.dataProductIdentifier.identifier
...@@ -1507,6 +1508,7 @@ class Sip(object): ...@@ -1507,6 +1508,7 @@ class Sip(object):
for par in relateddataproduct_sip.__sip.parset: for par in relateddataproduct_sip.__sip.parset:
if not any(x.identifier.identifier == par.identifier.identifier for x in self.__sip.parset): if not any(x.identifier.identifier == par.identifier.identifier for x in self.__sip.parset):
self.__sip.parset.append(par) self.__sip.parset.append(par)
if return_xml:
return self.get_prettyxml() return self.get_prettyxml()
def get_dataproduct_identifier(self): def get_dataproduct_identifier(self):
......
...@@ -95,7 +95,7 @@ def check_consistency(sip): ...@@ -95,7 +95,7 @@ def check_consistency(sip):
if not id_from in linkstodataproduct: if not id_from in linkstodataproduct:
raise Exception("The input dataproduct for pipeline '" + id + "' seems to be missing! -> ", id_from) raise Exception("The input dataproduct for pipeline '" + id + "' seems to be missing! -> ", id_from)
logger.info("General SIP structure seems ok!") logger.info("General SIP structure for dataproduct with sip_id=%s seems ok!", id_out)
return True # already raised Exception if there was a problem... return True # already raised Exception if there was a problem...
......
...@@ -11,7 +11,7 @@ scripts = glob.glob('bin/*') ...@@ -11,7 +11,7 @@ scripts = glob.glob('bin/*')
setuptools.setup( setuptools.setup(
name="siputils", name="siputils",
version="2.8.0", version="2.8.1",
setuptools_git_versioning={ setuptools_git_versioning={
"template": "{tag}", "template": "{tag}",
"dev_template": "{tag}.dev{ccount}+git.{sha}", "dev_template": "{tag}.dev{ccount}+git.{sha}",
......
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<sip:ltaSip xmlns:sip="http://www.astron.nl/SIP-Lofar" <sip:ltaSip xmlns:sip="http://www.astron.nl/SIP-Lofar"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.astron.nl/SIP-Lofar LTA-SIP-2.8.0.xsd "> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.astron.nl/SIP-Lofar LTA-SIP-2.8.1.xsd ">
<sipGeneratorVersion>Version v2.17.5 (29-08-2016) (modified by hand by RG, May 2022)</sipGeneratorVersion> <sipGeneratorVersion>Version v2.17.5 (29-08-2016) (modified by hand by RG, May 2022)</sipGeneratorVersion>
<project> <project>
<projectCode>LC6_016</projectCode> <projectCode>LC6_016</projectCode>
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<sip:ltaSip xmlns:sip="http://www.astron.nl/SIP-Lofar" <sip:ltaSip xmlns:sip="http://www.astron.nl/SIP-Lofar"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.astron.nl/SIP-Lofar LTA-SIP-2.8.0.xsd "> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.astron.nl/SIP-Lofar LTA-SIP-2.8.1.xsd ">
<sipGeneratorVersion>Version v2.17.5 (29-08-2016) (modified by hand by RG, May 2022)</sipGeneratorVersion> <sipGeneratorVersion>Version v2.17.5 (29-08-2016) (modified by hand by RG, May 2022)</sipGeneratorVersion>
<project> <project>
<projectCode>LC6_016</projectCode> <projectCode>LC6_016</projectCode>
...@@ -594,12 +594,14 @@ class TestSIPlib(unittest.TestCase): ...@@ -594,12 +594,14 @@ class TestSIPlib(unittest.TestCase):
def test_pipelines(self): def test_pipelines(self):
mysip = create_basicdoc() mysip = create_basicdoc()
with self.assertRaises(pyxb.exceptions_.AbstractInstantiationError) as context:
logger.info("===\nAdding simple pipelinerun:\n") logger.info("===\nAdding simple pipelinerun:\n")
logger.info(mysip.add_pipelinerun( logger.info(mysip.add_pipelinerun(
siplib.SimplePipeline( siplib.SimplePipeline(
create_pipelinemap() create_pipelinemap()
) )
)) ))
self.assertIn('Cannot instantiate abstract type {http://www.astron.nl/SIP-Lofar}PipelineRun directly', str(context.exception))
logger.info("===\nAdding generic pipelinerun:\n") logger.info("===\nAdding generic pipelinerun:\n")
logger.info(mysip.add_pipelinerun( logger.info(mysip.add_pipelinerun(
......
2.8.0 2.8.1
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment