update codegenie
This commit is contained in:
@@ -104,8 +104,6 @@ public class ExternalCodeGenieSolver extends StepSolver {
|
|||||||
@Override
|
@Override
|
||||||
public ScenarioExecution solveStep() throws Exception {
|
public ScenarioExecution solveStep() throws Exception {
|
||||||
|
|
||||||
try {
|
|
||||||
|
|
||||||
System.out.println("Solving step: " + this.step.getName());
|
System.out.println("Solving step: " + this.step.getName());
|
||||||
|
|
||||||
this.scenarioExecution.setCurrentStepId(this.step.getStepId());
|
this.scenarioExecution.setCurrentStepId(this.step.getStepId());
|
||||||
@@ -149,7 +147,6 @@ public class ExternalCodeGenieSolver extends StepSolver {
|
|||||||
jsonResponse.get("token_type").toString() + " " + jsonResponse.get("access_token").toString());
|
jsonResponse.get("token_type").toString() + " " + jsonResponse.get("access_token").toString());
|
||||||
HttpEntity<String> request = new HttpEntity<>(requestBody.toString(), headers);
|
HttpEntity<String> request = new HttpEntity<>(requestBody.toString(), headers);
|
||||||
|
|
||||||
|
|
||||||
response = restTemplate.exchange(
|
response = restTemplate.exchange(
|
||||||
this.codegenie_base_url + "/execute",
|
this.codegenie_base_url + "/execute",
|
||||||
HttpMethod.POST,
|
HttpMethod.POST,
|
||||||
@@ -158,13 +155,16 @@ public class ExternalCodeGenieSolver extends StepSolver {
|
|||||||
|
|
||||||
jsonResponse = new JSONObject(response.getBody());
|
jsonResponse = new JSONObject(response.getBody());
|
||||||
|
|
||||||
/* response = restTemplate.exchange(
|
/*
|
||||||
//this.codegenie_base_url + "/execution_status/" + this.scenarioExecution.getId(),
|
* response = restTemplate.exchange(
|
||||||
this.codegenie_base_url + "/execution_status/679752f85189eb5621b48e17",
|
* //this.codegenie_base_url + "/execution_status/" +
|
||||||
HttpMethod.GET,
|
* this.scenarioExecution.getId(),
|
||||||
request,
|
* this.codegenie_base_url + "/execution_status/679752f85189eb5621b48e17",
|
||||||
String.class);
|
* HttpMethod.GET,
|
||||||
jsonResponse = new JSONObject(response.getBody());*/
|
* request,
|
||||||
|
* String.class);
|
||||||
|
* jsonResponse = new JSONObject(response.getBody());
|
||||||
|
*/
|
||||||
|
|
||||||
int maxTries = 500;
|
int maxTries = 500;
|
||||||
// Pool the status GET api until it return the SUCCESS or FAILED message
|
// Pool the status GET api until it return the SUCCESS or FAILED message
|
||||||
@@ -274,12 +274,17 @@ public class ExternalCodeGenieSolver extends StepSolver {
|
|||||||
this.scenarioExecution.getExecSharedMap().put("status",
|
this.scenarioExecution.getExecSharedMap().put("status",
|
||||||
"DONE");
|
"DONE");
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
this.scenarioExecution.getExecSharedMap().put(this.codegenie_output_variable,
|
||||||
|
"Error while generating file");
|
||||||
throw new Exception(
|
throw new Exception(
|
||||||
"codegenie execution failed with status: " + jsonResponse.get("status").toString());
|
"codegenie execution failed with status: " + jsonResponse.get("status").toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
logger.error("ERROR on pooling codegenies");
|
logger.error("ERROR on pooling codegenies");
|
||||||
|
this.scenarioExecution.getExecSharedMap().put(this.codegenie_output_variable,
|
||||||
|
"Error while generating file");
|
||||||
|
|
||||||
throw new Exception("codegenie execution failed with status: " + jsonResponse.get("status").toString());
|
throw new Exception("codegenie execution failed with status: " + jsonResponse.get("status").toString());
|
||||||
}
|
}
|
||||||
@@ -309,11 +314,7 @@ public class ExternalCodeGenieSolver extends StepSolver {
|
|||||||
|
|
||||||
// scenarioExecutionRepo.save(this.scenarioExecution);
|
// scenarioExecutionRepo.save(this.scenarioExecution);
|
||||||
|
|
||||||
} catch (Exception e) {
|
this.scenarioExecution.setNextStepId(this.step.getNextStepId());
|
||||||
logger.error("Error in codegenie execution: " + e.getMessage(), e);
|
|
||||||
this.scenarioExecution.getExecSharedMap().put("status",
|
|
||||||
"ERROR");
|
|
||||||
}
|
|
||||||
|
|
||||||
return this.scenarioExecution;
|
return this.scenarioExecution;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user