-
Notifications
You must be signed in to change notification settings - Fork 5
Open
Labels
Description
Currently, any call to outside commands (e.g. hadoop) uses subprocess.check_call. This has the upside of quitting when the command fails, but the downside of producing an unhelpful error message:
subprocess.CalledProcessError: Command '['hadoop', 'fs', '-copyFromLocal', '-f',
'/condor/condor/dir_654123/scratch/workspace/results/ntuple_55.root',
'/TopQuarkGroup/phxlk/ntuple/v0.0.1/Spring16/SingleElectron_Run2016B_PromptReco/SingleElectron_Run2016B_PromptReco/job_55/ntuple_55.root']'
returned non-zero exit status 1
It also doesn't integrate well with the logging module. And sometimes you don't want it to quit, just print the error message and carry on (e.g. post-running file transfer).
Suggestion from @kreczko: https://github.com/kreczko/NTupleProduction/blob/Spring16/python/ntp/interpreter.py#L283
NB to retain Python2.6 compatibility (the default on soolin), we can't use subprocess.check_output 😦