當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。