Use Train Helper Method Instead of Schedule.TrainingNow

This commit is contained in:
AlexCatarino
2019-10-28 18:13:59 +00:00
parent 5bb28b44a8
commit 49701657fb
2 changed files with 23 additions and 2 deletions
@@ -40,4 +40,13 @@ class TrainingInitializeRegressionAlgorithm(QCAlgorithm):
# this should cause the algorithm to fail
# the regression test sets the time limit to 30 seconds and there's one extra
# minute in the bucket, so a two minute sleep should result in RuntimeError
self.Schedule.TrainingNow(lambda: sleep(150))
self.Train(lambda: sleep(150))
# DateRules.Tomorrow combined with TimeRules.Midnight enforces that this event schedule will
# have exactly one time, which will fire between the first data point and the next day at
# midnight. So after the first data point, it will run this event and sleep long enough to
# exceed the static max algorithm time loop time and begin to consume from the leaky bucket
# the regression test sets the "algorithm-manager-time-loop-maximum" value to 30 seconds
self.Train(self.DateRules.Tomorrow, self.TimeRules.Midnight, lambda: sleep(60))
# this will consume the single 'minute' available in the leaky bucket
# and the regression test will confirm that the leaky bucket is empty