1

So I am following this example from dask documentation almost verbatim https://distributed.dask.org/en/stable/logging.html#task-transition-logs and but could not get it to work. Below is my code:

import dask
import time
import random
from dask_jobqueue import SLURMCluster
from distributed import Client

def dummy(x):
   time.sleep(5)
   return x

cluster = SLURMCluster(...) # you will need to put your queue name, cores, mem, etc...
client = Client(cluster)
f = client.submit(dummy, 2)
# we can sleep for a while for it to be finished

client.scheduler.story(f.key)
# client.scheduler.story(f) yields the same error

and I get this error:

TypeError: send_recv_from_rpc() takes 0 positional arguments but 1 was given on the line client.scheduler.story(f.key).

SultanOrazbayev
  • 14,900
  • 3
  • 16
  • 46
michaelgbj
  • 290
  • 1
  • 10
  • It's unclear from your code where the `send_recv_from_rpc` method is called. – Yehor Smoliakov May 11 '22 at 20:57
  • That is the error when `client.scheduler.story(f.key)` is called. – michaelgbj May 11 '22 at 20:59
  • API of the `story` method takes only regular arguments, not positional ones. – Yehor Smoliakov May 11 '22 at 21:06
  • can you clarify what is a "regular" argument in this case? And I updated the issue description with the link to the dask documentation that i followed verbatim. – michaelgbj May 11 '22 at 21:18
  • `f` variable is a Future so you need to implement the wait mechanism before you're calling the `story` method. Docs: https://docs.python.org/3/library/concurrent.futures.html – Yehor Smoliakov May 11 '22 at 21:23
  • as I mentioned in the comments. I manually waited for the Future to be in a 'finished' state, and it will still have the same error. – michaelgbj May 11 '22 at 21:26
  • Check this answer https://stackoverflow.com/a/1419159/5707560 about regular and positional arguments and check out the original code of the `story` method in the Scheduler class – Yehor Smoliakov May 11 '22 at 21:31
  • Let us [continue this discussion in chat](https://chat.stackoverflow.com/rooms/244678/discussion-between-michaelgbj-and-yehor-smoliakov). – michaelgbj May 11 '22 at 21:33

1 Answers1

1

You are very close, to access the scheduler use the client.cluster.scheduler, so the relevant code would look like this:

print(client.cluster.scheduler.story(f.key))
# print the story
SultanOrazbayev
  • 14,900
  • 3
  • 16
  • 46