pg2455
pg2455

Reputation: 5148

Timer Object in Python or anything like that

I want to track time in python in order to rerun the model in 1 week of time. I could use:

  import threading
  def learn_model():
    #stuff goes here
  p = threading.Timer(604800, learn_model)

Will this repeat p after 1 week?

Upvotes: 0

Views: 69

Answers (1)

anderspitman
anderspitman

Reputation: 10520

In order for that code to run at all you need to add:

p.start()

So you have

import threading
def learn_model():
  #stuff goes here
p = threading.Timer(604800, learn_model)
p.start()

Then the code in learn_model will execute after a week. But, it will only run once.

Upvotes: 1

Related Questions