当前位置: 首页>>代码示例>>Java>>正文


Java TaskExecutionException.ofNextPolling方法代码示例

本文整理汇总了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));
}
 
开发者ID:retz,项目名称:retz-digdag-plugin,代码行数:18,代码来源:RetzRunApiOperator.java

示例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));
    }
}
 
开发者ID:treasure-data,项目名称:digdag,代码行数:26,代码来源:BaseOperatorTest.java

示例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));
}
 
开发者ID:retz,项目名称:retz-digdag-plugin,代码行数:8,代码来源:RetzRunApiOperator.java

示例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();
}
 
开发者ID:treasure-data,项目名称:digdag,代码行数:28,代码来源:BaseRedshiftLoadOperator.java

示例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));
    }
}
 
开发者ID:treasure-data,项目名称:digdag,代码行数:28,代码来源:BaseOperatorTest.java

示例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()));
}
 
开发者ID:treasure-data,项目名称:digdag,代码行数:8,代码来源:TaskState.java


注:本文中的io.digdag.spi.TaskExecutionException.ofNextPolling方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。