You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@libcloud.apache.org by tonybaloney <gi...@git.apache.org> on 2017/04/02 11:45:57 UTC
[GitHub] libcloud pull request #1016: [RFC] Option 1 for an async API to libcloud
GitHub user tonybaloney opened a pull request:
https://github.com/apache/libcloud/pull/1016
[RFC] Option 1 for an async API to libcloud
This is one option for having asynchronous support in libcloud.
The idea is to have a `async` context manager, that takes either a single instane, or a collection (tuple) of `NodeDrivers`, then provides the user with the ability to await common methods like `list_nodes` and `create_node`.
```python
import asyncio
from integration.driver.test import TestNodeDriver
from libcloud.async_util import AsyncSession
driver = TestNodeDriver('apache', 'libcloud', secure=False,
host='localhost', port=9898)
async def run():
async with AsyncSession(driver) as async_instance:
nodes = await async_instance.list_nodes()
assert len(nodes) == 2
loop = asyncio.get_event_loop()
loop.run_until_complete(run())
loop.close()
```
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/tonybaloney/libcloud async
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/libcloud/pull/1016.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #1016
----
commit 71f4356ebd7f7facc92474f5225ae3a68daeb930
Author: Anthony Shaw <an...@apache.org>
Date: 2017-04-02T10:44:56Z
add async context manager
commit 1d7dec24921822f09ad15d7772127319942e6a41
Author: Anthony Shaw <an...@apache.org>
Date: 2017-04-02T10:55:19Z
Merge branch 'integration_testing' into async
commit 5b06c20650abb6b024c340b648ad1499b3866786
Author: Anthony Shaw <an...@apache.org>
Date: 2017-04-02T11:36:16Z
add a basic async method for list_nodes and an example
commit d15a23762dd88807f7169cc2eb42ee42754b1959
Author: Anthony Shaw <an...@apache.org>
Date: 2017-04-02T11:43:05Z
Merge branch 'trunk' into async
----
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] libcloud pull request #1016: [RFC] Option 1 for an async API to libcloud
Posted by tonybaloney <gi...@git.apache.org>.
Github user tonybaloney closed the pull request at:
https://github.com/apache/libcloud/pull/1016
---