Hello,
Background
I recently upgraded from distributed==2023.7.0
to distributed==2025.5.1
. Upon upgrading I found an interesting change that broke some of my workflows and looking to understand if there is a better way to deal with this.
Description
Originally, I would submit futures with specific keys from one client and access them from another. Usually this involved a cluster and multiple workers/machines.
Before I would be able to
- create a client in one terminal
- submit jobs from that terminal with specific keys
- connect to the scheduler made by that client in another terminal
- re-create the future in the other terminal using
Future(key)
- access result/status or even cancel future
Now it seems that I am unable to create a Future
object directly and the documentation suggests that I should not do so.
Question
Is there another way to deal with this?
Here is hopefully a reproducible example that you can try on both versions.
Example
in one terminal:
from distributed import Client, fire_and_forget
# create client
client = Client(scheduler_port=8786)
def func(x):
return x + 1
values = list(range(10))
keys = [f"key_{v}" for v in values]
futures = client.map(func, values, key=keys)
# sometimes would use fire and forget if in script rather than in a notebook
fire_and_forget(futures)
in another terminal
from distributed import Client, Future
# connect to previously made client
client = Client('localhost:8786')
# Re-create the futures from another client
futures = [Future(f'key_{v}') for v in range(10)]
# access status / result etc
futures[0].status
futures[0].result()
Thank you for your time. Please let me know if you have any ideas.
Best,
Nick