Robinhood
Robinhood

Reputation: 110

Databricks Notebook Cell Runtime

Is there a way to fetch runtime of a particular cell in data bricks Notebook using Pyspark?

Upvotes: 1

Views: 5061

Answers (2)

Robinhood
Robinhood

Reputation: 110

import time
start = time.time()

time.sleep(3)
end = time.time()
diff=end - start
print(diff)

I was able to achieve my requirement with above code

Upvotes: 1

CHEEKATLAPRADEEP
CHEEKATLAPRADEEP

Reputation: 12768

You can do this by calling System.nanoTime (Scala). When using Spark with Scala, a way to execute code and measure its elapsed time is by using: spark.time(

Note: You can use the run multiple languages in the notebooks using %magic commands.

enter image description here

OR

enter image description here

Upvotes: 0

Related Questions