[Openstack] [TaskFlow] Is there any way to retrieve the `flow_uuid` in the `Task`?
timon86.wang at gmail.com
Fri May 23 04:42:20 UTC 2014
Thanks Josh, looking forward the v0.3 release :)
So for now I should pass the flow_id to the task constructor instead,
in case of distributed manner (or maybe resume from database?).
On Fri, May 23, 2014 at 1:09 AM, Joshua Harlow <harlowja at yahoo-inc.com> wrote:
> Hi Timon,
> A good question :)
> In general tasks aren't very aware of the flow they are running in, mainly
> on purpose since flows are really just a 'container' of tasks that impose
> constraints on how the tasks inside it run (for example a linear_flow as u
> are using imposes a linearity constraint on the tasks contained inside it).
> If its still needed there are a few ways to do this. U have found one of
> them, passing it in via the task constructor method. This I think is fine
> if u are ok with not running those tasks later in a remote/distributed
> manner (since the logger resource object can't be sent across remote
> Another way to do this is to use the transient feature of the engines
> storage that should be released in 0.3 (this will come out soon). This
> would allow your task to have the following function definition and have
> it not have to be passed in via the task constructor (instead the logger
> argument will become a execution time dependency that will be grabbed from
> the storage interface).
> def execute(self, a, b, c, logger):
> A third method is to use the listener interface and use that instead
> (although this will be a less granular logging approach). There are some
> examples and usage details @
> d-logging-listeners that might be useful for u. Combining this listener
> approach with a tasks ability to update its own status/progress might
> just do the trick for u.
> If none of these work for u, feel free to jump on
> #openstack-state-management and we can think of other ways to do this :)
>  https://github.com/openstack/taskflow/blob/master/taskflow/task.py#L78
> -----Original Message-----
> From: Timon Wong <timon86.wang at gmail.com>
> Date: Wednesday, May 21, 2014 at 11:17 PM
> To: "openstack at lists.openstack.org" <openstack at lists.openstack.org>
> Subject: [Openstack] [TaskFlow] Is there any way to retrieve the
> `flow_uuid` in the `Task`?
>>For logging purpose, I wanna log the `flow_uuid` as a context to
>>indicate which flow the logging message related to.
>>Currently, I just created a logging adapter, grab the `uuid` from the
>>`flow_details`, the pass them as a constructor param like this:
>>flow = linear_flow.Flow(flow_name)
>>flow_detail = p_utils.create_flow_detail(flow)
>>logger = create_logger_adpater(flow_detail.uuid)
>>Is there any better way to do that?
>>Thanks in advance!
>>Post to : openstack at lists.openstack.org
More information about the Openstack