use of io.datarouter.nodewatch.joblet.TableSpanSamplerJoblet.TableSpanSamplerJobletParams in project datarouter by hotpads.
the class TableSpanSamplerJobletCreator method createJobletPackage.
/*--------------------- create --------------------*/
private JobletPackage createJobletPackage(JobletPriority jobletPriority, TableSample start, TableSample end, long samplerId, boolean scanUntilEnd) {
Objects.requireNonNull(end);
// we want all joblets created by the parent job to have the same creation time so none have execution priority
Instant jobletCreationDate = Instant.ofEpochMilli(samplerStartMs);
int batchSequence = jobletBatchSequence++;
TableSampleKey startSampleKey = Optional.ofNullable(start).map(TableSample::getKey).orElse(null);
var params = new TableSpanSamplerJobletParams(scanUntilEnd, samplerStartMs, sampleSize, batchSize, startSampleKey, end, nodeNames, samplerId);
return JobletPackage.createDetailed(TableSpanSamplerJoblet.JOBLET_TYPE, jobletPriority, jobletCreationDate, batchSequence, false, params.nodeNames.getClientName(), null, params);
}
use of io.datarouter.nodewatch.joblet.TableSpanSamplerJoblet.TableSpanSamplerJobletParams in project datarouter by hotpads.
the class TableSamplerTestTool method executeJobletsAndCollectSamples.
public static List<TableSample> executeJobletsAndCollectSamples(DatarouterInjector injector, List<JobletPackage> jobletPackages) {
List<TableSample> results = new ArrayList<>();
for (JobletData jobletData : JobletPackage.getJobletDatas(jobletPackages)) {
TableSpanSamplerJoblet joblet = injector.getInstance(TableSpanSamplerJoblet.class);
JobletRequest jobletRequest = new JobletRequest();
// this field referenced by the joblet
jobletRequest.getKey().setCreated(System.currentTimeMillis());
joblet.setJobletRequest(jobletRequest);
TableSpanSamplerJobletParams params = new TableSpanSamplerJobletCodec().unmarshallData(jobletData.getData());
joblet.setJobletParams(params);
joblet.process();
results.addAll(joblet.getSamples());
}
return results;
}
Aggregations