Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expand async docs #2293

Merged
merged 4 commits into from
Nov 7, 2019
Merged

Expand async docs #2293

merged 4 commits into from
Nov 7, 2019

Conversation

dhirschfeld
Copy link
Contributor

@dhirschfeld dhirschfeld commented Oct 7, 2018

Closes #2085

I was a little confused how to run an async function using an existing Client object. This clarifies the documentation with the extra information provided by @mrocklin in #2085.

@dhirschfeld
Copy link
Contributor Author

If you don't think this is an improvement or necessary, feel free to close, otherwise I'm happy to make any requested changes.

@dhirschfeld dhirschfeld closed this Oct 8, 2018
@dhirschfeld dhirschfeld reopened this Oct 8, 2018
@dhirschfeld
Copy link
Contributor Author

Errors seem unrelated:

E       TypeError: 'DaskDistributedBackend' object is not iterable

@mrocklin
Copy link
Member

mrocklin commented Oct 8, 2018

See #2298

@dhirschfeld dhirschfeld closed this Nov 3, 2018
@dhirschfeld dhirschfeld reopened this Nov 3, 2018
@dhirschfeld
Copy link
Contributor Author

Looks like unrelated TLS errors this time.

@mrocklin
Copy link
Member

mrocklin commented Nov 3, 2018 via email

@@ -107,6 +107,23 @@ Python 3 with Tornado
from tornado.ioloop import IOLoop
IOLoop().run_sync(f)

If you want to reuse an externally created client you need to run the async
function using the clients loop which can be done with the ``Client.sync``
function - e.g.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Statements like reuse "externally created client" and "using the client's loop" seem odd to me. For the first I'm not sure why the client is external or why we're reusing it. I think that this is just a normal client. In the second case I don't think that we can expect all users to understand what an event loop is.

Instead, I recommend something like ...

If you want to use an asyncrhonous function with a synchronous client (one made without the asynchronous=True keyword) then you should use the Client.sync function.

I've also been warned off of using e.g. in docs. Apparently it's not universally understood by many people for whom English is not their first language.

I think that the example is great.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For me, it was just that I hadn't come across the sync function before so figured it could do with some more advertising. I'll make the suggested changes...

@dhirschfeld
Copy link
Contributor Author

@mrocklin - if I make the suggested change above would you be happy merging this? If not I guess we can close it...

@mrocklin
Copy link
Member

Sure. Sorry for the long delay in response. I'm just going through my e-mail backlog now.

@dhirschfeld
Copy link
Contributor Author

np - I'll try and find the time to updating this PR shortly...

Copy link
Member

@jrbourbeau jrbourbeau left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @dhirschfeld!

@jrbourbeau jrbourbeau merged commit d575ea0 into dask:master Nov 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Clarify async documentation
3 participants