private void abort(GridProcess gridProcess, List<IResponseTO> responses) { if (gridProcess.getState().isRunnable()) { gridProcess.setGridProcessState(GridProcessState.ABORTED); gridProcess.getReplicaAccounting().setState(GridProcessState.ABORTED); GridProcessAccounting accounting = setAccountingFields(gridProcess); accounting.setTransfersProgress(convertTransfer(gridProcess.getTransfersProgress())); reportReplicaAccounting(gridProcess, responses); gridProcess.getOperations().cancelOperations(responses); executionEnded(gridProcess, GridProcessState.ABORTED, responses); } }
private GridProcessAccounting setAccountingFields(GridProcess process) { GridProcessAccounting accounting = process.getReplicaAccounting(); GridProcessExecutionResult result = process.getResult(); GridProcessPhasesData phasesData = new GridProcessPhasesData(); phasesData.setInitBeginning(result.getInitData().getStartTime()); phasesData.setInitEnd(result.getInitData().getEndTime()); phasesData.setRemoteBeginning(result.getRemoteData().getStartTime()); phasesData.setRemoteEnd(result.getRemoteData().getEndTime()); phasesData.setFinalBeginning(result.getFinalData().getStartTime()); phasesData.setFinalEnd(result.getFinalData().getEndTime()); phasesData.setInitOperations(result.getInitOperations()); phasesData.setGetOperations(result.getGetOperations()); accounting.setPhasesData(phasesData); GridProcessResultInfo resultInfo = new GridProcessResultInfo(); GridProcessError error = result.getExecutionError(); if (error != null && error.getErrorCause() != null) { resultInfo.setErrorCause(error.getErrorCause().getMessage()); resultInfo.setExecutionErrorType(error.getType().getName()); } ExecutorResult executorResult = result.getExecutorResult(); if (executorResult != null) { resultInfo.setExitValue(executorResult.getExitValue()); resultInfo.setStderr(executorResult.getStderr()); resultInfo.setStdout(executorResult.getStdout()); } accounting.setResultInfo(resultInfo); accounting.setCreationTime(process.getCreationTime()); accounting.setLatestPhase(process.getState().toString()); SabotageCheckResult sabotageCheckResult = result.getSabotageCheckResult(); String sabotageCheck = sabotageCheckResult == null ? null : sabotageCheckResult.toString(); accounting.setSabotageCheck(sabotageCheck); accounting.setTaskSequenceNumber(process.getSpec().getTaskSequenceNumber()); accounting.setGridProcessSequenceNumber(process.getId()); accounting.setState(process.getState()); return accounting; }