本文整理汇总了Java中io.digdag.spi.TaskExecutionException.ofNextPolling方法的典型用法代码示例。如果您正苦于以下问题:Java TaskExecutionException.ofNextPolling方法的具体用法?Java TaskExecutionException.ofNextPolling怎么用?Java TaskExecutionException.ofNextPolling使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类io.digdag.spi.TaskExecutionException
的用法示例。
在下文中一共展示了TaskExecutionException.ofNextPolling方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: finishJob
import io.digdag.spi.TaskExecutionException; //导入方法依赖的package包/类
private TaskExecutionException finishJob(Job job, Config state) {
String duration = getDuration(job.started(), job.finished());
LOGGER.info("Job(id={}) finished in {}. status: {}",
job.id(), duration, job.state());
state.set(STATE_RESULT_CODE, job.result());
state.set(STATE_DURATION, duration);
state.remove(STATE_POLL_ITERATION);
state.remove(STATE_OFFSET);
if (job.result() != 0) {
state.set(STATE_REASON, job.reason());
}
return TaskExecutionException.ofNextPolling(0, ConfigElement.copyOf(state));
}
示例2: verifyPollingTaskExecutionExceptionIsNotSwallowed
import io.digdag.spi.TaskExecutionException; //导入方法依赖的package包/类
@Test
public void verifyPollingTaskExecutionExceptionIsNotSwallowed()
throws Exception
{
TaskExecutionException ex = TaskExecutionException.ofNextPolling(INTERVAL, ConfigElement.empty());
BaseOperator op = new BaseOperator(newContext(temporaryFolder.getRoot().toPath(), request))
{
@Override
public TaskResult runTask()
{
throw ex;
}
};
try {
op.run();
fail();
}
catch (TaskExecutionException e) {
assertThat(e, is(ex));
assertThat(e.isError(), is(false));
assertThat(e.getRetryInterval().get(), is(INTERVAL));
}
}
示例3: nextPolling
import io.digdag.spi.TaskExecutionException; //导入方法依赖的package包/类
private TaskExecutionException nextPolling(Config state) {
int iteration = state.get(STATE_POLL_ITERATION, Integer.class);
int interval = exponentialBackoffInterval(iteration);
state.set(STATE_POLL_ITERATION, ++iteration);
return TaskExecutionException.ofNextPolling(interval, ConfigElement.copyOf(state));
}
示例4: run
import io.digdag.spi.TaskExecutionException; //导入方法依赖的package包/类
@Override
protected TaskResult run(Config params, Config state, RedshiftConnectionConfig connectionConfig)
{
UUID queryId;
// generate query id
if (!state.has(QUERY_ID)) {
// this is the first execution of this task
logger.debug("Generating query id for a new {} task", type());
queryId = UUID.randomUUID();
state.set(QUERY_ID, queryId);
throw TaskExecutionException.ofNextPolling(0, ConfigElement.copyOf(state));
}
queryId = state.get(QUERY_ID, UUID.class);
BasicAWSCredentials baseCredentials = createBaseCredential(context.getSecrets());
AWSSessionCredentials sessionCredentials = createSessionCredentials(params, context.getSecrets(), baseCredentials);
T statementConfig = createStatementConfig(params, sessionCredentials, queryId.toString());
beforeConnect(baseCredentials, statementConfig);
pollingRetryExecutor(TaskState.of(state), "load")
.retryIf(LockConflictException.class, x -> true)
.withErrorMessage("Redshift Load/Unload operation failed")
.runAction(s -> executeTask(params, connectionConfig, statementConfig, queryId));
return TaskResult.defaultBuilder(request).build();
}
示例5: verifyPollingTaskExecutionExceptionIsNotSwallowedWhenRetriesAreEnabled
import io.digdag.spi.TaskExecutionException; //导入方法依赖的package包/类
@Test
public void verifyPollingTaskExecutionExceptionIsNotSwallowedWhenRetriesAreEnabled()
throws Exception
{
config.set("_retry", 10);
TaskExecutionException ex = TaskExecutionException.ofNextPolling(INTERVAL, ConfigElement.empty());
BaseOperator op = new BaseOperator(newContext(temporaryFolder.getRoot().toPath(), request))
{
@Override
public TaskResult runTask()
{
throw ex;
}
};
try {
op.run();
fail();
}
catch (TaskExecutionException e) {
assertThat(e, is(ex));
assertThat(e.isError(), is(false));
assertThat(e.getRetryInterval().get(), is(INTERVAL));
}
}
示例6: pollingTaskExecutionException
import io.digdag.spi.TaskExecutionException; //导入方法依赖的package包/类
/**
* Create a new {@link TaskExecutionException} with using the root task state.
*/
default TaskExecutionException pollingTaskExecutionException(int interval)
{
return TaskExecutionException.ofNextPolling(interval, ConfigElement.copyOf(root()));
}