Skip to content

Commit

Permalink
dask delayed voorbeeld
Browse files Browse the repository at this point in the history
  • Loading branch information
wvangerwen committed May 30, 2024
1 parent ee54ac2 commit 2ddc05d
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions tests/rioxarraytesting/ztest_klimaatsommen_prep_MP.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,26 +133,24 @@ def create_depth(scenario):

# %%
import time

import dask


a = time.time()
@dask.delayed
def square(x):
time.sleep(5)
# return x**2


numbers = [1, 2, 3, 4, 5]
now = time.time() - a
print(f"{round(now,1)} {x} start")
time.sleep(x)
return x**2

numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
squares = []

for number in numbers:
s = square(number)
squares.append(s)

dask.compute(squares)

print(time.time() - a)
# print(*dask.compute(squares))


Expand Down

0 comments on commit 2ddc05d

Please sign in to comment.