Skip to content

Fix check_call & problems with STDOUT/ERR messages #3

@raggleton

Description

@raggleton

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 😦

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions