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

Unified Diff: frontend/afe/rpc_interface.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: More code review fixes. 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
Index: frontend/afe/rpc_interface.py
diff --git a/frontend/afe/rpc_interface.py b/frontend/afe/rpc_interface.py
index 0ab132fc9c13fe5b24536e64f07e31cbfd68ab2a..4d2689761c390652c00021e3aef70f1be9e526e1 100644
--- a/frontend/afe/rpc_interface.py
+++ b/frontend/afe/rpc_interface.py
@@ -489,7 +489,7 @@ def create_job(name, priority, control_file, control_type,
timeout=None, max_runtime_hrs=None, run_verify=True,
email_list='', dependencies=(), reboot_before=None,
reboot_after=None, parse_failed_repair=None, hostless=False,
- keyvals=None, drone_set=None):
+ keyvals=None, drone_set=None, image=None):
"""\
Create and enqueue a job.
@@ -519,12 +519,42 @@ def create_job(name, priority, control_file, control_type,
@param one_time_hosts List of hosts not in the database to run the job on.
@param atomic_group_name The name of an atomic group to schedule the job on.
@param drone_set The name of the drone set to run this test on.
+ @param image OS image to install before running job
DaleCurtis 2011/01/14 20:56:16 End in period.
pauldean_chromium 2011/01/18 17:57:31 Done.
@returns The created Job id number.
"""
- return rpc_utils.create_job_common(
- **rpc_utils.get_create_job_common_args(locals()))
+
+ if image is None:
+ return rpc_utils.create_job_common(
+ **rpc_utils.get_create_job_common_args(locals()))
+ else:
DaleCurtis 2011/01/14 20:56:16 No need for else here.
pauldean_chromium 2011/01/18 17:57:31 Done.
+ # When image is supplied use a known parameterized test already in the
+ # database to pass the OS image path from the front end, through the
+ # scheduler, and finally to autoserv as the --image parameter.
+
+ # The test autoupdate_ParameterizedJob is in afe_autotests and used to
+ # instantiate a Test object and from there a parameterizedJob.
DaleCurtis 2011/01/14 20:56:16 ParameterizedJob.
pauldean_chromium 2011/01/18 17:57:31 Done.
+ known_test_obj = models.Test.smart_get('autoupdate_ParameterizedJob')
+ known_parameterized_job = models.ParameterizedJob.objects.create(
+ test=known_test_obj)
+
+ # This test has a single parameter, the image parameter, stored in the
+ # table afe_test_parameters. We retrieve and set this parameter to the
DaleCurtis 2011/01/14 20:56:16 Extra space. Consider reflowing sentence, not enti
pauldean_chromium 2011/01/18 17:57:31 Done.
+ # image path.
+ image_parameter = known_test_obj.testparameter_set.get(id=1)
+ known_parameterized_job.parameterizedjobparameter_set.create(
DaleCurtis 2011/01/14 20:56:16 Is this correct? parameterizedjobparameter_set ? D
pauldean_chromium 2011/01/18 17:57:31 It is correct in that it works and is the way crea
+ test_parameter=image_parameter, parameter_value=image,
+ parameter_type='string')
+
+ # By passing a parameterized_job to create_job_common the job entry in
+ # the afe_jobs table will have the field parameterized_job_id set.
+ # The scheduler uses this id in the afe_parameterized_jobs table to
+ # match this job to our known test, and then with the
+ # afe_parameterized_job_parameters table to get the actual image path.
+ return rpc_utils.create_job_common(
+ parameterized_job=known_parameterized_job.id,
+ **rpc_utils.get_create_job_common_args(locals()))
def abort_host_queue_entries(**filter_data):
« frontend/afe/models.py ('K') | « frontend/afe/models.py ('k') | scheduler/monitor_db.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698