[openstack-dev] Future-based api for openstack clients calls, that starts background tasks

Boris Pavlovic bpavlovic at mirantis.com
Mon Jan 12 11:42:37 UTC 2015


Konstantin,


I believe it's better to work on server side, and use some modern approach
like web sockets for async operations. So we won't need to retrieve 100500
times information about object. And then use this feature in clients.

 create_future = novaclient.servers.create_async(....)
>     .....
>     vm = create_future.result()


As well this pattern doesn't look great.

I would prefer to see something like:

  vm = novaclient.servers.create(...., sync=True)


Best regards,
Boris Pavlovic





On Mon, Jan 12, 2015 at 2:30 PM, Konstantin Danilov <kdanilov at mirantis.com>
wrote:

> Hi all.
>
> There a set of openstack api functions which starts background actions
> and return preliminary results - like 'novaclient.create'. Those functions
> requires periodically check results and handle timeouts/errors
> (and often cleanup + restart help to fix an error).
>
> Check/retry/cleanup code duplicated over a lot of core projects.
> As examples - heat, tempest, rally, etc and definitely in many third-party
> scripts.
>
> I propose to provide common higth-level API for such functions, which uses
> 'futures' (http://en.wikipedia.org/wiki/Futures_and_promises) as a way to
> present background task.
>
> Idea is to add to each background-task-starter function a complimentary
> call,
> that returns 'future' object. E.g.
>
>     create_future = novaclient.servers.create_async(....)
>     .....
>     vm = create_future.result()
>
> This allows to unify(and optimize) monitoring cycles, retries, etc.
> Please found complete BP at
> https://github.com/koder-ua/os_api/blob/master/README.md
>
> Thanks
> --
> Kostiantyn Danilov aka koder <http://koder.ua>
> Principal software engineer, Mirantis
>
> skype:koder.ua
> http://koder-ua.blogspot.com/
> http://mirantis.com
>
> __________________________________________________________________________
> OpenStack Development Mailing List (not for usage questions)
> Unsubscribe: OpenStack-dev-request at lists.openstack.org?subject:unsubscribe
> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack-dev/attachments/20150112/e76c6884/attachment.html>


More information about the OpenStack-dev mailing list