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

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: 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
« frontend/afe/models.py ('K') | « 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..644510db4ecd34a3981a6a819316342c23b827e5 100644
--- a/scheduler/scheduler_models.py
+++ b/scheduler/scheduler_models.py
@@ -861,6 +861,54 @@ 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.
+ """
+ if not self.parameterized_job_id:
+ # All image update jobs have the parameterized_job_id set.
DaleCurtis 2011/01/11 00:46:05 Nit, but I think comment should be on line above.
pauldean_chromium 2011/01/12 18:12:52 Done.
+ return False
+
+ # Retrieve the ID of the ParameterizedJob this job is an instance of.
+ sql_str = ('SELECT test_id '
DaleCurtis 2011/01/11 00:46:05 Use """ syntax like in the rest of the file. Also
pauldean_chromium 2011/01/12 18:12:52 Cool, thanks for the info. I've fixed that up.
+ 'FROM afe_parameterized_jobs '
+ 'WHERE id = %s' % self.parameterized_job_id)
+ rows = _db.execute(sql_str)
+ if not rows:
+ return False
+ test_id = rows[0][0]
DaleCurtis 2011/01/11 00:46:05 Is it possible for rows[n] to be None or something
pauldean_chromium 2011/01/12 18:12:52 In the testing I've done with regular and the new
+
+ # Retrieve the ID of the known autoupdate_ParameterizedJob.
+ sql_str = ('SELECT id '
DaleCurtis 2011/01/11 00:46:05 Same comment as above.
pauldean_chromium 2011/01/12 18:12:52 Done.
+ 'FROM afe_autotests '
+ 'WHERE name = \"%s\"' % 'autoupdate_ParameterizedJob')
+ rows = _db.execute(sql_str)
+ if not rows:
+ return False
+ update_id = rows[0][0]
DaleCurtis 2011/01/11 00:46:05 Same comment as above.
pauldean_chromium 2011/01/12 18:12:52 Done.
+
+ # If the IDs are the same we've found an image update job.
+ if test_id == update_id:
DaleCurtis 2011/01/11 00:46:05 Will all parameterized jobs always be image jobs?
pauldean_chromium 2011/01/12 18:12:52 For now image update jobs are the only parameteriz
+ # Finally, get the path to the OS image to install.
+ sql_str = ('SELECT parameter_value '
DaleCurtis 2011/01/11 00:46:05 Same comment as above.
pauldean_chromium 2011/01/12 18:12:52 Done.
+ 'FROM afe_parameterized_job_parameters '
+ 'WHERE parameterized_job_id = %s '
+ % self.parameterized_job_id)
+ rows = _db.execute(sql_str)
+ if not rows:
+ # The image cannot be updated without an OS path.
DaleCurtis 2011/01/11 00:46:05 Consider reflowing w/ else: return False below. Dr
pauldean_chromium 2011/01/12 18:12:52 Good point. Fixed.
+ return False
+
+ # 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
+ else:
+ return False
+
+
def get_execution_details(self):
"""
Get test execution details for this job.
« frontend/afe/models.py ('K') | « scheduler/monitor_db.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698