message.putInt(benchmarkId);
message.putInt(benchmarkIterations);
List<TTaskSpec> out = new ArrayList<TTaskSpec>();
for (int taskId = 0; taskId < numTasks; taskId++) {
TTaskSpec spec = new TTaskSpec();
spec.setTaskId(Integer.toString((new Random().nextInt())));
spec.setMessage(message.array());
if (numPreferredNodes > 0) {
Collections.shuffle(backends);
TPlacementPreference preference = new TPlacementPreference();
for (int i = 0; i < numPreferredNodes; i++) {
preference.addToNodes(backends.get(i));
}
spec.setPreference(preference);
}
out.add(spec);
}
return out;
}