Search in sources :

Example 1 with AbstractLsfExecutor

use of pipelite.executor.AbstractLsfExecutor in project pipelite by enasequence.

the class TestType method setNextExitCode.

static void setNextExitCode(TestType testType, Stage stage, StageMapKey key) {
    // Execution count.
    Integer execCount = stageExecCount.get(key);
    if (execCount == null) {
        execCount = 0;
    }
    ++execCount;
    stageExecCount.put(key, execCount);
    // Next exit code.
    String nextExitCode = testType.exitCode(execCount);
    stageNextExitCode.put(key, nextExitCode);
    String pipelineName = key.getPipelineName();
    String processId = key.getProcessId();
    String stageName = key.getStageName();
    if (!nextExitCode.equals("")) {
        if (stage.getExecutor() instanceof KubernetesExecutor) {
            KubernetesExecutor executor = (KubernetesExecutor) stage.getExecutor();
            executor.setImageArgs(testType.nextImageArgs(pipelineName, processId, stageName));
        } else if (stage.getExecutor() instanceof AbstractLsfExecutor<?>) {
            AbstractLsfExecutor<?> executor = (AbstractLsfExecutor<?>) stage.getExecutor();
            executor.setCmd(testType.nextCmd(pipelineName, processId, stageName));
        } else if (stage.getExecutor() instanceof CmdExecutor<?>) {
            CmdExecutor<?> executor = (CmdExecutor<?>) stage.getExecutor();
            executor.setCmd(testType.nextCmd(pipelineName, processId, stageName));
        } else {
            testType.failedAsserts.add("Unexpected executor type when changing executor exit code: " + stage.getExecutor().getClass().getSimpleName());
        }
    }
}
Also used : AbstractLsfExecutor(pipelite.executor.AbstractLsfExecutor) CmdExecutor(pipelite.executor.CmdExecutor) KubernetesExecutor(pipelite.executor.KubernetesExecutor)

Example 2 with AbstractLsfExecutor

use of pipelite.executor.AbstractLsfExecutor in project pipelite by enasequence.

the class LsfDescribeJobsCacheTest method test.

@Test
public void test() {
    LsfDescribeJobsCache cache = new LsfDescribeJobsCache(Mockito.mock(ServiceConfiguration.class), Mockito.mock(InternalErrorService.class));
    SimpleLsfExecutorParameters host1 = SimpleLsfExecutorParameters.builder().host("1").build();
    SimpleLsfExecutorParameters host2 = SimpleLsfExecutorParameters.builder().host("2").build();
    AbstractLsfExecutor executor1Host1 = new SimpleLsfExecutor();
    AbstractLsfExecutor executor2Host1 = new SimpleLsfExecutor();
    AbstractLsfExecutor executor3Host2 = new SimpleLsfExecutor();
    AbstractLsfExecutor executor4Host1 = new SimpleLsfExecutor();
    executor1Host1.setExecutorParams(host1);
    executor2Host1.setExecutorParams(host1);
    executor3Host2.setExecutorParams(host2);
    executor4Host1.setExecutorParams(host1);
    assertThat(cache.getCacheContext(executor1Host1).getHost()).isEqualTo(host1.getHost());
    assertThat(cache.getCacheContext(executor2Host1).getHost()).isEqualTo(host1.getHost());
    assertThat(cache.getCacheContext(executor3Host2).getHost()).isEqualTo(host2.getHost());
    assertThat(cache.getCacheContext(executor4Host1).getHost()).isEqualTo(host1.getHost());
    DescribeJobs<LsfDescribeJobsCache.RequestContext, LsfDescribeJobsCache.ExecutorContext> describeJobs1 = cache.getDescribeJobs(executor1Host1);
    DescribeJobs<LsfDescribeJobsCache.RequestContext, LsfDescribeJobsCache.ExecutorContext> describeJobs2 = cache.getDescribeJobs(executor2Host1);
    DescribeJobs<LsfDescribeJobsCache.RequestContext, LsfDescribeJobsCache.ExecutorContext> describeJobs3 = cache.getDescribeJobs(executor3Host2);
    DescribeJobs<LsfDescribeJobsCache.RequestContext, LsfDescribeJobsCache.ExecutorContext> describeJobs4 = cache.getDescribeJobs(executor4Host1);
    assertThat(describeJobs1 == describeJobs2).isTrue();
    assertThat(describeJobs1 != describeJobs3).isTrue();
    assertThat(describeJobs1 == describeJobs4).isTrue();
}
Also used : AbstractLsfExecutor(pipelite.executor.AbstractLsfExecutor) ServiceConfiguration(pipelite.configuration.ServiceConfiguration) LsfDescribeJobsCache(pipelite.executor.describe.cache.LsfDescribeJobsCache) InternalErrorService(pipelite.service.InternalErrorService) SimpleLsfExecutorParameters(pipelite.stage.parameters.SimpleLsfExecutorParameters) SimpleLsfExecutor(pipelite.executor.SimpleLsfExecutor) Test(org.junit.jupiter.api.Test)

Aggregations

AbstractLsfExecutor (pipelite.executor.AbstractLsfExecutor)2 Test (org.junit.jupiter.api.Test)1 ServiceConfiguration (pipelite.configuration.ServiceConfiguration)1 CmdExecutor (pipelite.executor.CmdExecutor)1 KubernetesExecutor (pipelite.executor.KubernetesExecutor)1 SimpleLsfExecutor (pipelite.executor.SimpleLsfExecutor)1 LsfDescribeJobsCache (pipelite.executor.describe.cache.LsfDescribeJobsCache)1 InternalErrorService (pipelite.service.InternalErrorService)1 SimpleLsfExecutorParameters (pipelite.stage.parameters.SimpleLsfExecutorParameters)1