crosperf: fix the problem on machine assignment.
BUG=chromium:461628
TEST=it always reuses the image on the machine for test shown in bug.
Change-Id: I8106eaa31395db3ee95507b2a9cd7ed0439bc890
Reviewed-on: https://chrome-internal-review.googlesource.com/202667
Reviewed-by: Caroline Tice <cmtice@google.com>
Commit-Queue: Yunlian Jiang <yunlian@google.com>
Tested-by: Yunlian Jiang <yunlian@google.com>
diff --git a/crosperf/machine_manager.py b/crosperf/machine_manager.py
index dede640..ad214a2 100644
--- a/crosperf/machine_manager.py
+++ b/crosperf/machine_manager.py
@@ -379,7 +379,11 @@
# code and can implement minimal reimaging code more cleanly.
for m in [machine for machine in self.GetAvailableMachines(label)
if not machine.locked]:
- if time.time() - m.released_time > 20:
+ if time.time() - m.released_time > 15:
+ # The release time gap is too large, so it is probably in the start
+ # stage, we need to reset the released_time.
+ m.released_time = time.time()
+ elif time.time() - m.released_time > 8:
m.locked = True
m.test_run = threading.current_thread()
return m