Open chenray844 opened 6 years ago
Hi, I am not sure what exactly @gavento meant by this todo list item. However, we should implement something like your suggestion. So "await" API should go on our list explicitly. We are now both on a vacation, so I will look at it more next week.
On 11 July 2018 11:05:16 CEST, Raymond Chen notifications@github.com wrote:
@all
hi all: I have read the doc on https://substantic.github.io/rain/docs/index.html.
The example given in
get-started
as belowfrom rain.client import Client, tasks, blob # Connect to server client = Client("localhost", 7210) # Create a new session with client.new_session() as session: # Create task (and two data objects) task = tasks.Concat((blob("Hello "), blob("world!"),)) # Mark that the output should be kept after submit task.output.keep() # Submit all crated tasks to server session.submit() # Wait for completion of task and fetch results and get it as bytes result = task.output.fetch().get_bytes() # Prints 'Hello world!' print(result)
This is so amusing.
But
Python3.5+
supportasync/await
syntax, does this project support this syntax?in roadmap I find this task
Update in the Python API (using aiohttp for async API) (@gavento) [medium]
. Is it in order to support `async/await1 syntax?After supporting
async/await
syntax, the example maybe shows as belowfrom rain.client import Client, tasks, blob # Connect to server client = Client("localhost", 7210) # Create a new session async with client.new_session() as session: # Create task (and two data objects) task = tasks.Concat((blob("Hello "), blob("world!"),)) # Mark that the output should be kept after submit task.output.keep() # Submit all crated tasks to server session.submit() # Wait for completion of task and fetch results and get it as bytes result = await task.output.fetch().get_bytes() # Prints 'Hello world!' print(result)
-- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/substantic/rain/issues/74
-- Sent from my Android device with K-9 Mail. Please excuse my brevity.
I have made a quick look on Python3 futures and I do not see how to simply combine futures and capnp promises (however it may still need only few lines of code, but I do not see deep into both). So if someone did not make combination of futures and promises, it has to wait until we did not finish removing of capnp from the client. Nevertheless, async/await API should be definitely part of our API.
@all
hi all: I have read the doc on https://substantic.github.io/rain/docs/index.html.
The example given in
get-started
as belowThis is so amusing.
But
Python3.5+
supportasync/await
syntax, does this project support this syntax?in roadmap I find this task
Update in the Python API (using aiohttp for async API) (@gavento) [medium]
. Is it in order to support `async/await1 syntax?After supporting
async/await
syntax, the example maybe shows as below