Send node label with data status packet

Zuul can use this information to organize its build data by node type.
This will give us more granular insights into load and capacity.

Change-Id: Ibca938fcf8a65facd7e39dab4eb994dfc637722a
This commit is contained in:
Timothy Chavez 2015-08-20 00:14:19 -05:00
parent 08e9c429de
commit 8de3305aa3

View File

@ -99,6 +99,17 @@ public class StartJobWorker extends AbstractGearmanFunction {
if (result != null) { if (result != null) {
data.put("result", result.toString()); data.put("result", result.toString());
} }
ArrayList<String> nodeLabels = new ArrayList<String>();
Node node = build.getBuiltOn();
if ( node != null ) {
Set<LabelAtom> nodeLabelAtoms = node.getAssignedLabels();
for (LabelAtom labelAtom : nodeLabelAtoms) {
nodeLabels.add(labelAtom.getDisplayName());
}
}
data.put("node_labels", nodeLabels);
Gson gson = new Gson(); Gson gson = new Gson();
return gson.toJson(data); return gson.toJson(data);
} }