提交 81636942 编写于 作者: F Fabian Hueske 提交者: unknown

- Fixed webfrontend preview bug

上级 033b03a7
......@@ -85,8 +85,7 @@
type: "GET",
url: "pactPlan",
data: { job: id },
success: function(response) { showPreviewPlan(response); },
error:function (xhr, ajaxOptions, thrownError) { alert(xhr.responseText); pactPlanRequested = 0; }
success: function(response) { showPreviewPlan(response); }
});
}
else {
......
......@@ -121,7 +121,12 @@ public class PactProgram {
* @throws ErrorInPlanAssemblerException
*/
public OptimizedPlan getPreOptimizedPlan() throws ProgramInvocationException, ErrorInPlanAssemblerException {
return getPreOptimizedPlan(getPlan());
Plan plan = getPlan();
if(plan != null) {
return getPreOptimizedPlan(plan);
} else {
return null;
}
}
/**
......
......@@ -73,17 +73,19 @@ public class PactJobJSONServlet extends HttpServlet {
// create the pact plan
try {
PactProgram pactProgram = new PactProgram(jarFile, (String[]) null);
PactProgram pactProgram = new PactProgram(jarFile, new String[0]);
OptimizedPlan optPlan = pactProgram.getPreOptimizedPlan();
String programDescription = pactProgram.getDescription();
String json = new JSONGenerator().compilePlanToJSON(optPlan);
String programDescription = pactProgram.getDescription();
resp.setStatus(HttpServletResponse.SC_OK);
PrintWriter wrt = resp.getWriter();
wrt.print("{ \"jobname\": \"");
wrt.print(jobName);
wrt.print("\", \"plan\": ");
wrt.println(json);
wrt.print(jobName);
if(optPlan != null) {
wrt.print("\", \"plan\": ");
String json = new JSONGenerator().compilePlanToJSON(optPlan);
wrt.println(json);
}
if (programDescription != null) {
wrt.print(", \"description\": \"");
wrt.print(escapeString(programDescription));
......
......@@ -631,17 +631,20 @@ public class KMeansIteration implements PlanAssembler, PlanAssemblerDescription
@Override
public Plan getPlan(String... args) {
int noSubTasks = 1;
String dataPointInput = "";
String clusterInput = "";
String output = "";
// check for the correct number of job parameters
if (args.length != 4) {
return null;
if (args.length == 4) {
// parse job parameters
noSubTasks = Integer.parseInt(args[0]);
dataPointInput = args[1];
clusterInput = args[2];
output = args[3];
}
// parse job parameters
int noSubTasks = Integer.parseInt(args[0]);
String dataPointInput = args[1];
String clusterInput = args[2];
String output = args[3];
// create DataSourceContract for data point input
DataSourceContract<PactInteger, CoordVector> dataPoints = new DataSourceContract<PactInteger, CoordVector>(
PointInFormat.class, dataPointInput, "Read Data Points");
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册