Search in sources :

Example 1 with StopStatus

use of com.microsoft.frameworklauncher.common.service.StopStatus in project pai by Microsoft.

the class ApplicationMaster method stopForContainer.

private void stopForContainer(int exitCode, String diagnostics, String customizedDiagnostics) {
    ExitStatusValue partialValue = new ExitStatusValue(exitCode, diagnostics, null);
    String fullDiagnostics = ExitDiagnostics.generateDiagnostics(partialValue, customizedDiagnostics);
    ExitStatusKey exitStatusKey = ExitDiagnostics.extractExitStatusKey(fullDiagnostics);
    stop(new StopStatus(exitStatusKey.toInt(), true, fullDiagnostics));
}
Also used : StopStatus(com.microsoft.frameworklauncher.common.service.StopStatus) ExitStatusKey(com.microsoft.frameworklauncher.common.exit.ExitStatusKey) ExitStatusValue(com.microsoft.frameworklauncher.common.exit.ExitStatusValue)

Example 2 with StopStatus

use of com.microsoft.frameworklauncher.common.service.StopStatus in project pai by Microsoft.

the class Service method handleException.

@Override
protected Boolean handleException(Exception e) {
    super.handleException(e);
    if (e instanceof NonTransientException) {
        LOGGER.logError(e, "NonTransientException occurred in %1$s. %1$s will be stopped.", serviceName);
        stop(new StopStatus(ExitStatusKey.LAUNCHER_INTERNAL_NON_TRANSIENT_ERROR.toInt(), true, null, e));
        return false;
    } else {
        LOGGER.logError(e, "Exception occurred in %1$s. It should be transient. Will restart %1$s inplace.", serviceName);
        // TODO: Only Restart Service instead of exit whole process and Restart by external system.
        stop(new StopStatus(ExitStatusKey.LAUNCHER_INTERNAL_UNKNOWN_ERROR.toInt(), false, null, e));
        return true;
    }
}
Also used : NonTransientException(com.microsoft.frameworklauncher.common.exceptions.NonTransientException) StopStatus(com.microsoft.frameworklauncher.common.service.StopStatus)

Example 3 with StopStatus

use of com.microsoft.frameworklauncher.common.service.StopStatus in project pai by Microsoft.

the class WebServer method handleException.

protected Boolean handleException(Exception e) {
    super.handleException(e);
    if (e instanceof NonTransientException) {
        LOGGER.logError(e, "NonTransientException occurred in %1$s. %1$s will be stopped.", serviceName);
        stop(new StopStatus(ExitStatusKey.LAUNCHER_INTERNAL_NON_TRANSIENT_ERROR.toInt(), true, null, e));
        return false;
    } else {
        LOGGER.logError(e, "Exception occurred in %1$s. It should be transient. Will restart %1$s inplace.", serviceName);
        // TODO: Only Restart WebServer instead of exit whole process and Restart by external system.
        stop(new StopStatus(ExitStatusKey.LAUNCHER_INTERNAL_UNKNOWN_ERROR.toInt(), false, null, e));
        return true;
    }
}
Also used : NonTransientException(com.microsoft.frameworklauncher.common.exceptions.NonTransientException) StopStatus(com.microsoft.frameworklauncher.common.service.StopStatus)

Example 4 with StopStatus

use of com.microsoft.frameworklauncher.common.service.StopStatus in project pai by Microsoft.

the class ApplicationMaster method stopForInternalUnKnownError.

private void stopForInternalUnKnownError(String customizedDiagnostics) {
    String diagnostics = ExitDiagnostics.generateDiagnostics(ExitStatusKey.AM_INTERNAL_UNKNOWN_ERROR, customizedDiagnostics);
    stop(new StopStatus(ExitStatusKey.AM_INTERNAL_UNKNOWN_ERROR.toInt(), true, diagnostics));
}
Also used : StopStatus(com.microsoft.frameworklauncher.common.service.StopStatus)

Example 5 with StopStatus

use of com.microsoft.frameworklauncher.common.service.StopStatus in project pai by Microsoft.

the class ApplicationMaster method stopForInternalNonTransientError.

private void stopForInternalNonTransientError(String customizedDiagnostics) {
    String diagnostics = ExitDiagnostics.generateDiagnostics(ExitStatusKey.AM_INTERNAL_NON_TRANSIENT_ERROR, customizedDiagnostics);
    stop(new StopStatus(ExitStatusKey.AM_INTERNAL_NON_TRANSIENT_ERROR.toInt(), true, diagnostics));
}
Also used : StopStatus(com.microsoft.frameworklauncher.common.service.StopStatus)

Aggregations

StopStatus (com.microsoft.frameworklauncher.common.service.StopStatus)6 NonTransientException (com.microsoft.frameworklauncher.common.exceptions.NonTransientException)2 ExitStatusKey (com.microsoft.frameworklauncher.common.exit.ExitStatusKey)1 ExitStatusValue (com.microsoft.frameworklauncher.common.exit.ExitStatusValue)1