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

RFC: Rename Future to Task in public facing interface #8028

Open
mrocklin opened this issue Jul 20, 2023 · 6 comments · May be fixed by #8497
Open

RFC: Rename Future to Task in public facing interface #8028

mrocklin opened this issue Jul 20, 2023 · 6 comments · May be fixed by #8497
Assignees

Comments

@mrocklin
Copy link
Member

Please don't make too much of this issue. This is mostly to start a conversation.

I spent the week with a bunch of folks who are less sophisticated than our typical users, but who really need something very much like Dask. It was educational.

My sense is that our usual idiom:

future = client.submit(func, *args, **kwargs)

... is kinda weird for them. Passing the function as an argument is strange (another proposal for that in #7936). Also, folks mentioned that the term "future" doesn't really make any sense to them. Instead, the term "task" made more sense. This doesn't seem unreasonable. We chose the term future to be consistent with the concurrent.futures module, which is mostly just known by devs.

I'll leave the decorator stuff for another conversation, but here I'd like to propose the following cosmetic API change:

>>> task = client.submit(func, *args, **kwrags)
>>> task
<Task: pending, key: func-1234>

>>> task.result()
...
@hendrikmakait
Copy link
Member

hendrikmakait commented Jul 24, 2023

+1. In general, this fits nicely into our nomenclature: A Task is the result of submitting something to a distributed task scheduler. Its result is calculated from a task graph.

We can still call it a Future-like akin to asyncio.Task to keep the reference for developers.

@fjetter
Copy link
Member

fjetter commented Jul 25, 2023

I actually don't have a very strong opinion here. I'm mildly concerned about confusion internally and about migration efforts (for users). If we believe this is worth it, I'm fine with it.

If we choose to rename Futures we might also want to reconsider renaming or aliasing submit as well. In the context of tasks, it is often talked about creating a task asyncio, for instance, uses asyncio.create_task

@mrocklin
Copy link
Member Author

I don't think that we should rely on asyncio as a model of intuitive behavior 🙂

My mental model of a naive user finds "submitting a task" and "creating a task" to be similar in terms of complexity. My gut reaction is to leave submit alone for now.

I'm mildly concerned about confusion internally and about migration efforts (for users).

My sense is that we can probably leave aliases here for a long time.

@mrocklin
Copy link
Member Author

cc @jacobtomlinson and @jrbourbeau for when he gets back

@jacobtomlinson
Copy link
Member

Yeah I like this idea. I spend a lot of time thinking about tasks in an async context and I think Dask could totally adopt the same thing. While I agree we shouldn't use asyncio as a model of intuitive behaviour I do think async programming in general has some common terminology that we could use. I like the call_soon method from trio/anyio's task groups too.

I think being able to talk about the "Tasks API" rather than the "Futures API" will be more accessible to new users when teaching too.

@mrocklin
Copy link
Member Author

mrocklin commented Dec 5, 2023

@fjetter is this something that someone on your team can do, maybe early in 2024?

Alternatively @jacobtomlinson maybe this is something that people in NVIDIA want to help with? It seems like a pretty accessible task.

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 a pull request may close this issue.

5 participants