/** * Sets the state of the split to {@code null}. */ public void resetSplitState() { this.setSplitState(null); }
@Override public String toString() { return "[" + getSplitNumber() + "] " + getPath() + " mod@ " + modificationTime + " : " + getStart() + " + " + getLength(); } }
public void cancel() { // important: marking the source as stopped has to happen before the function is stopped. // the flag that tracks this status is volatile, so the memory model also guarantees // the happens-before relationship markCanceledOrStopped(); userFunction.cancel(); // the context may not be initialized if the source was never running. if (ctx != null) { ctx.close(); } }
@Override public void run(SourceContext<String> ctx) throws Exception { while (running) { ctx.collect("hello"); } }
@Override public void run(SourceContext<Tuple2<Integer, Long>> ctx) throws Exception { Object lock = ctx.getCheckpointLock(); while (count < NUM_INPUT){ synchronized (lock){ for (int i = 0; i < PARALLELISM; i++) { ctx.collect(Tuple2.of(i, count + 1)); } count++; } } }
@Override public void close() throws Exception { super.close(); client.close(); }
@Override public void open(Configuration parameters) throws Exception { super.open(parameters); running = true; }
public void run(SourceContext<Object> ctx) throws Exception { try { this.fun.run(ctx); } catch (PyException pe) { throw createAndLogException(pe); } }
@Override public void open(Configuration parameters) throws Exception { super.open(parameters); }
@Override public InputSplit next() { if (this.nextSplit == null && !hasNext()) { throw new NoSuchElementException(); } final InputSplit tmp = this.nextSplit; this.nextSplit = null; return tmp; }
@Override public void run() { try { source.run(ctx); } catch (Throwable t) { error[0] = t; } } };
public void waitUntilDone() throws InterruptedException { join(); if (error != null) { throw new RuntimeException("Error in source thread", error); } } }
@Override public void setRuntimeContext(RuntimeContext t) { ACTUAL_ORDER_TRACKING.add("UDF::setRuntimeContext"); super.setRuntimeContext(t); }
@Override public void run(SourceContext<Integer> ctx) throws Exception { for (int i = 0; i < numWatermarks; i++) { ctx.collect(i); } }
@Override public void open(Configuration parameters) throws Exception { super.open(parameters); client = new SiteToSiteClient.Builder().fromConfig(clientConfig).build(); }
@Override public void run(SourceContext<Integer> collector) throws Exception { while (counter < 8200) { collector.collect(getTrainingData()); } }
@Override public void run(SourceContext<String> ctx) throws Exception { if (!openCalled) { Assert.fail("Open was not called before run."); } for (int i = 0; i < 10; i++) { ctx.collect("Hello" + i); } }
@Override public void run(SourceContext<Tuple2<String, Integer>> ctx) throws Exception { ctx.collect(Tuple2.of("a", 0)); ctx.collect(Tuple2.of("a", 1)); ctx.collect(Tuple2.of("b", 3)); ctx.collect(Tuple2.of("c", 6)); ctx.collect(Tuple2.of("c", 7)); ctx.collect(Tuple2.of("c", 8)); // source is finite, so it will have an implicit MAX watermark when it finishes }
@Override public void run(SourceContext<Tuple3<String, String, Integer>> ctx) throws Exception { ctx.collect(Tuple3.of("a", "x", 0)); ctx.collect(Tuple3.of("a", "y", 1)); ctx.collect(Tuple3.of("a", "z", 2)); ctx.collect(Tuple3.of("b", "u", 3)); ctx.collect(Tuple3.of("b", "w", 5)); ctx.collect(Tuple3.of("a", "i", 6)); ctx.collect(Tuple3.of("a", "j", 7)); ctx.collect(Tuple3.of("a", "k", 8)); // source is finite, so it will have an implicit MAX watermark when it finishes }