Open eguiraud opened 1 year ago
(the patch is probably too intrusive and it does not really make sense for the notebook version of the script, so I'm not sure how to proceed -- there might be a better fix)
Thanks for raising this, we definitely need to find a better version that works with both notebook and script.
Does that patch work in the notebook as-is? I didn't think that the if __name__ == "__main__":
block could continue across cells. I was hoping that wrapping the functionality in run_processor()
is already enough by itself, does that fix the problem without the __main__
guard? If so, that would be easiest. If not, then I'm honestly not sure what to best do here.
Unfortunately just wrapping the processing in run_processor()
did not seem to help (but as I don't actually understand the underlying issue it could be that I missed something simple).
I updated the branch with the patch to a simpler version that just uses if __name__ == "__main__"
to avoid the confusion.
EDIT:
here's the simpler patch
Thinking about this some more: I imagine it is fine to only guard the cell (or even just the commands) where the coffea execution happens and then go back, like this:
... # all the other code
if __name__ == "__main__":
run.preprocess(fileset, ...)
run(fileset, ...)
... # all the rest
It is perhaps a bit unusual but this might be a minimally invasive solution, assuming it works as I imagine it does.
I switched to local execution by setting
AF: local
inconfig.yaml
. With that change,python ttbar_analysis_pipeline.py
is not able to run. It seems that the problem is linked to running the backend "at global scope": this patch that puts all of the data processing underif __name__ == "__main__"
fixes the problem.The actual error:
with this traceback: