Search in sources :

Example 1 with GetAppResponse

use of mesosphere.marathon.client.model.v2.GetAppResponse in project pravega by pravega.

the class MarathonBasedService method isRunning.

@Override
public boolean isRunning() {
    try {
        GetAppResponse app = marathonClient.getApp(this.id);
        log.debug("App Details: {}", app);
        // and the state of application is healthy.
        if ((app.getApp().getTasksRunning().intValue() == app.getApp().getInstances().intValue()) && app.getApp().getTasksRunning().intValue() == app.getApp().getTasksHealthy().intValue()) {
            log.info("App {} is running", this.id);
            return true;
        } else {
            log.info("App {} is not running", this.id);
            return false;
        }
    } catch (MarathonException ex) {
        if (ex.getStatus() == NOT_FOUND.getStatusCode()) {
            log.info("App is not running : {}", this.id);
            return false;
        }
        throw new TestFrameworkException(RequestFailed, "Marathon Exception while fetching service details", ex);
    }
}
Also used : GetAppResponse(mesosphere.marathon.client.model.v2.GetAppResponse) TestFrameworkException(io.pravega.test.system.framework.TestFrameworkException) MarathonException(mesosphere.marathon.client.MarathonException)

Aggregations

TestFrameworkException (io.pravega.test.system.framework.TestFrameworkException)1 MarathonException (mesosphere.marathon.client.MarathonException)1 GetAppResponse (mesosphere.marathon.client.model.v2.GetAppResponse)1