Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…etanome into ExecutionProcess
  • Loading branch information
Dacry committed Apr 10, 2015
2 parents 0390f57 + 059bf47 commit 8a44dc7
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ public Execution executeAlgorithm(AlgorithmExecutionParams params) {
@GET
@Path("/result_cache/{identifier}")
@Produces("application/json")
public List<Result> fetchNewResults(@PathParam("identifier") String executionIdentifier) {
public List<Result> getCacheResults(@PathParam("identifier") String executionIdentifier) {
try {
return AlgorithmExecutionCache.getResultCache(executionIdentifier).fetchNewResults();
} catch (Exception e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public void testFetchNewResults() throws Exception {
AlgorithmExecutionCache.getResultCache(expectedExecutionIdentifier).receiveResult(
expectedUcc);
List<Result>
actualResult = executionService.fetchNewResults(expectedExecutionIdentifier);
actualResult = executionService.getCacheResults(expectedExecutionIdentifier);

// Check result
assertFalse(actualResult.isEmpty());
Expand Down Expand Up @@ -102,7 +102,7 @@ public void testFetchResultsNotPossible() throws FileNotFoundException, Unsuppor

// Check
List<Result>
actualResult = executionService.fetchNewResults(expectedExecutionIdentifier);
actualResult = executionService.getCacheResults(expectedExecutionIdentifier);
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,10 @@ public void updateOnSuccess(Long executionTimeInMs) {
this.progressTimer.cancel();

// Fetch the last results or get all results depending on the used result receiver
if (cacheResults || writeResults)
this.tablePage.fetchResults();
if (cacheResults)
this.tablePage.fetchCacheResults();
else if (writeResults)
this.tablePage.fetchPrinterResults();
else if (countResults)
this.tablePage.getCounterResults();

Expand Down Expand Up @@ -164,7 +166,7 @@ public void run() {
this.progressTimer = new Timer() {
public void run() {
if (showProgress) updateProgress();
if (cacheResults) resultsTab.fetchResults();
if (cacheResults) resultsTab.fetchCacheResults();
}
};
this.progressTimer.scheduleRepeating(10000);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,21 @@ public ResultsTablePage(AlgorithmExecutionRestService executionService, String e
/**
* Fetches the results from the execution service and displays them on success.
*/
protected void fetchResults() {
protected void fetchPrinterResults() {
if (executionService == null)
return;

executionService.fetchNewResults(executionIdentifier, getResultCallback());
executionService.getPrinterResults(executionIdentifier, getResultCallback());
}

/**
* Fetches the results from the execution service and displays them on success.
*/
protected void fetchCacheResults() {
if (executionService == null)
return;

executionService.getCacheResults(executionIdentifier, getResultCallback());
}

/**
Expand Down Expand Up @@ -146,7 +156,7 @@ private MethodCallback<List<Result>> getResultCallback() {
return new MethodCallback<List<Result>>() {
@Override
public void onFailure(Method method, Throwable throwable) {
messageReceiver.addError("Could not display all results.");
messageReceiver.addError("Could not display all results: " + method.getResponse().getText());
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,15 @@ public interface AlgorithmExecutionRestService extends RestService {
public void executeAlgorithm(AlgorithmExecutionParams params,
MethodCallback<Execution> callback);

@GET
@Path("/result_cache/{identifier}")
public void fetchNewResults(@PathParam("identifier") String algorithmName, MethodCallback<List<Result>> callback);

@GET
@Path("/fetch_progress/{identifier}")
public void fetchProgress(@PathParam("identifier") String executionIdentifier, MethodCallback<Float> callback);

@GET
@Path("/result_cache/{identifier}")
public void getCacheResults(@PathParam("identifier") String algorithmName,
MethodCallback<List<Result>> callback);

@GET
@Path("/result_counter/{identifier}")
public void getCounterResults(@PathParam("identifier") String executionIdentifier, MethodCallback<Map<ResultType, Integer>> callback);
Expand Down

0 comments on commit 8a44dc7

Please sign in to comment.