本文整理汇总了Java中com.ociweb.pronghorn.stage.scheduling.GraphManager.isStageTerminated方法的典型用法代码示例。如果您正苦于以下问题:Java GraphManager.isStageTerminated方法的具体用法?Java GraphManager.isStageTerminated怎么用?Java GraphManager.isStageTerminated使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.ociweb.pronghorn.stage.scheduling.GraphManager
的用法示例。
在下文中一共展示了GraphManager.isStageTerminated方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: runGraph
import com.ociweb.pronghorn.stage.scheduling.GraphManager; //导入方法依赖的package包/类
private String runGraph(Pipe<PersistedBlobStoreSchema> perStore, boolean encryption, boolean telemetry) {
///////////////////////////////
GraphManager gm = new GraphManager();
if (telemetry) {
gm.enableTelemetry(8089);
}
byte multi = 3;
byte bits = 16;
short inFlightCount = 20;
int largestBlock = 1<<12;
File dir=null;
byte[] cypher = null;
if (encryption) {
cypher = new byte[16];
new Random(123).nextBytes(cypher);
}
long rate = 2400;
Pipe<PersistedBlobLoadSchema> perLoad = FileGraphBuilder.buildSequentialReplayer(gm, perStore, multi, bits, inFlightCount,
largestBlock, dir, cypher,rate, null);
StringBuilder result = new StringBuilder();
ConsoleJSONDumpStage watch = ConsoleJSONDumpStage.newInstance(gm, perLoad, result);
/////////////////////////////////////////
/////////////////////////////////////////
NonThreadScheduler scheduler = new NonThreadScheduler(gm);
scheduler.startup();
while (!GraphManager.isStageTerminated(gm, watch.stageId) ) {
scheduler.run();
Thread.yield();
}
while (telemetry) {
scheduler.run();
}
scheduler.shutdown();
///////////////////////
return result.toString();
}
示例2: fileBlobWriteTest
import com.ociweb.pronghorn.stage.scheduling.GraphManager; //导入方法依赖的package包/类
@Test
public void fileBlobWriteTest() {
try {
GraphManager gm = new GraphManager();
PipeConfig<RawDataSchema> config = new PipeConfig<RawDataSchema>(RawDataSchema.instance, 10, 65536);
Pipe<RawDataSchema> inputPipe = new Pipe<RawDataSchema>(config);
File f2 = File.createTempFile("roundTipTestB", "dat");
f2.deleteOnExit();
boolean append = false;
new ByteArrayProducerStage(gm, rawData, inputPipe);
FileBlobWriteStage lastStage = new FileBlobWriteStage(gm, inputPipe, append, f2.getAbsolutePath()); //TODO: need a FileBlobRead that can tail a file
GraphManager.enableBatching(gm);
NonThreadScheduler scheduler= new NonThreadScheduler(gm);
scheduler.startup();
while (!GraphManager.isStageTerminated(gm, lastStage.stageId)) {
scheduler.run();
}
scheduler.shutdown();
confirmFileContentsMatchTestData(f2);
} catch (Exception e) {
e.printStackTrace();
fail();
}
}
示例3: testReadWriteStage
import com.ociweb.pronghorn.stage.scheduling.GraphManager; //导入方法依赖的package包/类
@Test
public void testReadWriteStage() {
File file = null;
try {
file = File.createTempFile("testReadWriteStageTest", "dat");
} catch (IOException e) {
e.printStackTrace();
}
String[] paths = new String[] {file.getAbsolutePath()};
GraphManager gm = new GraphManager();
Pipe<SequentialCtlSchema>[] control = new Pipe[]{SequentialCtlSchema.instance.newPipe(10, 1000)};
Pipe<RawDataSchema>[] input = new Pipe[]{RawDataSchema.instance.newPipe(10, 1000)};
Pipe<RawDataSchema>[] output = new Pipe[]{RawDataSchema.instance.newPipe(10, 1000)};
Pipe<SequentialRespSchema>[] response = new Pipe[]{SequentialRespSchema.instance.newPipe(10, 1000)};
control[0].initBuffers();
input[0].initBuffers();
//data to be written
Pipe.addMsgIdx(input[0], 0);
Pipe.addByteArray("hello".getBytes(), input[0]);
Pipe.confirmLowLevelWrite(input[0]);
Pipe.publishWrites(input[0]);
SequentialCtlSchema.publishIdToSave(control[0], 123);
//this replay command is expected to only happen after the data is written since pipe has data.
SequentialCtlSchema.publishReplay(control[0]);
SequentialCtlSchema.publishMetaRequest(control[0]);
PipeWriter.publishEOF(control[0]);
SequentialFileReadWriteStage readWriteStage = new SequentialFileReadWriteStage(gm, control, response, input, output, paths);
StringBuilder outputData = new StringBuilder();
StringBuilder responseData = new StringBuilder();
ConsoleJSONDumpStage watch = ConsoleJSONDumpStage.newInstance(gm, output[0],outputData);
ConsoleJSONDumpStage.newInstance(gm, response[0], responseData);
NonThreadScheduler scheduler= new NonThreadScheduler(gm);
scheduler.startup();
while ( (!GraphManager.isStageTerminated(gm, watch.stageId)) ) {
scheduler.run();
}
scheduler.shutdown();
String responseString = responseData.toString();
assertTrue(responseString, responseString.indexOf("WriteAck")>=0);
assertTrue(responseString, responseString.indexOf("{\"Size\":5}")>=0);
String outputString = outputData.toString();
assertTrue(outputString, outputString.indexOf("0x68,0x65,0x6c,0x6c,0x6f")>=0);
}
示例4: roundTripTest
import com.ociweb.pronghorn.stage.scheduling.GraphManager; //导入方法依赖的package包/类
@Test
public void roundTripTest() {
try {
/////////////////////////
//create test file with known random data
/////////////////////////
File f = fileFullOfTestData();
File f2 = File.createTempFile("roundTipTest", "dat");
f2.deleteOnExit();
GraphManager gm = new GraphManager();
PipeConfig<RawDataSchema> config = new PipeConfig<RawDataSchema>(RawDataSchema.instance, 10, 65536);
Pipe<RawDataSchema> inputPipe = new Pipe<RawDataSchema>(config);
Pipe<RawDataSchema> midCheckPipe = new Pipe<RawDataSchema>(config.grow2x());
Pipe<RawDataSchema> outputPipe = new Pipe<RawDataSchema>(config.grow2x());
new FileBlobReadStage(gm, inputPipe,f.getAbsolutePath());
new ReplicatorStage(gm, inputPipe, midCheckPipe, outputPipe);
ByteArrayOutputStream outputStream = new ByteArrayOutputStream(testSize);
ToOutputStreamStage lastStage1 = new ToOutputStreamStage(gm, midCheckPipe, outputStream, false);
// ConsoleStage cs = new ConsoleStage(gm, midCheckPipe);
boolean append = false;
FileBlobWriteStage lastStage2 = new FileBlobWriteStage(gm, outputPipe, append, f2.getAbsolutePath());
//MonitorConsoleStage.attach(gm);
// gm.enableTelemetry(8089);
NonThreadScheduler scheduler= new NonThreadScheduler(gm);
scheduler.startup();
while ( (!GraphManager.isStageTerminated(gm, lastStage1.stageId))
|| (!GraphManager.isStageTerminated(gm, lastStage2.stageId))) {
scheduler.run();
}
scheduler.shutdown();
//when done check the captured bytes from teh middle to ensure they match
assertArrayEquals(rawData, outputStream.toByteArray());
//when done read the file from disk one more time and confirm its the same
confirmFileContentsMatchTestData(f2);
} catch (IOException e) {
fail(e.getMessage());
}
}