private boolean allOperationsCompleted() { try { if (generator.isStopped()) { return counterResults.longValue() >= generator.generatedOpCount(); } } catch (final RemoteException ignored) { } return false; }
private boolean isNothingToRecycle() { final long resultCount = counterResults.sum(); return recycleFlag && generator.isNothingToRecycle() && // all generated ops executed at least once resultCount > 0 && resultCount >= generator.generatedOpCount() && // no successful op results latestSuccOpResultByItem.size() == 0; }
private boolean isFinished() { return outputFinishFlag || itemInputFinishFlag && opInputFinishFlag && generatedOpCount() == outputOpCounter.sum(); }
new LoadGeneratorImpl( itemInput, opsBuilder, false, shuffleFlag)) { loadGenerator.start(); TimeUnit.SECONDS.sleep(TIME_LIMIT); System.out.println(loadGenerator.toString() + " rate: " + counter.sum() / TIME_LIMIT);
@Override public boolean put(final T item) throws IOException { loadGenerator.recycle((Operation) item); return super.put(item); }
@Override protected void doStart() throws IllegalStateException { try { resultsTransferTask.start(); } catch (final RemoteException ignored) { } try { driver.start(); } catch (final RemoteException ignored) { } catch (final IllegalStateException e) { LogUtil.exception(Level.WARN, e, "{}: failed to start the storage driver \"{}\"", id, driver); } try { generator.start(); } catch (final RemoteException ignored) { } catch (final IllegalStateException e) { LogUtil.exception( Level.WARN, e, "{}: failed to start the load generator \"{}\"", id, generator); } }
@Override protected final void doStop() throws IllegalStateException { super.doStop(); Loggers.MSG.debug( "{}: generated {}, recycled {}, output {} operations", LoadGeneratorImpl.this.toString(), builtTasksCounter.sum(), recycledOpCounter.sum(), outputOpCounter.sum()); }
@Override @SuppressWarnings("unchecked") public LoadGeneratorBuilderImpl<I, O, T> itemInput(final Input<I> itemInput) throws InterruptRunException { this.itemInput = itemInput; // pipeline transfer buffer is not resettable if (!(itemInput instanceof TransferConvertBuffer)) { sizeEstimate = estimateTransferSize( null, OpType.valueOf(loadConfig.stringVal("op-type").toUpperCase()), (Input<DataItem>) itemInput); } return this; }
@Override protected final void doShutdown() { try (final Instance ctx = CloseableThreadContext.put(KEY_STEP_ID, id) .put(KEY_CLASS_NAME, getClass().getSimpleName())) { generator.stop(); Loggers.MSG.debug("{}: load generator \"{}\" stopped", id, generator.toString()); } catch (final RemoteException ignored) { } try (final Instance ctx = CloseableThreadContext.put(KEY_STEP_ID, id) .put(KEY_CLASS_NAME, getClass().getSimpleName())) { driver.shutdown(); Loggers.MSG.debug("{}: storage driver {} shutdown", id, driver.toString()); } catch (final RemoteException ignored) { } }
"{}: done due to all {} load operations have been completed", id, generator.generatedOpCount()); return true;
@Override protected final void doClose() throws InterruptRunException { try (final Instance logCtx = CloseableThreadContext.put(KEY_STEP_ID, id) .put(KEY_CLASS_NAME, getClass().getSimpleName())) { try { generator.close(); } catch (final IOException e) { LogUtil.exception( Level.ERROR, e, "Failed to close the load generator \"{}\"", generator.toString()); } try { driver.close(); } catch (final IOException e) { LogUtil.exception( Level.ERROR, e, "Failed to close the storage driver \"{}\"", driver.toString()); } try { resultsTransferTask.close(); } catch (final IOException e) { LogUtil.exception( Level.WARN, e, "{}: failed to stop the service coroutine {}", resultsTransferTask); } Loggers.MSG.debug("{}: closed the load step context", id); } } }
new LoadGeneratorImpl( itemInput, opsBuilder, false, shuffleFlag)) { loadGenerator.start(); TimeUnit.SECONDS.sleep(TIME_LIMIT); System.out.println(
@Override public int put(final List<T> buffer, final int from, final int to) throws IOException { for (int i = from; i < to; i++) { loadGenerator.recycle((Operation) buffer.get(i)); } return super.put(buffer, from, to); }
@Override protected final void doClose() throws InterruptRunException, IOException { recycleQueue.clear(); // the item input may be instantiated by the load generator builder which has no reference to it // so the load // generator builder should close it if (itemInput != null) { try { inputLock.tryLock(Fiber.WARN_DURATION_LIMIT_NANOS, TimeUnit.NANOSECONDS); itemInput.close(); } catch (final InterruptedException e) { throw new InterruptRunException(e); } catch (final Exception e) { LogUtil.exception(Level.WARN, e, "{}: failed to close the item input", toString()); } } // ops builder is instantiated by the load generator builder which forgets it so the load // generator should // close it opsBuilder.close(); }
new LoadGeneratorImpl( itemInput, opsBuilder, false, shuffleFlag)) { loadGenerator.start(); TimeUnit.SECONDS.sleep(TIME_LIMIT); System.out.println(
@Override public int put(final List<T> buffer) throws IOException { for (int i = 0; i < buffer.size(); i++) { loadGenerator.recycle((Operation) buffer.get(i)); } return super.put(buffer); } }
new LoadGeneratorImpl<>( itemInput, opsBuilder, false, shuffleFlag)) { loadGenerator.start(); TimeUnit.SECONDS.sleep(TIME_LIMIT); System.out.println(loadGenerator.toString() + " rate: " + counter.sum() / TIME_LIMIT);
new LoadGeneratorImpl( itemInput, opsBuilder, false, shuffleFlag)) { loadGenerator.start(); TimeUnit.SECONDS.sleep(TIME_LIMIT); System.out.println(
new LoadGeneratorImpl( itemInput, opsBuilder, false, shuffleFlag)) { loadGenerator.start(); TimeUnit.SECONDS.sleep(TIME_LIMIT); System.out.println(