Skip to content
Snippets Groups Projects
Commit d1e00266 authored by Marcel Loose's avatar Marcel Loose :sunglasses:
Browse files

Task #3464: Added option to setupsourcedb to generate the skydb as one big blob

parent d307b220
No related branches found
No related tags found
No related merge requests found
...@@ -196,7 +196,8 @@ class msss_calibrator_pipeline(control): ...@@ -196,7 +196,8 @@ class msss_calibrator_pipeline(control):
'share', 'pipeline', 'skymodels', 'Ateam_LBA_CC.skymodel' 'share', 'pipeline', 'skymodels', 'Ateam_LBA_CC.skymodel'
), ),
mapfile=os.path.join(mapfile_dir, 'dppp.sourcedb.mapfile'), mapfile=os.path.join(mapfile_dir, 'dppp.sourcedb.mapfile'),
suffix='.dppp.sourcedb' suffix='.dppp.sourcedb',
type='blob'
)['mapfile'] )['mapfile']
# Create a parameter-subset for DPPP and write it to file. # Create a parameter-subset for DPPP and write it to file.
......
...@@ -271,7 +271,8 @@ class msss_target_pipeline(control): ...@@ -271,7 +271,8 @@ class msss_target_pipeline(control):
'share', 'pipeline', 'skymodels', 'Ateam_LBA_CC.skymodel' 'share', 'pipeline', 'skymodels', 'Ateam_LBA_CC.skymodel'
), ),
mapfile=os.path.join(mapfile_dir, 'dppp.sourcedb.mapfile'), mapfile=os.path.join(mapfile_dir, 'dppp.sourcedb.mapfile'),
suffix='.dppp.sourcedb' suffix='.dppp.sourcedb',
type='blob'
)['mapfile'] )['mapfile']
# Create a parameter-subset for DPPP and write it to file. # Create a parameter-subset for DPPP and write it to file.
......
...@@ -37,6 +37,11 @@ class setupsourcedb(BaseRecipe, RemoteCommandRecipeMixIn): ...@@ -37,6 +37,11 @@ class setupsourcedb(BaseRecipe, RemoteCommandRecipeMixIn):
help="Input sky catalogue", help="Input sky catalogue",
default='' default=''
), ),
'type': ingredient.StringField(
'--type',
help="Output type (casa or blob)",
default="casa"
),
'mapfile': ingredient.StringField( 'mapfile': ingredient.StringField(
'--mapfile', '--mapfile',
help="Full path of mapfile to produce; it will contain " help="Full path of mapfile to produce; it will contain "
...@@ -109,7 +114,8 @@ class setupsourcedb(BaseRecipe, RemoteCommandRecipeMixIn): ...@@ -109,7 +114,8 @@ class setupsourcedb(BaseRecipe, RemoteCommandRecipeMixIn):
arguments=[ arguments=[
self.inputs['executable'], self.inputs['executable'],
self.inputs['skymodel'], self.inputs['skymodel'],
outfile outfile,
self.inputs['type']
] ]
) )
) )
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
# loose@astron.nl # loose@astron.nl
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
from subprocess import Popen, CalledProcessError, PIPE, STDOUT from subprocess import CalledProcessError
import errno import errno
import os import os
import tempfile import tempfile
...@@ -19,7 +19,7 @@ from lofarpipe.support.utilities import catch_segfaults ...@@ -19,7 +19,7 @@ from lofarpipe.support.utilities import catch_segfaults
class setupsourcedb(LOFARnodeTCP): class setupsourcedb(LOFARnodeTCP):
def run(self, executable, catalogue, skydb): def run(self, executable, catalogue, skydb, dbtype):
with log_time(self.logger): with log_time(self.logger):
# Create output directory if it does not yet exist. # Create output directory if it does not yet exist.
skydb_dir = os.path.dirname(skydb) skydb_dir = os.path.dirname(skydb)
...@@ -38,9 +38,10 @@ class setupsourcedb(LOFARnodeTCP): ...@@ -38,9 +38,10 @@ class setupsourcedb(LOFARnodeTCP):
scratch_dir = tempfile.mkdtemp() scratch_dir = tempfile.mkdtemp()
try: try:
cmd = [executable, cmd = [executable,
"in=%s" % catalogue,
"out=%s" % skydb,
"outtype=%s" % dbtype,
"format=<", "format=<",
"in=%s" % (catalogue),
"out=%s" % (skydb),
"append=false" "append=false"
] ]
with CatchLog4CPlus( with CatchLog4CPlus(
...@@ -49,10 +50,10 @@ class setupsourcedb(LOFARnodeTCP): ...@@ -49,10 +50,10 @@ class setupsourcedb(LOFARnodeTCP):
os.path.basename(executable) os.path.basename(executable)
) as logger: ) as logger:
catch_segfaults(cmd, scratch_dir, None, logger) catch_segfaults(cmd, scratch_dir, None, logger)
except CalledProcessError, e: except CalledProcessError, err:
# For CalledProcessError isn't properly propagated by IPython # For CalledProcessError isn't properly propagated by IPython
# Temporary workaround... # Temporary workaround...
self.logger.error(str(e)) self.logger.error(str(err))
return 1 return 1
finally: finally:
shutil.rmtree(scratch_dir) shutil.rmtree(scratch_dir)
......
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