Nullman
Nullman

Reputation: 4279

how to access members of processed futures in distributed dask

I'm trying to access the members of a class that I initialized in the cluster

B = client.submit(KDTree, A)

where A is some list of numbers already in the cluster and KDTree is this now i want to call query_ball_point method of the kdtree i made on a further list, but how do i do that in the cluster? best i managed to figure out is to use this as a function to map

lambda x:B.result().query_ball_point(x, 5)

but that cant be right, can it?
maybe the answer to this is in the docs but i can't seem to google the right thing, what is this action called?

Upvotes: 0

Views: 84

Answers (1)

MRocklin
MRocklin

Reputation: 57281

You can pass futures into other submit calls

A_future = client.submit(KDTree, A)

def func(kd_tree, x):
    return kd_tree.query_ball_point(x, 5)

x = client.submit(func, A_future, x)  # or use map here or whatnot

Upvotes: 1

Related Questions