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

Unified Diff: frontend/planner/rpc_utils.py

Issue 1595019: Merge remote branch 'origin/upstream' into tempbranch (Closed)
Patch Set: Created 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « frontend/planner/rpc_interface_unittest.py ('k') | frontend/planner/rpc_utils_unittest.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: frontend/planner/rpc_utils.py
diff --git a/frontend/planner/rpc_utils.py b/frontend/planner/rpc_utils.py
index 79a6dcc0e02c6654629c7cd7a30b113af5e10c1d..78f8e64dfc605d3c41ef1493286a751089d756c5 100644
--- a/frontend/planner/rpc_utils.py
+++ b/frontend/planner/rpc_utils.py
@@ -2,6 +2,7 @@ import common
import os
from autotest_lib.frontend.afe import models as afe_models, model_logic
from autotest_lib.frontend.planner import models, model_attributes
+from autotest_lib.frontend.planner import failure_actions
from autotest_lib.client.common_lib import global_config, utils
@@ -111,8 +112,8 @@ def compute_next_test_config(plan, host):
afe_job_ids = afe_jobs.values_list('afe_job', flat=True)
hqes = afe_models.HostQueueEntry.objects.filter(job__id__in=afe_job_ids,
host=host.host)
- if not hqes:
- return test_config.id
+ if not hqes and not bool(test_config.skipped_hosts.filter(host=host)):
+ return test_config
for hqe in hqes:
if not hqe.complete:
# HostQueueEntry still active for this host,
@@ -159,3 +160,50 @@ def add_test_run(plan, planner_job, tko_test, hostname, status):
host=planner_host)
test_run.status = status
test_run.save()
+
+
+def _site_process_host_action_dummy(host, action):
+ return False
+
+
+def process_host_action(host, action):
+ """
+ Takes the specified action on the host
+ """
+ HostAction = failure_actions.HostAction
+ if action not in HostAction.values:
+ raise ValueError('Unexpected host action %s' % action)
+
+ site_process = utils.import_site_function(
+ __file__, 'autotest_lib.frontend.planner.site_rpc_utils',
+ 'site_process_host_action', _site_process_host_action_dummy)
+
+ if not site_process(host, action):
+ # site_process_host_action returns True and and only if it matched a
+ # site-specific processing option
+ if action == HostAction.BLOCK:
+ host.blocked = True
+ elif action == HostAction.UNBLOCK:
+ host.blocked = False
+ else:
+ assert action == HostAction.REINSTALL
+ raise NotImplemented('TODO: implement reinstall')
+
+ host.save()
+
+
+def process_test_action(planner_job, action):
+ """
+ Takes the specified action for this planner job
+ """
+ TestAction = failure_actions.TestAction
+ if action not in TestAction.values:
+ raise ValueError('Unexpected test action %s' % action)
+
+ if action == TestAction.SKIP:
+ # Do nothing
+ pass
+ else:
+ assert action == TestAction.RERUN
+ planner_job.requires_rerun = True
+ planner_job.save()
« no previous file with comments | « frontend/planner/rpc_interface_unittest.py ('k') | frontend/planner/rpc_utils_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698