private Path getTemporaryOutput(OutputTransactionContext context) { assert context != null; Path tempRoot = profile.getTemporaryFileSystemPath(); String suffix = String.format("%s-%s", //$NON-NLS-1$ context.getTransactionId(), context.getOutputId()); return append(tempRoot, suffix); }
/** * Returns the corresponded transaction context. * @return the transaction context */ public OutputTransactionContext getTransactionContext() { return new OutputTransactionContext(transactionId, outputId, counter); }
throw (IOException) new InterruptedIOException(MessageFormat.format( "Interrupted while commit transaction: {0}, (path={1})", context.getTransactionId(), containerPath)).initCause(e); context.getCounter().add(1);
@Override public void commitTransactionOutput(OutputTransactionContext context) throws IOException, InterruptedException { if (context == null) { throw new IllegalArgumentException("context must not be null"); //$NON-NLS-1$ } Counter counter = context.getCounter(); heartbeat.register(counter); try { entity.commitTransactionOutput(context); } finally { heartbeat.unregister(counter); } }
throw (IOException) new InterruptedIOException(MessageFormat.format( "Interrupted while cleanup transaction: {0}, (path={1})", context.getTransactionId(), containerPath)).initCause(e); context.getCounter().add(1);
@Override public void setupTransactionOutput(OutputTransactionContext context) throws IOException, InterruptedException { if (context == null) { throw new IllegalArgumentException("context must not be null"); //$NON-NLS-1$ } Counter counter = context.getCounter(); heartbeat.register(counter); try { entity.setupTransactionOutput(context); } finally { heartbeat.unregister(counter); } }
OutputTransactionContext txContext = HadoopDataSourceUtil.createContext(executionId, id); OutputAttemptContext aContext = new OutputAttemptContext( txContext.getTransactionId(), String.valueOf(index), txContext.getOutputId(), new Counter());
throw (IOException) new InterruptedIOException(MessageFormat.format( "Interrupted while setup transaction: {0}, (path={1})", context.getTransactionId(), containerPath)).initCause(e); context.getCounter().add(1);
@Override public void cleanupTransactionOutput(OutputTransactionContext context) throws IOException, InterruptedException { if (context == null) { throw new IllegalArgumentException("context must not be null"); //$NON-NLS-1$ } Counter counter = context.getCounter(); heartbeat.register(counter); try { entity.cleanupTransactionOutput(context); } finally { heartbeat.unregister(counter); } }
/** * Creates output context from execution ID and datasource ID. * @param executionId current execution ID * @param datasourceId target datasource ID * @return output context * @throws IllegalArgumentException if some parameters were {@code null} */ public static OutputTransactionContext createContext(String executionId, String datasourceId) { if (executionId == null) { throw new IllegalArgumentException("executionId must not be null"); //$NON-NLS-1$ } if (datasourceId == null) { throw new IllegalArgumentException("datasourceId must not be null"); //$NON-NLS-1$ } return new OutputTransactionContext(executionId, datasourceId, new Counter()); }
@Override public void commitTransactionOutput(OutputTransactionContext context) throws IOException, InterruptedException { if (profile.isOutputStaging()) { FileSystem fs = profile.getFileSystem(); Path staging = getStagingOutput(context); Path target = profile.getFileSystemPath(); if (LOG.isDebugEnabled()) { LOG.debug(MessageFormat.format( "Commit staging area (id={0}, path={1})", //$NON-NLS-1$ profile.getId(), staging)); } HadoopDataSourceUtil.move(context.getCounter(), fs, staging, target, profile.getRollforwardThreads()); } }
/** * Creates output context from Hadoop context. * @param context current context in Hadoop * @param datasourceId datasource ID * @return the created context * @throws IllegalArgumentException if some parameters were {@code null} */ public static OutputTransactionContext createContext(JobContext context, String datasourceId) { if (context == null) { throw new IllegalArgumentException("context must not be null"); //$NON-NLS-1$ } if (datasourceId == null) { throw new IllegalArgumentException("datasourceId must not be null"); //$NON-NLS-1$ } String transactionId = getTransactionId(context, datasourceId); return new OutputTransactionContext(transactionId, datasourceId, createCounter(context)); }
pattern)); boolean succeed = repo.delete(basePath, resources, true, context.getCounter()); if (LOG.isDebugEnabled()) { LOG.debug(MessageFormat.format(