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

- Fixed webfrontend preview bug

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