Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(217)

Side by Side Diff: client/virt/virt_scheduler.py

Issue 6883246: Merge autotest upstream from @5318 ~ @5336 (Closed) Base URL: ssh://gitrw.chromium.org:9222/autotest.git@master
Patch Set: patch Created 9 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « client/virt/virt_installer.py ('k') | client/virt/virt_step_editor.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 import os, select 1 import os, select
2 import kvm_utils, kvm_vm, kvm_subprocess 2 import virt_utils, virt_vm, aexpect
3 3
4 4
5 class scheduler: 5 class scheduler:
6 """ 6 """
7 A scheduler that manages several parallel test execution pipelines on a 7 A scheduler that manages several parallel test execution pipelines on a
8 single host. 8 single host.
9 """ 9 """
10 10
11 def __init__(self, tests, num_workers, total_cpus, total_mem, bindir): 11 def __init__(self, tests, num_workers, total_cpus, total_mem, bindir):
12 """ 12 """
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 test_iterations = int(test.get("iterations", 1)) 66 test_iterations = int(test.get("iterations", 1))
67 status = run_test_func("kvm", params=test, 67 status = run_test_func("kvm", params=test,
68 tag=test.get("shortname"), 68 tag=test.get("shortname"),
69 iterations=test_iterations) 69 iterations=test_iterations)
70 w.write("done %s %s\n" % (test_index, status)) 70 w.write("done %s %s\n" % (test_index, status))
71 w.write("ready\n") 71 w.write("ready\n")
72 72
73 # The scheduler wants this worker to free its used resources 73 # The scheduler wants this worker to free its used resources
74 elif cmd[0] == "cleanup": 74 elif cmd[0] == "cleanup":
75 env_filename = os.path.join(self.bindir, self_dict["env"]) 75 env_filename = os.path.join(self.bindir, self_dict["env"])
76 env = kvm_utils.Env(env_filename) 76 env = virt_utils.Env(env_filename)
77 for obj in env.values(): 77 for obj in env.values():
78 if isinstance(obj, kvm_vm.VM): 78 if isinstance(obj, virt_vm.VM):
79 obj.destroy() 79 obj.destroy()
80 elif isinstance(obj, kvm_subprocess.Spawn): 80 elif isinstance(obj, aexpect.Spawn):
81 obj.close() 81 obj.close()
82 env.save() 82 env.save()
83 w.write("cleanup_done\n") 83 w.write("cleanup_done\n")
84 w.write("ready\n") 84 w.write("ready\n")
85 85
86 # There's no more work for this worker 86 # There's no more work for this worker
87 elif cmd[0] == "terminate": 87 elif cmd[0] == "terminate":
88 break 88 break
89 89
90 90
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 self.s2w_w[worker].write("cleanup\n") 220 self.s2w_w[worker].write("cleanup\n")
221 idle_workers.remove(worker) 221 idle_workers.remove(worker)
222 closing_workers.append(worker) 222 closing_workers.append(worker)
223 223
224 # If there are no more new tests to run, terminate the workers and 224 # If there are no more new tests to run, terminate the workers and
225 # the scheduler 225 # the scheduler
226 if len(idle_workers) == self.num_workers: 226 if len(idle_workers) == self.num_workers:
227 for worker in idle_workers: 227 for worker in idle_workers:
228 self.s2w_w[worker].write("terminate\n") 228 self.s2w_w[worker].write("terminate\n")
229 break 229 break
OLDNEW
« no previous file with comments | « client/virt/virt_installer.py ('k') | client/virt/virt_step_editor.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698