/** * @return the time elapsed between the last update and the start time of the procedure. */ public long elapsedTime() { return getLastUpdate() - getSubmittedTime(); }
/** * Timeout of the next timeout. * Called by the ProcedureExecutor if the procedure has timeout set and * the procedure is in the waiting queue. * @return the timestamp of the next timeout. */ protected long getTimeoutTimestamp() { return getLastUpdate() + getTimeout(); }
/** * Extend the toString() information with more procedure details */ public String toStringDetails() { final StringBuilder sb = toStringSimpleSB(); sb.append(" submittedTime="); sb.append(getSubmittedTime()); sb.append(", lastUpdate="); sb.append(getLastUpdate()); final int[] stackIndices = getStackIndexes(); if (stackIndices != null) { sb.append("\n"); sb.append("stackIndexes="); sb.append(Arrays.toString(stackIndices)); } return sb.toString(); }
public boolean isExpired(long now, long evictTtl, long evictAckTtl) { return (hasClientAckTime() && (now - getClientAckTime()) >= evictAckTtl) || (now - procedure.getLastUpdate()) >= evictTtl; } }
public static String describe(Procedure<?> proc) { Map<String, Object> description = new LinkedHashMap<>(); description.put("ID", proc.getProcId()); description.put("PARENT_ID", proc.getParentProcId()); description.put("STATE", proc.getState()); description.put("OWNER", proc.getOwner()); description.put("TYPE", proc.getProcName()); description.put("START_TIME", new Date(proc.getSubmittedTime())); description.put("LAST_UPDATE", new Date(proc.getLastUpdate())); if (proc.isFailed()) { description.put("ERRORS", MasterProcedureUtil.unwrapRemoteIOException(proc).getMessage()); } description.put("PARAMETERS", parametersToObject(proc)); return JRubyFormat.print(description); }
@Test public void testSingleStepProcRecovery() throws Exception { Procedure proc = new TestSingleStepProcedure(); procExecutor.testing.killBeforeStoreUpdate = true; long procId = ProcedureTestingUtility.submitAndWait(procExecutor, proc); assertFalse(procExecutor.isRunning()); procExecutor.testing.killBeforeStoreUpdate = false; // Restart and verify that the procedures restart long restartTs = EnvironmentEdgeManager.currentTime(); restart(); waitProcedure(procId); Procedure<?> result = procExecutor.getResult(procId); assertTrue(result.getLastUpdate() > restartTs); ProcedureTestingUtility.assertProcNotFailed(result); assertEquals(1, Bytes.toInt(result.getResult())); long resultTs = result.getLastUpdate(); // Verify that after another restart the result is still there restart(); result = procExecutor.getResult(procId); ProcedureTestingUtility.assertProcNotFailed(result); assertEquals(resultTs, result.getLastUpdate()); assertEquals(1, Bytes.toInt(result.getResult())); }
if (result != null) { builder.setSubmittedTime(result.getSubmittedTime()); builder.setLastUpdate(result.getLastUpdate()); if (executor.isFinished(procId)) { builder.setState(GetProcedureResultResponse.State.FINISHED);
out.print( new Date(proc.getSubmittedTime()) ); out.write("</td>\n <td>"); out.print( new Date(proc.getLastUpdate()) ); out.write("</td>\n <td>"); out.print( escapeXml(proc.isFailed() ? proc.getException().unwrapRemoteIOException().getMessage() : "") );
.setState(proc.getState()) .setSubmittedTime(proc.getSubmittedTime()) .setLastUpdate(proc.getLastUpdate());
/** * @return the time elapsed between the last update and the start time of the procedure. */ public long elapsedTime() { return getLastUpdate() - getSubmittedTime(); }
/** * Timeout of the next timeout. * Called by the ProcedureExecutor if the procedure has timeout set and * the procedure is in the waiting queue. * @return the timestamp of the next timeout. */ protected long getTimeoutTimestamp() { return getLastUpdate() + getTimeout(); }
/** * @return the time elapsed between the last update and the start time of the procedure. */ public long elapsedTime() { return getLastUpdate() - getSubmittedTime(); }
/** * Extend the toString() information with more procedure details */ public String toStringDetails() { final StringBuilder sb = toStringSimpleSB(); sb.append(" submittedTime="); sb.append(getSubmittedTime()); sb.append(", lastUpdate="); sb.append(getLastUpdate()); final int[] stackIndices = getStackIndexes(); if (stackIndices != null) { sb.append("\n"); sb.append("stackIndexes="); sb.append(Arrays.toString(stackIndices)); } return sb.toString(); }
/** * Timeout of the next timeout. * Called by the ProcedureExecutor if the procedure has timeout set and * the procedure is in the waiting queue. * @return the timestamp of the next timeout. */ @InterfaceAudience.Private protected long getTimeoutTimestamp() { return getLastUpdate() + getTimeout(); }
/** * Extend the toString() information with more procedure * details */ public String toStringDetails() { final StringBuilder sb = toStringSimpleSB(); sb.append(" submittedTime="); sb.append(getSubmittedTime()); sb.append(", lastUpdate="); sb.append(getLastUpdate()); final int[] stackIndices = getStackIndexes(); if (stackIndices != null) { sb.append("\n"); sb.append("stackIndexes="); sb.append(Arrays.toString(stackIndices)); } return sb.toString(); }
public boolean isExpired(long now, long evictTtl, long evictAckTtl) { return (hasClientAckTime() && (now - getClientAckTime()) >= evictAckTtl) || (now - procedure.getLastUpdate()) >= evictTtl; } }
public boolean isExpired(long now, long evictTtl, long evictAckTtl) { return (hasClientAckTime() && (now - getClientAckTime()) >= evictAckTtl) || (now - procedure.getLastUpdate()) >= evictTtl; } }
@Test public void testSingleStepProcRecovery() throws Exception { Procedure proc = new TestSingleStepProcedure(); procExecutor.testing.killBeforeStoreUpdate = true; long procId = ProcedureTestingUtility.submitAndWait(procExecutor, proc); assertFalse(procExecutor.isRunning()); procExecutor.testing.killBeforeStoreUpdate = false; // Restart and verify that the procedures restart long restartTs = EnvironmentEdgeManager.currentTime(); restart(); waitProcedure(procId); Procedure<?> result = procExecutor.getResult(procId); assertTrue(result.getLastUpdate() > restartTs); ProcedureTestingUtility.assertProcNotFailed(result); assertEquals(1, Bytes.toInt(result.getResult())); long resultTs = result.getLastUpdate(); // Verify that after another restart the result is still there restart(); result = procExecutor.getResult(procId); ProcedureTestingUtility.assertProcNotFailed(result); assertEquals(resultTs, result.getLastUpdate()); assertEquals(1, Bytes.toInt(result.getResult())); }
@Test public void testSingleStepProcRecovery() throws Exception { Procedure proc = new TestSingleStepProcedure(); procExecutor.testing.killBeforeStoreUpdate = true; long procId = ProcedureTestingUtility.submitAndWait(procExecutor, proc); assertFalse(procExecutor.isRunning()); procExecutor.testing.killBeforeStoreUpdate = false; // Restart and verify that the procedures restart long restartTs = EnvironmentEdgeManager.currentTime(); restart(); waitProcedure(procId); Procedure<?> result = procExecutor.getResult(procId); assertTrue(result.getLastUpdate() > restartTs); ProcedureTestingUtility.assertProcNotFailed(result); assertEquals(1, Bytes.toInt(result.getResult())); long resultTs = result.getLastUpdate(); // Verify that after another restart the result is still there restart(); result = procExecutor.getResult(procId); ProcedureTestingUtility.assertProcNotFailed(result); assertEquals(resultTs, result.getLastUpdate()); assertEquals(1, Bytes.toInt(result.getResult())); }
.setState(proc.getState()) .setSubmittedTime(proc.getSubmittedTime()) .setLastUpdate(proc.getLastUpdate());