+ "---------- [%s UTC]%n", now.toString(formatter)); for (final TargetAndClient cc : clients) { final Optional<Target> target = cc.getTarget();
if (!json) { out.printf(Strings.repeat("-", MAX_WIDTH - timestampLength - 1) + " [%s UTC]%n", now.toString(formatter));
@Override public String toNonNullString(Instant value) { return value.toString(); }
private String windowToString(BoundedWindow window) { if (window instanceof GlobalWindow) { return "GlobalWindow"; } if (window instanceof IntervalWindow) { IntervalWindow iw = (IntervalWindow) window; return String.format("%s-%s", iw.start().toString(), iw.end().toString()); } return window.toString(); }
void tick () { duration -= 1; if (duration < 0) { log.error(getName() + "SE start at " + start.toString() + " ticked past duration " + duration); } usageIndex += 1; }
public static String getNowTimestampString() { LocalDateTime date = LocalDateTime.now(); String timestampString = date.toDateTime(timeZone).toInstant().toString(); return timestampString; }
@Override public void processElement(ProcessContext c) { String row = c.element().getKey() + " - " + c.element().getValue() + " @ " + c.timestamp().toString(); System.out.println(row); c.output(row); } }
@ProcessElement public void processElement(ProcessContext c) { String row = c.element().getKey() + " - " + c.element().getValue() + " @ " + c.timestamp().toString(); System.out.println(row); c.output(row); } }
@ProcessElement public void processElement(ProcessContext c) { String row = c.element().getKey() + " - " + c.element().getValue() + " @ " + c.timestamp().toString(); c.output(row); } }
@Override public void processElement(ProcessContext c) { String row = c.element().getKey() + " - " + c.element().getValue() + " @ " + c.timestamp().toString(); c.output(row); } }
@ProcessElement public void processElement(ProcessContext c, BoundedWindow window) { LOG.debug( "*** ELEMENT: ({},{}) *** with timestamp %s in window %s", c.element().getKey(), c.element().getValue(), c.timestamp().toString(), window.toString()); } }));
@Override public Trade getLastImpliedTrade(Listing listing) { if (listing == null) return null; try { long impliedPriceCount = impliedTradeMatrix.getRate(listing.getBase(), listing.getQuote()).getCount(); Market market = context.getInjector().getInstance(Market.class).findOrCreate(Exchanges.SELF, listing); return new Trade(market, Instant.now(), Instant.now().toString(), impliedPriceCount, 0L); } catch (java.lang.IllegalArgumentException e) { return null; } }
@Test public void addElementsAtEndOfTimeThrows() { Instant timestamp = BoundedWindow.TIMESTAMP_MAX_VALUE; WindowedValue<Integer> value = WindowedValue.timestampedValueInGlobalWindow(1, timestamp); UncommittedBundle<Integer> bundle = bundleFactory.createRootBundle(); thrown.expect(IllegalArgumentException.class); thrown.expectMessage(timestamp.toString()); bundle.add(value); }
@Test public void addElementsAtEndOfTimeThrows() { Instant timestamp = BoundedWindow.TIMESTAMP_MAX_VALUE; WindowedValue<Integer> value = WindowedValue.timestampedValueInGlobalWindow(1, timestamp); UncommittedBundle<Integer> bundle = bundleFactory.createRootBundle(); thrown.expect(IllegalArgumentException.class); thrown.expectMessage(timestamp.toString()); bundle.add(value); }
@ProcessElement public void processElement(ProcessContext c) { RouteInfo routeInfo = c.element().getValue(); TableRow row = new TableRow() .set("avg_speed", routeInfo.getAvgSpeed()) .set("slowdown_event", routeInfo.getSlowdownEvent()) .set("route", c.element().getKey()) .set("window_timestamp", c.timestamp().toString()); c.output(row); }
@ProcessElement public void processElement(ProcessContext c) { String row = c.element().getKey() + " - " + c.element().getValue() + " @ " + c.timestamp().toString(); c.output(row); } }
@Test public void timerUpdateBuilderWithSetAtEndOfTime() { Instant timerStamp = BoundedWindow.TIMESTAMP_MAX_VALUE; TimerData tooFar = TimerData.of(StateNamespaces.global(), timerStamp, TimeDomain.EVENT_TIME); TimerUpdateBuilder builder = TimerUpdate.builder(StructuralKey.empty()); thrown.expect(IllegalArgumentException.class); thrown.expectMessage(timerStamp.toString()); builder.setTimer(tooFar); }
@Test public void addElementsPastEndOfTimeThrows() { Instant timestamp = BoundedWindow.TIMESTAMP_MAX_VALUE.plus(Duration.standardMinutes(2)); WindowedValue<Integer> value = WindowedValue.timestampedValueInGlobalWindow(1, timestamp); UncommittedBundle<Integer> bundle = bundleFactory.createRootBundle(); thrown.expect(IllegalArgumentException.class); thrown.expectMessage(timestamp.toString()); bundle.add(value); }
@Test public void addElementsPastEndOfTimeThrows() { Instant timestamp = BoundedWindow.TIMESTAMP_MAX_VALUE.plus(Duration.standardMinutes(2)); WindowedValue<Integer> value = WindowedValue.timestampedValueInGlobalWindow(1, timestamp); UncommittedBundle<Integer> bundle = bundleFactory.createRootBundle(); thrown.expect(IllegalArgumentException.class); thrown.expectMessage(timestamp.toString()); bundle.add(value); }
@Test public void timerUpdateBuilderWithSetPastEndOfTime() { Instant timerStamp = BoundedWindow.TIMESTAMP_MAX_VALUE.plus(Duration.standardMinutes(2)); TimerData tooFar = TimerData.of(StateNamespaces.global(), timerStamp, TimeDomain.EVENT_TIME); TimerUpdateBuilder builder = TimerUpdate.builder(StructuralKey.empty()); thrown.expect(IllegalArgumentException.class); thrown.expectMessage(timerStamp.toString()); builder.setTimer(tooFar); }