Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix check_call & problems with STDOUT/ERR messages #3

Open
raggleton opened this issue May 25, 2016 · 0 comments
Open

Fix check_call & problems with STDOUT/ERR messages #3

raggleton opened this issue May 25, 2016 · 0 comments

Comments

@raggleton
Copy link
Owner

raggleton commented May 25, 2016

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 😦

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant