private OutputAttemptContext context() { return new OutputAttemptContext("tx", "at", "o", counter); }
private OutputAttemptContext createOutputContext() { String tx = UUID.randomUUID().toString(); String attempt = UUID.randomUUID().toString(); return new OutputAttemptContext(tx, attempt, id, new Counter()); }
/** * 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 OutputAttemptContext createContext(TaskAttemptContext 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); String attemptId = getAttemptId(context, datasourceId); return new OutputAttemptContext(transactionId, attemptId, datasourceId, createCounter(context)); }
/** * Initializes the test. * @throws Exception if some errors were occurred */ @Before public void setUp() throws Exception { conf = new Configuration(true); if (definition.getDataFormat() instanceof Configurable) { ((Configurable) definition.getDataFormat()).setConf(conf); } mapping = new File(temp.getRoot(), "mapping").getCanonicalFile(); temporary = new File(temp.getRoot(), "temporary").getCanonicalFile(); localtemp = new File(temp.getRoot(), "localtemp").getCanonicalFile(); profile = new HadoopDataSourceProfile( conf, "testing", "testing", new Path(mapping.toURI()), new Path(temporary.toURI())); context = new OutputAttemptContext("tx", "atmpt", profile.getId(), new Counter()); }
DirectDataSource ds = repo.getRelatedDataSource(path); OutputTransactionContext txContext = HadoopDataSourceUtil.createContext(executionId, id); OutputAttemptContext aContext = new OutputAttemptContext( txContext.getTransactionId(), String.valueOf(index),