本文整理汇总了Java中com.google.appengine.tools.pipeline.PipelineServiceFactory类的典型用法代码示例。如果您正苦于以下问题:Java PipelineServiceFactory类的具体用法?Java PipelineServiceFactory怎么用?Java PipelineServiceFactory使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PipelineServiceFactory类属于com.google.appengine.tools.pipeline包,在下文中一共展示了PipelineServiceFactory类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: waitToFinish
import com.google.appengine.tools.pipeline.PipelineServiceFactory; //导入依赖的package包/类
protected JobInfo waitToFinish(final String phase, final String handle) throws Exception {
PipelineService pipelineService = PipelineServiceFactory.newPipelineService();
JobInfo jobInfo = getJobInfo(pipelineService, phase, handle);
JobInfo.State state = jobInfo.getJobState();
int N = 24; // 2min
while (isRunning(state) && N > 0) {
N--;
sync(5 * 1000L); // 5sec
// new info lookup
jobInfo = getJobInfo(pipelineService, phase, handle);
state = jobInfo.getJobState();
}
if (N == 0 && isRunning(state)) {
throw new IllegalStateException("Failed to finish the job [ " + phase + " ]: " + handle + ", info: " + toInfo(jobInfo));
}
if (state != JobInfo.State.COMPLETED_SUCCESSFULLY) {
throw new IllegalStateException("Job " + handle + " failed [ " + phase + " ]: " + toInfo(jobInfo));
}
return jobInfo;
}
示例2: createMapreduce
import com.google.appengine.tools.pipeline.PipelineServiceFactory; //导入依赖的package包/类
private static String createMapreduce(String jobName) throws Exception {
MapReduceJob<String, String, String, String, List<List<String>>> mapReduceJob =
new MapReduceJob<>(
new MapReduceSpecification.Builder<String, String, String, String, List<List<String>>>()
.setJobName(jobName)
.setInput(input)
.setMapper(new TestMapper())
.setReducer(new TestReducer())
.setOutput(new InMemoryOutput<>())
.setNumReducers(2)
.build(),
new MapReduceSettings.Builder().setWorkerQueueName(QUEUE_NAME).build());
PipelineService pipelineService = PipelineServiceFactory.newPipelineService();
return pipelineService.startNewPipeline(mapReduceJob, new JobSetting.OnQueue(QUEUE_NAME));
}
示例3: execute
import com.google.appengine.tools.pipeline.PipelineServiceFactory; //导入依赖的package包/类
private void execute() throws NoSuchObjectException {
PipelineService service = PipelineServiceFactory.newPipelineService();
State state = getJobInfo(service);
if (state == COMPLETED_SUCCESSFULLY) {
logger.info("Cleanig pipeline: " + pipelineId);
service.deletePipelineRecords(pipelineId);
return;
}
if (state == RUNNING || state == WAITING_TO_RETRY) {
enqueue(pipelineId);
}
}
示例4: reload
import com.google.appengine.tools.pipeline.PipelineServiceFactory; //导入依赖的package包/类
@Override
public void reload(Class<? extends Pipe> pipeClazz) {
PipelineService service = PipelineServiceFactory.newPipelineService();
String pipelineId = service.startNewPipeline(new ReloadPipeJob(), pipeClazz);
ClearPipelineTask.enqueue(pipelineId);
}
示例5: getJobInfo
import com.google.appengine.tools.pipeline.PipelineServiceFactory; //导入依赖的package包/类
protected JobInfo getJobInfo(final String phase, final String handle) throws Exception {
PipelineService pipelineService = PipelineServiceFactory.newPipelineService();
return getJobInfo(pipelineService, phase, handle);
}