On 17.05.2012 [17:09:49 -0700], Nishanth Aravamudan wrote:
> Hi,
> 
> When I clone a job that, say, is building 3.4-rc7 to run kernbench, the
> kernel field is uneditable but blank. The control file in-page does
> display the correct value. Could we write in the kernel field before we
> mark it uneditable?

I spent some time in issue #351 talking with Lucas about this. There
isn't a particularly clean way to deal with the data right now, because
the kernel information is only stored in the control file. Moving it
requires database changes, etc, but there is a "quick'n'dirty" way of
obtaining the data, as implemented below.

Have the server parse out the control file's kernel_list line and munge
in a "kernel" and "cmdline" entry into the job information.

Signed-off-by: Nishanth Aravamudan <n...@us.ibm.com>

---

At this point, I'm curious if it makes sense to not call disableInputs() on
clone? That is, make the kernel and cmdline fields editable, since they will
have data in them. This would also allow one to modify what tests are run, etc.

I guess it depends on what clone is intended for -- right now, it's only for
running the exact same job (except I think you can change the hosts involved).
I think it's more useful if it starts there, but the user can modify the job to
be whatever they need to be.

diff --git a/frontend/afe/rpc_interface.py b/frontend/afe/rpc_interface.py
index e4fa1bf..31916fd 100644
--- a/frontend/afe/rpc_interface.py
+++ b/frontend/afe/rpc_interface.py
@@ -29,7 +29,7 @@ See doctests/001_rpc_test.txt for (lots) more examples.
 
 __author__ = 'show...@google.com (Steve Howard)'
 
-import datetime, xmlrpclib
+import datetime, xmlrpclib, re
 try:
     import autotest.common as common
 except ImportError:
@@ -658,6 +658,18 @@ def get_info_for_clone(id, preserve_metahosts, 
queue_entry_filter_data=None):
     info = dict(job=job.get_object_dict(),
                 meta_host_counts=meta_host_counts,
                 hosts=host_dicts)
+    kernel = ""
+    cmdline = ""
+    kernel_list = re.search("kernel_list\s*=\s*\[(.*?)\]", 
info['job']['control_file'])
+    if kernel_list is not None:
+        kernel_list = kernel_list.group(1)
+        cmdlineSearch = re.search("'cmdline':\s*'(.*?)'", kernel_list)
+        if cmdlineSearch is not None:
+            cmdline = cmdline.group(1)
+        if re.search("'version':\s*'(.*?)'", kernel_list) is not None:
+            kernel = " ".join(re.findall("'version':\s*'(.*?)'", kernel_list))
+    info['job']['kernel'] = kernel
+    info['job']['cmdline'] = cmdline 
     info['job']['dependencies'] = job_info['dependencies']
     if job_info['atomic_group']:
         info['atomic_group_name'] = (job_info['atomic_group']).name
diff --git 
a/frontend/client/src/autotest/afe/create/CreateJobViewPresenter.java 
b/frontend/client/src/autotest/afe/create/CreateJobViewPresenter.java
index 822832a..5751972 100644
--- a/frontend/client/src/autotest/afe/create/CreateJobViewPresenter.java
+++ b/frontend/client/src/autotest/afe/create/CreateJobViewPresenter.java
@@ -138,6 +138,8 @@ public class CreateJobViewPresenter implements 
TestSelectorListener {
         String priority = jobObject.get("priority").isString().stringValue();
         display.getPriorityList().selectByName(priority);
 
+        
display.getKernel().setText(jobObject.get("kernel").isString().stringValue());
+        
display.getKernelCmdline().setText(jobObject.get("cmdline").isString().stringValue());
         
display.getTimeout().setText(Utils.jsonToString(jobObject.get("timeout")));
         
display.getMaxRuntime().setText(Utils.jsonToString(jobObject.get("max_runtime_hrs")));
         display.getEmailList().setText(


-- 
Nishanth Aravamudan <n...@us.ibm.com>
IBM Linux Technology Center

_______________________________________________
Autotest mailing list
Autotest@test.kernel.org
http://test.kernel.org/cgi-bin/mailman/listinfo/autotest

Reply via email to