-
Notifications
You must be signed in to change notification settings - Fork 11
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
Set exit code of b2luigi.process
according to pipeline result, not scheduling result
#110
Comments
Maybe you can take a look at B2LuigiTestCase and as an example of how to use it at our test_batch_process.py. |
Ah, thanks for the suggestion, I didn't think of looking into your own unit tests. Your solution requires a bit more boiler plate (separate steering file, subprocess call and all), but it probably is the cleanest solution and doesn't require any modifications to the code. Let me close this :) Edit: Okay, actually it does the same "This progress looks :)" hack as me :) |
:) |
Another thing where this comes up though is when chaining job completion to some other bash commands. Ideally I'd like to do |
Tbh I know that feeling, in the past I was quite annoyed about gbasf2 because it didn't set proper exit codes on failure. Haven't done bash chaining with b2luigi scripts yet, because for that I'd usually just use another b2luigi task. I haven't tested it yet, but shouldn't something like the following work? main_task = MainTask() # b2luigi wrapper task
b2luigi.process(main_task)
if not main_task.complete(): # tests if all outputs exist
raise RuntimeError("Processing did not complete task") # or just: sys.exit(1) |
So just a bit of background, why (b2)luigi does not give a non-zero error code: for luigi, the work is "successful" in the sense that it could correctly build the task DAG, execute it and finish up. The result was negative, but that is not luigi's concern (see e.g. here). However, I like your suggestion, @meliache. Internally, luigi seems to produce a |
b2luigi.process
according to pipeline result, not scheduling result
I'm using
pytest
and want to also test my full luigi pipeline. Currently I'm facing two issues here:process
more than once: Once there is more than one test, b2luigi will make a fuzz about multipleprocess
calls.process
doesn't return exit code: Is there a clever way to figure out if the tasks ran successfully?Currently I'm using two workarounds, neither of which are particularly pretty:
This works fine, but eventually prettier solutions would be nice of course.
I also wanted to open this issue to document the workarounds. I could also open a PR for some documentation on that if you want.
The text was updated successfully, but these errors were encountered: