Try this simple thing first import time def main(): start_time = time.time()
print("\nStarted at");uf.println(lst) # your code print("\nFinished at");uf.println(lst) end_time = time.time() time_elapsed = (end_time - start_time) print(f"""Elapsed time in seconds is {time_elapsed}""") spark_session.stop() see https://github.com/michTalebzadeh/spark_on_gke/blob/main/src/RandomDataBigQuery.py HTH view my Linkedin profile <https://www.linkedin.com/in/mich-talebzadeh-ph-d-5205b2/> *Disclaimer:* Use it at your own risk. Any and all responsibility for any loss, damage or destruction of data or any other property which may arise from relying on this email's technical content is explicitly disclaimed. The author will in no case be liable for any monetary damages arising from such loss, damage or destruction. On Thu, 23 Dec 2021 at 10:58, <bit...@bitfox.top> wrote: > hello community, > > In pyspark how can I measure the running time to the command? > I just want to compare the running time of the RDD API and dataframe > API, in my this blog: > > https://bitfoxtop.wordpress.com/2021/12/23/count-email-addresses-using-sparks-rdd-and-dataframe/ > > I tried spark.time() it doesn't work. > Thank you. > > --------------------------------------------------------------------- > To unsubscribe e-mail: user-unsubscr...@spark.apache.org > >