I am trying to wrap my head around why Task.run() is called more than once when you yield one or more tasks from it.
As per the docs:
"the Task.run method will resume from scratch each time a new task is yielded"
This seems like completely counter-intuitive behavior. Since using yield preserves the state of the local method, and run() just resumes after the sub-tasks are completed, why would I want Luigi to call my run() method a second time?
What's more is that it does not seem to check my output() or complete() method to see if run() would actually need to be called again, which seems doubly bizaare.
Can someone explain the thinking here? Because it makes no sense to me.
--Jeremy
--
You received this message because you are subscribed to the Google Groups "Luigi" group.
To unsubscribe from this group and stop receiving emails from it, send an email to luigi-user+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
def my_generator_function():print('start of my_generator_function')for i in (1,2,3,4,5):yield iprint('end of my_generator_function')def my_handler_function(max_value):print('start of my_handler_function; max_value={}'.format(max_value))for n in my_generator_function():if n > max_value:breakprint(n)print('end of my_handler_function')my_handler_function(5)my_handler_function(3)
start of my_handler_function; max_value=5start of my_generator_function12345end of my_generator_functionend of my_handler_functionstart of my_handler_function; max_value=3start of my_generator_function123end of my_handler_function