You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is a proof of concept script how to use the futures api of dask to support the writing of results into a trajectory while still working on frames in parallel. It won't scale out a lot. It also assumes that the single_frame function returns a namedtuple with coordinates. The buffer can potentially blow up so use with care.
defdask_execution(single_frame, trajectory, client)
# have writer in main processwithWriterasw:
futures=client.map(single_frame, trajectory)
idx=0forfinas_completed(futures):
res=f.result()
buf[res.frame] =res.xyz# check if we got a result to writewhileTrue:
# write everything we can *in order*ifidxinbuf:
w.write(buf[idx])
delbuf[idx]
idx+=1# we can't write anything so breakelse:
break# write leftover framesforiinsorted(buf):
w.write(buf[i])
The text was updated successfully, but these errors were encountered:
This is a proof of concept script how to use the futures api of dask to support the writing of results into a trajectory while still working on frames in parallel. It won't scale out a lot. It also assumes that the
single_frame
function returns a namedtuple with coordinates. The buffer can potentially blow up so use with care.The text was updated successfully, but these errors were encountered: