Implement creation and cloning of hostless jobs from AFE Create Job tab
Signed-off-by: James Ren <[email protected]>
--- autotest/frontend/afe/rpc_interface.py 2010-04-09 17:19:35.000000000
-0700
+++ autotest/frontend/afe/rpc_interface.py 2010-04-09 17:19:35.000000000
-0700
@@ -655,6 +655,7 @@
info['atomic_group_name'] = (job_info['atomic_group']).name
else:
info['atomic_group_name'] = None
+ info['hostless'] = job_info['hostless']
return rpc_utils.prepare_for_serialization(info)
--- autotest/frontend/afe/rpc_utils.py 2010-04-09 17:19:35.000000000 -0700
+++ autotest/frontend/afe/rpc_utils.py 2010-04-09 17:19:35.000000000 -0700
@@ -395,6 +395,7 @@
one_time_hosts = []
meta_hosts = []
atomic_group = None
+ hostless = False
queue_entries = job.hostqueueentry_set.all()
if queue_entry_filter_data:
@@ -410,8 +411,11 @@
one_time_hosts.append(queue_entry.host)
else:
hosts.append(queue_entry.host)
- else:
+ elif queue_entry.meta_host:
meta_hosts.append(queue_entry.meta_host)
+ else:
+ hostless = True
+
if atomic_group is None:
if queue_entry.atomic_group is not None:
atomic_group = queue_entry.atomic_group
@@ -429,7 +433,8 @@
meta_hosts=meta_hosts,
meta_host_counts=meta_host_counts,
one_time_hosts=one_time_hosts,
- atomic_group=atomic_group)
+ atomic_group=atomic_group,
+ hostless=hostless)
return info
--- autotest/frontend/client/src/autotest/afe/CreateJobView.java
2010-04-09 17:19:35.000000000 -0700
+++ autotest/frontend/client/src/autotest/afe/CreateJobView.java
2010-04-09 17:19:35.000000000 -0700
@@ -28,6 +28,7 @@
import com.google.gwt.event.logical.shared.OpenHandler;
import com.google.gwt.json.client.JSONArray;
import com.google.gwt.json.client.JSONBoolean;
+import com.google.gwt.json.client.JSONNull;
import com.google.gwt.json.client.JSONNumber;
import com.google.gwt.json.client.JSONObject;
import com.google.gwt.json.client.JSONString;
@@ -172,6 +173,7 @@
private RadioChooser rebootBefore = new RadioChooser();
private RadioChooser rebootAfter = new RadioChooser();
private CheckBox parseFailedRepair = new CheckBox();
+ private CheckBox hostless = new CheckBox();
protected TestSelector testSelector;
protected CheckBoxPanel<CheckBox> profilersPanel =
new CheckBoxPanel<CheckBox>(TEST_COLUMNS);
@@ -232,6 +234,10 @@
rebootAfter.setSelectedChoice(Utils.jsonToString(jobObject.get("reboot_after")));
parseFailedRepair.setValue(
jobObject.get("parse_failed_repair").isBoolean().booleanValue());
+
hostless.setValue(cloneObject.get("hostless").isBoolean().booleanValue());
+ if (hostless.getValue()) {
+ hostSelector.setEnabled(false);
+ }
controlTypeSelect.setControlType(
jobObject.get("control_type").isString().stringValue());
@@ -582,6 +588,13 @@
}
});
+ hostless.addClickHandler(new ClickHandler() {
+ @Override
+ public void onClick(ClickEvent event) {
+ hostSelector.setEnabled(!hostless.getValue());
+ }
+ });
+
reset();
addWidget(jobName, "create_job_name");
@@ -595,6 +608,7 @@
addWidget(rebootBefore, "create_reboot_before");
addWidget(rebootAfter, "create_reboot_after");
addWidget(parseFailedRepair, "create_parse_failed_repair");
+ addWidget(hostless, "create_hostless");
addWidget(testSelector, "create_tests");
addWidget(profilerControls, "create_profilers");
addWidget(controlFilePanel, "create_edit_control");
@@ -615,6 +629,7 @@
rebootAfter.reset();
parseFailedRepair.setValue(
repository.getData("parse_failed_repair_default").isBoolean().booleanValue());
+ hostless.setValue(false);
kernel.setText("");
kernel_cmdline.setText("");
timeout.setText(Utils.jsonToString(repository.getData("job_timeout_default")));
@@ -638,12 +653,18 @@
}
protected void submitJob(final boolean isTemplate) {
- final int timeoutValue, maxRuntimeValue, synchCount;
+ final int timeoutValue, maxRuntimeValue;
+ final JSONValue synchCount;
try {
timeoutValue = parsePositiveIntegerInput(timeout.getText(),
"timeout");
maxRuntimeValue = parsePositiveIntegerInput(maxRuntime.getText(),
"max runtime");
- synchCount = parsePositiveIntegerInput(synchCountInput.getText(),
- "number of machines used
per execution");
+
+ if (hostless.getValue()) {
+ synchCount = JSONNull.getInstance();
+ } else {
+ synchCount = new JSONNumber(parsePositiveIntegerInput(
+ synchCountInput.getText(), "number of machines used per
execution"));
+ }
} catch (IllegalArgumentException exc) {
return;
}
@@ -660,7 +681,7 @@
args.put("control_file", new
JSONString(controlFile.getText()));
args.put("control_type",
new JSONString(controlTypeSelect.getControlType()));
- args.put("synch_count", new JSONNumber(synchCount));
+ args.put("synch_count", synchCount);
args.put("timeout", new JSONNumber(timeoutValue));
args.put("max_runtime_hrs", new JSONNumber(maxRuntimeValue));
args.put("email_list", new JSONString(emailList.getText()));
@@ -671,6 +692,7 @@
args.put("reboot_after", new
JSONString(rebootAfter.getSelectedChoice()));
args.put("parse_failed_repair",
JSONBoolean.getInstance(parseFailedRepair.getValue()));
+ args.put("hostless",
JSONBoolean.getInstance(hostless.getValue()));
HostSelector.HostSelection hosts =
hostSelector.getSelectedHosts();
args.put("hosts", Utils.stringsToJSON(hosts.hosts));
--- autotest/frontend/client/src/autotest/afe/HostSelector.java 2010-04-09
17:19:35.000000000 -0700
+++ autotest/frontend/client/src/autotest/afe/HostSelector.java 2010-04-09
17:19:35.000000000 -0700
@@ -56,6 +56,7 @@
public SimplifiedList getLabelList();
public HasText getLabelNumberField();
public HasClickHandlers getAddByLabelButton();
+ public void setVisible(boolean visible);
// a temporary measure until the table code gets refactored to support
Passive View
public void addTables(Widget availableTable, Widget selectedTable);
@@ -72,6 +73,7 @@
new HostTableDecorator(availableTable, TABLE_SIZE);
private HostTable selectedTable = new HostTable(selectedHostData);
private TableDecorator selectedDecorator = new
TableDecorator(selectedTable);
+ private boolean enabled = true;
private SelectionManager availableSelection;
@@ -297,6 +299,10 @@
*/
public HostSelection getSelectedHosts() {
HostSelection selection = new HostSelection();
+ if (!enabled) {
+ return selection;
+ }
+
for (JSONObject row : selectedHostData.getItems() ) {
if (isMetaEntry(row)) {
int count = getMetaNumber(row);
@@ -324,6 +330,7 @@
public void reset() {
deselectAll();
selectionRefresh();
+ setEnabled(true);
}
/**
@@ -350,4 +357,9 @@
availableTable.refresh();
selectionRefresh();
}
+
+ public void setEnabled(boolean enabled) {
+ this.enabled = enabled;
+ display.setVisible(enabled);
+ }
}
--- autotest/frontend/client/src/autotest/afe/JobDetailView.java
2010-04-09 17:19:35.000000000 -0700
+++ autotest/frontend/client/src/autotest/afe/JobDetailView.java
2010-04-09 17:19:35.000000000 -0700
@@ -257,7 +257,8 @@
menu.addItem("Use failed and aborted hosts", new Command() {
public void execute() {
JSONObject queueEntryFilterData = new JSONObject();
- String sql = "(status = 'Failed' OR aborted = TRUE)";
+ String sql = "(status = 'Failed' OR aborted = TRUE OR " +
+ "(host_id IS NULL AND meta_host IS NULL))";
queueEntryFilterData.put("extra_where", new JSONString(sql));
cloneJob(true, queueEntryFilterData);
--- autotest/frontend/client/src/autotest/public/AfeClient.html 2010-04-09
17:19:35.000000000 -0700
+++ autotest/frontend/client/src/autotest/public/AfeClient.html 2010-04-09
17:19:35.000000000 -0700
@@ -132,6 +132,8 @@
<td id="create_reboot_after"></td><td></td></tr>
<tr><td class="field-name">Include failed repair results:</td>
<td id="create_parse_failed_repair"></td><td></td></tr>
+ <tr><td class="field-name">Hostless:</td>
+ <td id="create_hostless"></td><td></td></tr>
<tr><td class="field-name">Tests:</td>
<td id="create_tests" colspan="2"></td></tr>
<tr><td class="field-name">Custom client tests:</td>
_______________________________________________
Autotest mailing list
[email protected]
http://test.kernel.org/cgi-bin/mailman/listinfo/autotest