-
Notifications
You must be signed in to change notification settings - Fork 58
Time-based stop #184
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Hi Andrey, with the def time_goal(total_seconds=3600):
import time
def goal(learner):
try:
return time.time() - learner._start_time > total_seconds
except AttributeError:
# Set the start time
learner._start_time = time.time()
return False
return goal
runner = adaptive.Runner(learner, goal=time_goal(6 * 3600)) # stop after 6 hours
runner.live_info() Another cool thing that would probably interest you is |
Thanks, I will use that! Logically I think this could be improved - the learner stores the data and shouldn't care about elapsed time, particularly when you load and save it. The runner on the other end lives during the time of the execution. In fact, when looking at the source of So, perhaps, I can rephrase my question as a feature request for |
Indeed, the learner should not be storing a start time at all. I would do the following: learner = ...
def stop_after(n_seconds):
start_time = time.time()
return lambda _: time.time() > start_time + n_seconds
runner = Runner(learner, goal=stop_after(600)) We can provide |
Hey guys,
Adaptive is great.
A feature request. I want to have the runner quit after a certain time. Say, something like
runner = adaptive.BlockingRunner(learner, goal=time_elapsed > 6 hours)
This is useful when you submit the runner itself as a job to a cluster with a finite time of execution. With runner.save and runner.load one can then stage, look at the data and decide whether it needs to submitted again. How can I do that?
The text was updated successfully, but these errors were encountered: