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

Unified Diff: scheduler/scheduler_models.py

Issue 6181003: Add support for an --image flag to atest. (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/autotest.git@master
Patch Set: Fixing missing 'self.' in commented out parameters. Created 9 years, 11 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 | « scheduler/monitor_db.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: scheduler/scheduler_models.py
diff --git a/scheduler/scheduler_models.py b/scheduler/scheduler_models.py
index 870914d5de0b2a3d3aa76d211b15058762ac059d..c562e319775d509bc62b54dac14579d2c61d6a9f 100644
--- a/scheduler/scheduler_models.py
+++ b/scheduler/scheduler_models.py
@@ -827,6 +827,7 @@ class Job(DBObject):
assert id or row
super(Job, self).__init__(id=id, row=row, **kwargs)
self._owner_model = None # caches model instance of owner
+ self.update_image_path = None # path of OS image to install
def model(self):
@@ -861,6 +862,53 @@ class Job(DBObject):
return entries
+ def is_image_update_job(self):
+ """
+ Discover if the current job requires an OS update.
+
+ @return: True/False if OS should be updated before job is run.
+ """
+ # All image update jobs have the parameterized_job_id set.
+ if not self.parameterized_job_id:
+ return False
+
+ # Retrieve the ID of the ParameterizedJob this job is an instance of.
+ rows = _db.execute("""
+ SELECT test_id
+ FROM afe_parameterized_jobs
+ WHERE id = %s
+ """, (self.parameterized_job_id,))
+ if not rows:
+ return False
+ test_id = rows[0][0]
+
+ # Retrieve the ID of the known autoupdate_ParameterizedJob.
+ rows = _db.execute("""
+ SELECT id
+ FROM afe_autotests
+ WHERE name = 'autoupdate_ParameterizedJob'
+ """)
+ if not rows:
+ return False
+ update_id = rows[0][0]
+
+ # If the IDs are the same we've found an image update job.
+ if test_id == update_id:
+ # Finally, get the path to the OS image to install.
+ rows = _db.execute("""
+ SELECT parameter_value
+ FROM afe_parameterized_job_parameters
+ WHERE parameterized_job_id = %s
+ """, (self.parameterized_job_id,))
+ if rows:
+ # Save the path in update_image_path to use later as a command
+ # line parameter to autoserv.
+ self.update_image_path = rows[0][0]
+ return True
+
+ return False
+
+
def get_execution_details(self):
"""
Get test execution details for this job.
« no previous file with comments | « scheduler/monitor_db.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698