Commit e4c603fc authored by Soichiro Morisaki's avatar Soichiro Morisaki

lalinference_pipe_utils.py: reindentation

parent fe42b547
......@@ -1254,9 +1254,9 @@ class LALInferencePipelineDAG(pipeline.CondorDAG):
self.add_gracedb_start_node(ugid,'LIB',[sciseg.get_df_node() for sciseg in enginenodes[0].scisegs.values()])
self.add_gracedb_log_node(respagenode,ugid,burst=True)
if self.config.has_option('resultspage','email'):
emailto=self.config.get('resultspage','email')
emailto=self.config.get('resultspage','email')
else:
emailto=None
emailto=None
temp_node=self.add_gracedb_info_node(respagenode,ugid,analysis='LIB',email=emailto)
if self.config.has_option('condor','ligo-skymap-plot') and self.config.has_option('condor','ligo-skymap-from-samples'):
if self.engine=='lalinferenceburst': prefix='LIB'
......@@ -1741,20 +1741,20 @@ class LALInferencePipelineDAG(pipeline.CondorDAG):
if self.config.getboolean('analysis','add-lvem-tag'):
tag='pe,lvem'
if burst is False:
node=GraceDBNode(self.gracedbjob,parent=respagenode,gid=gid,command='upload',tag=tag)
node.set_filename(respagenode.webpath+'/corner/extrinsic.png')
self.add_node(node)
nodes.append(node)
node=GraceDBNode(self.gracedbjob,parent=respagenode,gid=gid,command='upload',tag=tag)
node.set_filename(respagenode.webpath+'/corner/extrinsic.png')
self.add_node(node)
nodes.append(node)
node=GraceDBNode(self.gracedbjob,parent=respagenode,gid=gid,command='upload',tag='pe')
node.set_filename(respagenode.webpath+'/corner/intrinsic.png')
self.add_node(node)
nodes.append(node)
node=GraceDBNode(self.gracedbjob,parent=respagenode,gid=gid,command='upload',tag='pe')
node.set_filename(respagenode.webpath+'/corner/intrinsic.png')
self.add_node(node)
nodes.append(node)
node=GraceDBNode(self.gracedbjob,parent=respagenode,gid=gid,command='upload',tag='pe')
node.set_filename(respagenode.webpath+'/corner/sourceFrame.png')
self.add_node(node)
nodes.append(node)
node=GraceDBNode(self.gracedbjob,parent=respagenode,gid=gid,command='upload',tag='pe')
node.set_filename(respagenode.webpath+'/corner/sourceFrame.png')
self.add_node(node)
nodes.append(node)
return nodes
......@@ -1792,50 +1792,50 @@ class LALInferencePipelineDAG(pipeline.CondorDAG):
def add_gracedb_info_node(self,respagenode,gid,analysis='LALInference',issky=False,prefix="LIB",email=None):
# if issky=True, this node will upload the FITS file into GDB. BCI and BSN will be used to decide which tags to use
# Otherwise, this node will upload information about parameters and bayes factors
if respagenode is not None:
samples=respagenode.posfile
hdf5samples=respagenode.get_in_files()[0] # This should only be called by LIB, which only uses one file
else:
# Try to find it
resnodes=filter(lambda x: isinstance(x,ResultsPageNode) ,self.get_nodes())
for rs in resnodes:
if len(rs.ifos)>1:
respagenode=rs
# if issky=True, this node will upload the FITS file into GDB. BCI and BSN will be used to decide which tags to use
# Otherwise, this node will upload information about parameters and bayes factors
if respagenode is not None:
samples=respagenode.posfile
hdf5samples=respagenode.get_in_files()[0] # This should only be called by LIB, which only uses one file
if self.postruninfojob.isdefined is False:
return None
if issky is False:
node=PostRunInfoNode(self.postruninfojob,parent=respagenode,gid=gid,samples=hdf5samples)
if email is not None:
node.set_email(email)
else:
skynodes=filter(lambda x: isinstance(x,SkyMapNode) ,self.get_nodes())
for sk in skynodes:
skymap=sk.outdir+'/%s.fits'%prefix
message=' %s FITS sky map'%prefix
node=PostRunInfoNode(self.postruninfojob,parent=sk,gid=gid,samples=None)
node.set_skymap(skymap)
node.set_message(message)
bci=respagenode.get_bcifile()
if bci is not None:
node.set_bci(bci)
bsn=respagenode.get_bsnfile()
if bsn is not None:
node.set_bsn(bsn)
node.set_analysis(analysis)
node.finalize()
self.add_node(node)
return node
else:
# Try to find it
resnodes=filter(lambda x: isinstance(x,ResultsPageNode) ,self.get_nodes())
for rs in resnodes:
if len(rs.ifos)>1:
respagenode=rs
samples=respagenode.posfile
hdf5samples=respagenode.get_in_files()[0] # This should only be called by LIB, which only uses one file
if self.postruninfojob.isdefined is False:
return None
if issky is False:
node=PostRunInfoNode(self.postruninfojob,parent=respagenode,gid=gid,samples=hdf5samples)
if email is not None:
node.set_email(email)
else:
skynodes=filter(lambda x: isinstance(x,SkyMapNode) ,self.get_nodes())
for sk in skynodes:
skymap=sk.outdir+'/%s.fits'%prefix
message=' %s FITS sky map'%prefix
node=PostRunInfoNode(self.postruninfojob,parent=sk,gid=gid,samples=None)
node.set_skymap(skymap)
node.set_message(message)
bci=respagenode.get_bcifile()
if bci is not None:
node.set_bci(bci)
bsn=respagenode.get_bsnfile()
if bsn is not None:
node.set_bsn(bsn)
node.set_analysis(analysis)
node.finalize()
self.add_node(node)
return node
def add_rom_weights_node(self,ifo,parent=None):
#try:
#node=self.computeroqweightsnodes[ifo]
#try:
#node=self.computeroqweightsnodes[ifo]
#except KeyError:
node=ROMNode(self.computeroqweights_job,ifo,parent.seglen,parent.flows[ifo])
self.computeroqweightsnode[ifo]=node
......@@ -3033,22 +3033,22 @@ class PlotSkyMapNode(pipeline.CondorDAGNode):
super(PlotSkyMapNode,self).finalize()
class PostRunInfoJob(pipeline.CondorDAGJob,pipeline.AnalysisJob):
def __init__(self,cp,submitFile,logdir,dax=False):
self.isdefined=True
if not cp.has_option('condor','gdbinfo'):
self.isdefined=False
return
exe=cp.get('condor','gdbinfo')
pipeline.CondorDAGJob.__init__(self,"vanilla",exe)
pipeline.AnalysisJob.__init__(self,cp,dax=dax) # Job always runs locally
if cp.has_option('analysis','accounting_group'):
self.add_condor_cmd('accounting_group',cp.get('analysis','accounting_group'))
self.set_sub_file(os.path.abspath(submitFile))
self.set_stdout_file(os.path.join(logdir,'gdbinfo-$(cluster)-$(process).out'))
self.set_stderr_file(os.path.join(logdir,'gdbinfo-$(cluster)-$(process).err'))
self.add_condor_cmd('getenv','True')
self.add_condor_cmd('RequestMemory','1000')
def __init__(self,cp,submitFile,logdir,dax=False):
self.isdefined=True
if not cp.has_option('condor','gdbinfo'):
self.isdefined=False
return
exe=cp.get('condor','gdbinfo')
pipeline.CondorDAGJob.__init__(self,"vanilla",exe)
pipeline.AnalysisJob.__init__(self,cp,dax=dax) # Job always runs locally
if cp.has_option('analysis','accounting_group'):
self.add_condor_cmd('accounting_group',cp.get('analysis','accounting_group'))
self.set_sub_file(os.path.abspath(submitFile))
self.set_stdout_file(os.path.join(logdir,'gdbinfo-$(cluster)-$(process).out'))
self.set_stderr_file(os.path.join(logdir,'gdbinfo-$(cluster)-$(process).err'))
self.add_condor_cmd('getenv','True')
self.add_condor_cmd('RequestMemory','1000')
class PostRunInfoNode(pipeline.CondorDAGNode):
def __init__(self,post_run_info_job,gid=None,parent=None,samples=None):
......@@ -3065,23 +3065,21 @@ class PostRunInfoNode(pipeline.CondorDAGNode):
self.add_var_opt('analysis',self.analysis)
self.__finalized=True
def set_parent(self,parentnode):
self.add_parent(parentnode)
self.add_parent(parentnode)
def set_samples(self,samples):
if samples is not None:
self.add_var_arg('--samples %s'%samples)
if samples is not None:
self.add_var_arg('--samples %s'%samples)
def set_skymap(self,skymap):
self.add_var_arg('--skymap %s'%skymap)
def set_message(self,message):
self.add_var_arg("--message '%s'"%message)
def set_email(self,email):
self.add_var_arg('--email %s'%email)
self.add_var_arg('--email %s'%email)
def set_gid(self,gid):
self.add_var_opt('gid',gid)
self.add_var_opt('gid',gid)
def set_bci(self,bci):
self.add_file_opt('bci',bci)
self.add_file_opt('bci',bci)
def set_bsn(self,bsn):
self.add_file_opt('bsn',bsn)
self.add_file_opt('bsn',bsn)
def set_analysis(self,analysis):
self.analysis=analysis
self.analysis=analysis
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment