<div dir="ltr">Hi,<div><br></div><div>Thanks for the responses. Putting it in a small example</div><div><br></div><div>def flow_factory(tmp):<br></div><div><div> return lf.Flow('resume from backend example').add(</div><div> TestTask(name='first', test=tmp),</div><div> InterruptTask(name='boom'),</div><div> TestTask(name='second', test="second task"))</div></div><div><br></div><div><br></div><div><div>class TestTask(task.Task):</div><div> def __init__(self, name, provides=None, test, **kwargs):</div><div> self.test=test</div><div> super(TestTask, self).__init__(name, provides, **kwargs)</div><div> def execute(self, *args, **kwargs):</div><div> print('executing %s' % self)</div><div> return 'ok'<br></div></div><div><br></div><div><div>class InterruptTask(task.Task):</div><div> def execute(self, *args, **kwargs):</div><div> # DO NOT TRY THIS AT HOME</div><div> engine.suspend()<br></div><div><br></div></div><div>I was searching for a way in which I can reload the flow after crash without passing the parameter "tmp" shown above</div><div>Looks like "load_from_factory" gives this provision.<br></div><div><br></div><div><div><br></div><div>engine = taskflow.engines.load_from_factory(flow_factory=flow_factory, factory_kwargs={"tmp":"test_data"}, book=book, backend=backend)<br></div></div><div>engine.run()</div><div><br></div><div>Now it suspends after running interrupt task, I can now reload the flow from the saved factory method without passing parameter again.</div><div><div>for flow_detail_2 in book:</div><div> engine2 = taskflow.engines.load_from_detail(flow_detail_2, backend=backend)</div></div><div><br></div><div>engine2.run()</div><div><br></div><div>Let me know if this is ok or is there a better approach to achieve this?</div><div><br></div><div>-Thanks</div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Jan 27, 2016 at 12:03 AM, Joshua Harlow <span dir="ltr"><<a href="mailto:harlowja@fastmail.com" target="_blank">harlowja@fastmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi there,<br>
<br>
Michał is correct, it should be saved.<br>
<br>
Do u have a small example of what u are trying to do because that will help determine if what u are doing will be saved or whether it will not be.<br>
<br>
Or even possibly explaining what is being done would be fine to (more data/info for me to reason about what should be stored in your case).<br>
<br>
Thanks,<br>
<br>
Josh<div class="HOEnZb"><div class="h5"><br>
<br>
Michał Dulko wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
On 01/26/2016 10:23 AM, pn kk wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi,<br>
<br>
I use taskflow for job management and now trying to persist the state<br>
of flows/tasks in mysql to recover incase of process crashes.<br>
<br>
I could see the state and the task results stored in the database.<br>
<br>
Now I am looking for some way to store the input parameters of the tasks.<br>
<br>
Please share your inputs to achieve this.<br>
<br>
-Thanks<br>
<br>
</blockquote>
I've played with that some time ago and if I recall correctly input<br>
parameters should be available in the flow's storage, which means these<br>
are also saved to the DB. Take a look on resume_workflows method on my<br>
old PoC [1] (hopefully TaskFlow haven't changed much since then).<br>
<br>
[1] <a href="https://review.openstack.org/#/c/152200/4/cinder/scheduler/manager.py" rel="noreferrer" target="_blank">https://review.openstack.org/#/c/152200/4/cinder/scheduler/manager.py</a><br>
<br>
__________________________________________________________________________<br>
OpenStack Development Mailing List (not for usage questions)<br>
Unsubscribe: <a href="http://OpenStack-dev-request@lists.openstack.org?subject:unsubscribe" rel="noreferrer" target="_blank">OpenStack-dev-request@lists.openstack.org?subject:unsubscribe</a><br>
<a href="http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev" rel="noreferrer" target="_blank">http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev</a><br>
</blockquote>
<br>
__________________________________________________________________________<br>
OpenStack Development Mailing List (not for usage questions)<br>
Unsubscribe: <a href="http://OpenStack-dev-request@lists.openstack.org?subject:unsubscribe" rel="noreferrer" target="_blank">OpenStack-dev-request@lists.openstack.org?subject:unsubscribe</a><br>
<a href="http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev" rel="noreferrer" target="_blank">http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev</a><br>
</div></div></blockquote></div><br></div>