-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #390 from OHDSI/status-endpoint
Add /api/v1/status endpoint
- Loading branch information
Showing
5 changed files
with
137 additions
and
1 deletion.
There are no files selected for viewing
23 changes: 23 additions & 0 deletions
23
...rc/main/java/com/odysseusinc/arachne/execution_engine_common/api/v1/dto/EngineStatus.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package com.odysseusinc.arachne.execution_engine_common.api.v1.dto; | ||
|
||
import java.time.Instant; | ||
import java.util.Map; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
import lombok.Setter; | ||
|
||
@Getter | ||
@Setter | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
public class EngineStatus { | ||
/** | ||
* The moment when EE has started. | ||
*/ | ||
private Instant started; | ||
/** | ||
* The list of | ||
*/ | ||
private Map<Long, ExecutionOutcome> submissions; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
engine/src/main/java/com/odysseusinc/arachne/executionengine/execution/FailedOverseer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
package com.odysseusinc.arachne.executionengine.execution; | ||
|
||
import com.odysseusinc.arachne.execution_engine_common.api.v1.dto.AnalysisRequestTypeDTO; | ||
import com.odysseusinc.arachne.execution_engine_common.api.v1.dto.ExecutionOutcome; | ||
import com.odysseusinc.arachne.execution_engine_common.api.v1.dto.Stage; | ||
import java.time.Instant; | ||
import java.util.concurrent.CompletableFuture; | ||
import java.util.function.BiConsumer; | ||
import lombok.Getter; | ||
|
||
/** | ||
* Dummy implementation to provide consistent status and callback reporting for analysis that failed to initialize. | ||
*/ | ||
@Getter | ||
public class FailedOverseer implements Overseer { | ||
private final Instant started; | ||
private final String message; | ||
private final AnalysisRequestTypeDTO type; | ||
private final CompletableFuture<ExecutionOutcome> result; | ||
private final ExecutionOutcome outcome; | ||
private final Throwable error; | ||
|
||
public FailedOverseer(Instant started, String message, AnalysisRequestTypeDTO type, Throwable error) { | ||
this.started = started; | ||
this.message = message; | ||
this.type = type; | ||
this.error = error; | ||
outcome = new ExecutionOutcome(Stage.INITIALIZE, message, message); | ||
result = CompletableFuture.completedFuture(outcome); | ||
} | ||
|
||
@Override | ||
public String getStdout() { | ||
return getMessage(); | ||
} | ||
|
||
@Override | ||
public CompletableFuture<ExecutionOutcome> abort() { | ||
return result; | ||
} | ||
|
||
@Override | ||
public String getEnvironment() { | ||
return null; | ||
} | ||
|
||
@Override | ||
public Overseer whenComplete(BiConsumer<ExecutionOutcome, Throwable> finalizer) { | ||
CompletableFuture.runAsync(() -> finalizer.accept(outcome, error)); | ||
return this; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters