ganga-devs / ganga

Ganga is an easy-to-use frontend for job definition and management
GNU General Public License v3.0
100 stars 159 forks source link

Un-friendly errors when there is a mis-configuration #1144

Closed cvazquezs closed 6 years ago

cvazquezs commented 7 years ago

I tried to run a LHCbTask (script below) and I got the following error:

ERROR    Exception occurred in task monitoring loop: <type 'exceptions.AttributeError'> 'NoneType' object has no attribute 'n_tosub'
The offending task was paused.
ERROR    Full traceback:
 Traceback (most recent call last):
   File "/cvmfs/ganga.cern.ch/Ganga/install/6.7.2/python/Ganga/GPIDev/Lib/Tasks/TaskRegistry.py", line 92, in _thread_main
    p.update()
   File "/cvmfs/ganga.cern.ch/Ganga/install/6.7.2/python/Ganga/GPIDev/Lib/Tasks/ITask.py", line 98, in update
    if trf.update() and not self.check_all_trfs:
   File "/cvmfs/ganga.cern.ch/Ganga/install/6.7.2/python/Ganga/GPIDev/Lib/Tasks/ITransform.py", line 224, in update
    unit_status["bad"], self._getParent().n_tosub())
 AttributeError: 'NoneType' object has no attribute 'n_tosub' 

At a first glance I had literally no idea on what was going on. I think this kind of

errors should raise a more friendly and understandable error message which can provide useful feedback for the users.

Thanks! Carlos

'''
Generate a local MC production for a given event type

@author Miguel Ramos Pernas
'''

#
#    L o c a l    M C   p r o d u c t i o n           [sim09b  /  2016 MC  /  Stripping26]
#______________________________________________

# Run 200k - 100k per magnet.

runInAFS = False

EventType     = "43900075"
fileType      = 'DST'
evtsPerJob    = 1000
nJobs         = 1 # 100
magnet        = 'Down'
gaussVersion  = 'v49r8'
booleVersion  = 'v30r2'#p1'
mooreVersion  = 'v25r4'
brunelVersion = 'v50r2'
dvVersion     = 'v42r5p1'

decays = {'43900075' : 'mH125mA10tA10'}

decay = decays[EventType]

if magnet == 'Up':
    magnetconds = 'CondMagUp.py'
    polarity    = 'mu'
else:
    magnetconds = 'CondMagDown.py'
    polarity    = 'md'

nEvents      = evtsPerJob*nJobs
print '***', nEvents, 'events will be generated ***'

task         = LHCbTask()
task.name    = decay + "_Mag" + magnet
task.comment = "Local Production task"
task.float   = 10

import os
if runInAFS:
    software_path = '/afs/cern.ch/lhcb/software/releases/'
else:
    software_path = '/cvmfs/lhcb.cern.ch/lib/lhcb/'
APPCONFIGOPTS = software_path + "DBASE/AppConfig/v3r310/options"
#DECFILESROOT  = software_path + "DBASE/Gen/DecFiles/v29r14"
LBPYTHIA8ROOT = software_path + "GAUSS/GAUSS_"+gaussVersion+"/Gen/LbPythia8"
WORKSPACE     = os.getcwd()
DECFILESROOT = WORKSPACE

def genDiracBackend():
    '''
    Generate the Dirac backend, banning some sites
    '''
    backend = Dirac()
    backend.settings['BannedSites'] = ['LCG.RAL.uk', 'LCG.RAL-HEP.uk']
    return backend

availableSE = ['CBPF-USER', 'CERN-USER', 'CNAF-USER', 'CNAF-USER-2', 'CPPM-USER', 'GRIDKA-USER', 'IHEP-USER', 'IMPERIAL-USER', 'IN2P3-USER', 'IN2P3-USER-2', 'LAL-USER', 'Manchester-USER', 'NCBJ-USER', 'PIC-USER', 'SARA-USER']

#    G a u s s 

step1 = LHCbTransform(name="step1_Gauss",backend=genDiracBackend())
step1.application = Gauss(version = gaussVersion, platform = "x86_64-slc6-gcc48-opt")
step1.application.optsfile = [  
                File(APPCONFIGOPTS + "/Gauss/Beam6500GeV-"+polarity+"100-2016-nu1.6.py"),
                File(APPCONFIGOPTS + "/Gauss/EnableSpillover-25ns.py"),
                File(APPCONFIGOPTS + "/Gauss/DataType-2016.py"),
                File(APPCONFIGOPTS + "/Gauss/RICHRandomHits.py"),
                File(APPCONFIGOPTS + "/Gauss/G4PL_FTFP_BERT_EmNoCuts.py"),
                File(APPCONFIGOPTS + "/Persistency/Compression-ZLIB-1.py"),

                File(DECFILESROOT  + "/options/" + EventType + ".py"),
                File(LBPYTHIA8ROOT + "/options/Pythia8.py"),

                File(WORKSPACE + "/" + magnetconds)

                         ]

step1.application.extraopts = 'from Configurables import Gauss\n'\
    'from Gauss.Configuration import *\n'\
    'nEvts = ' + str(evtsPerJob) + '\n'\
    'LHCbApp().EvtMax = nEvts\n'

step1.mc_num_units = 1

step1.splitter = GaussSplitter(numberOfJobs=nJobs, eventsPerJob=evtsPerJob)
step1.outputfiles = [DiracFile("*.sim", locations = availableSE), LocalFile("*.root"), LocalFile("*.xml")]
step1.inputfiles = [LocalFile(WORKSPACE + "/decfiles/*.dec")]
task.appendTransform(step1)

#    B o o l e

step2 = LHCbTransform(name="step2_Boole",backend=genDiracBackend())
step2.application = Boole(version = booleVersion, platform = "x86_64-slc6-gcc49-opt")
step2.application.optsfile = [  File(APPCONFIGOPTS + "/Boole/Default.py"),
                            File(APPCONFIGOPTS + "/Boole/EnableSpillover.py"),
                            File(APPCONFIGOPTS + "/Boole/DataType-2015.py"),
                            File(APPCONFIGOPTS + "/Boole/Boole-SetOdinRndTrigger.py"),
                            File(APPCONFIGOPTS + "/Persistency/Compression-ZLIB-1.py"),
                            File(WORKSPACE + "/" + magnetconds)
                         ]
datalink = TaskChainInput()
datalink.include_file_mask = ['\.sim$']
datalink.input_trf_id = step1.getID()
step2.addInputData(datalink)
step2.outputfiles = [DiracFile("*.digi", locations = availableSE), LocalFile("*.root"), LocalFile("*.xml")]
task.appendTransform(step2)

#    M o o r e    L 0

step3 = LHCbTransform(name="step3_Moore_L0",backend=genDiracBackend())
step3.application = Moore(version = mooreVersion, platform = "x86_64-slc6-gcc48-opt")
step3.application.optsfile = [  
                File(APPCONFIGOPTS + "/L0App/L0AppSimProduction.py"),
                            File(APPCONFIGOPTS + "/L0App/L0AppTCK-0x160F.py"),
                            File(APPCONFIGOPTS + "/L0App/ForceLUTVersionV8.py"),
                            File(APPCONFIGOPTS + "/L0App/DataType-2016.py"),
                            File(APPCONFIGOPTS + "/Persistency/Compression-ZLIB-1.py"),
                            File(WORKSPACE + "/CondL0.py"),
                            File(WORKSPACE + "/" + magnetconds)
                         ]
datalink = TaskChainInput()
datalink.include_file_mask = ['\.digi$']
datalink.input_trf_id = step2.getID()
step3.addInputData(datalink)
step3.outputfiles = [DiracFile("*.digi", locations = availableSE)]
step3.delete_chain_input = True
task.appendTransform(step3)

#    M o o r e   H l t 1

step4 = LHCbTransform(name="step4_Moore_Hlt1",backend=genDiracBackend())
step4.application = Moore(version = mooreVersion, platform = "x86_64-slc6-gcc48-opt")
step4.application.optsfile = [  
                File(APPCONFIGOPTS + "/Moore/MooreSimProductionForSeparateL0AppStep2015.py"),
                            File(APPCONFIGOPTS + "/Conditions/TCK-0x5138160F.py"),
                            File(APPCONFIGOPTS + "/Moore/MooreSimProductionHlt1.py"),
                            File(APPCONFIGOPTS + "/Moore/DataType-2016.py"),
                            File(APPCONFIGOPTS + "/Persistency/Compression-ZLIB-1.py"),
                                File(WORKSPACE + "/CondHlt1.py"),
                            File(WORKSPACE + "/" + magnetconds)
                         ]
datalink = TaskChainInput()
datalink.include_file_mask = ['\.digi$']
datalink.input_trf_id = step3.getID()
step4.addInputData(datalink)
step4.outputfiles = [DiracFile("*.digi", locations = availableSE)]
step4.delete_chain_input = True
task.appendTransform(step4)

#    M o o r e   H l t 2

step5 = LHCbTransform(name="step5_Moore_Hlt2",backend=genDiracBackend())
step5.application = Moore(version = mooreVersion, platform = "x86_64-slc6-gcc48-opt")
step5.application.optsfile = [  
                File(APPCONFIGOPTS + "/Moore/MooreSimProductionForSeparateL0AppStep2015.py"),
                            File(APPCONFIGOPTS + "/Conditions/TCK-0x6139160F.py"),
                            File(APPCONFIGOPTS + "/Moore/MooreSimProductionHlt2.py"),
                            File(APPCONFIGOPTS + "/Moore/DataType-2016.py"),
                            File(APPCONFIGOPTS + "/Persistency/Compression-ZLIB-1.py"),
                                File(WORKSPACE + "/CondHlt2.py"),
                            File(WORKSPACE + "/" + magnetconds)
                         ]
datalink = TaskChainInput()
datalink.include_file_mask = ['\.digi$']
datalink.input_trf_id = step4.getID()
step5.addInputData(datalink)
step5.outputfiles = [DiracFile("*.digi", locations = availableSE), LocalFile("*.root"), LocalFile("*.xml")]
step5.delete_chain_input = True
task.appendTransform(step5)

#    B r u n e l 

step6 = LHCbTransform(name="step6_Brunel",backend=genDiracBackend())
step6.application = Brunel(version = brunelVersion, platform = "x86_64-slc6-gcc49-opt")
step6.application.optsfile =  [ 
                File(APPCONFIGOPTS + "/Brunel/MC-WithTruth.py"),
                            File(APPCONFIGOPTS + "/Brunel/DataType-2016.py"),
                            File(APPCONFIGOPTS + "/Persistency/Compression-ZLIB-1.py"),
                            File(WORKSPACE + "/" + magnetconds)
                         ]
datalink = TaskChainInput()
datalink.include_file_mask = ['\.digi$']
datalink.input_trf_id = step5.getID()
step6.addInputData(datalink)
step6.outputfiles = [DiracFile("*.dst", locations = availableSE), DiracFile("*.ldst", locations = availableSE), LocalFile("*.root"), LocalFile("*.xml")]
step6.delete_chain_input = True
task.appendTransform(step6)

#    D a V i n c i 

step7 = LHCbTransform(name="step7_DaVinci",backend=genDiracBackend())
step7.application = DaVinci(version = dvVersion, platform = "x86_64-slc6-gcc48-opt")
step7.application.optsfile = [  
                File(APPCONFIGOPTS + "/DaVinci/DV-Stripping26-Stripping-MC-NoPrescaling-%s.py" %fileType),
                            File(APPCONFIGOPTS + "/DaVinci/DataType-2016.py"),
                            File(APPCONFIGOPTS + "/DaVinci/InputType-%s.py" %fileType),
                            File(WORKSPACE + "/" + magnetconds)
                         ]
datalink = TaskChainInput()
datalink.include_file_mask = ['\.dst$', '\.ldst$']
datalink.input_trf_id = step6.getID()
step7.addInputData(datalink)
step7.outputfiles = [LocalFile("*.dst"), DiracFile("*.ldst", locations = availableSE), LocalFile("*.root"), LocalFile("*.xml")]
step7.delete_chain_input = True
task.appendTransform(step7)

task.run()
mesmith75 commented 6 years ago

@cvazquezs Thanks for reporting this. It looks to be a ganga bug rather than a user error.

mesmith75 commented 6 years ago

Fixed by #1216