Search in sources :

Example 6 with SimpleLsfExecutorParameters

use of pipelite.stage.parameters.SimpleLsfExecutorParameters in project pipelite by enasequence.

the class SimpleLsfExecutorSubmitCmdTest method cmdMemUnitsMNoDuration.

@Test
public void cmdMemUnitsMNoDuration() throws IOException {
    SimpleLsfExecutor executor = new SimpleLsfExecutor();
    executor.setCmd("test");
    SimpleLsfExecutorParameters params = SimpleLsfExecutorParameters.builder().logDir(Files.createTempDirectory("TEMP").toString()).cpu(2).memory(1).memoryUnits("M").queue("TEST").timeout(Duration.ofMinutes(1)).build();
    executor.setExecutorParams(params);
    Stage stage = Stage.builder().stageName(STAGE_NAME).executor(executor).build();
    StageExecutorRequest request = StageExecutorRequest.builder().pipelineName(PIPELINE_NAME).processId(PROCESS_ID).stage(stage).build();
    String logDir = "\"" + params.resolveLogDir(request, LsfFilePathResolver.Format.WITH_LSF_PATTERN) + "\"";
    String logFileName = params.resolveLogFileName(request);
    executor.setOutFile(params.resolveLogDir(request, LsfFilePathResolver.Format.WITHOUT_LSF_PATTERN));
    String submitCmd = executor.getSubmitCmd(request);
    assertThat(submitCmd).isEqualTo("bsub" + " -outdir " + logDir + " -cwd " + logDir + " -oo " + logFileName + " -n 2 -M 1M -R \"rusage[mem=1M]\" -W 1 -q TEST test");
}
Also used : StageExecutorRequest(pipelite.stage.executor.StageExecutorRequest) Stage(pipelite.stage.Stage) SimpleLsfExecutorParameters(pipelite.stage.parameters.SimpleLsfExecutorParameters) Test(org.junit.jupiter.api.Test)

Example 7 with SimpleLsfExecutorParameters

use of pipelite.stage.parameters.SimpleLsfExecutorParameters in project pipelite by enasequence.

the class SimpleLsfExecutorSubmitCmdTest method cmdNoMemUnits.

@Test
public void cmdNoMemUnits() throws IOException {
    SimpleLsfExecutor executor = new SimpleLsfExecutor();
    executor.setCmd("test");
    SimpleLsfExecutorParameters params = SimpleLsfExecutorParameters.builder().logDir(Files.createTempDirectory("TEMP").toString()).cpu(2).memory(1).memoryTimeout(Duration.ofMinutes(1)).queue("TEST").timeout(Duration.ofMinutes(1)).build();
    executor.setExecutorParams(params);
    Stage stage = Stage.builder().stageName(STAGE_NAME).executor(executor).build();
    StageExecutorRequest request = StageExecutorRequest.builder().pipelineName(PIPELINE_NAME).processId(PROCESS_ID).stage(stage).build();
    String logDir = "\"" + params.resolveLogDir(request, LsfFilePathResolver.Format.WITH_LSF_PATTERN) + "\"";
    String logFileName = params.resolveLogFileName(request);
    executor.setOutFile(params.resolveLogDir(request, LsfFilePathResolver.Format.WITHOUT_LSF_PATTERN));
    String submitCmd = executor.getSubmitCmd(request);
    assertThat(submitCmd).isEqualTo("bsub" + " -outdir " + logDir + " -cwd " + logDir + " -oo " + logFileName + " -n 2 -M 1 -R \"rusage[mem=1:duration=1]\" -W 1 -q TEST test");
}
Also used : StageExecutorRequest(pipelite.stage.executor.StageExecutorRequest) Stage(pipelite.stage.Stage) SimpleLsfExecutorParameters(pipelite.stage.parameters.SimpleLsfExecutorParameters) Test(org.junit.jupiter.api.Test)

Example 8 with SimpleLsfExecutorParameters

use of pipelite.stage.parameters.SimpleLsfExecutorParameters in project pipelite by enasequence.

the class SimpleLsfExecutorSubmitCmdTest method cmdNoMemUnitsNoDuration.

@Test
public void cmdNoMemUnitsNoDuration() throws IOException {
    SimpleLsfExecutor executor = new SimpleLsfExecutor();
    executor.setCmd("test");
    SimpleLsfExecutorParameters params = SimpleLsfExecutorParameters.builder().logDir(Files.createTempDirectory("TEMP").toString()).cpu(2).memory(1).queue("TEST").timeout(Duration.ofMinutes(1)).build();
    executor.setExecutorParams(params);
    Stage stage = Stage.builder().stageName(STAGE_NAME).executor(executor).build();
    StageExecutorRequest request = StageExecutorRequest.builder().pipelineName(PIPELINE_NAME).processId(PROCESS_ID).stage(stage).build();
    String logDir = "\"" + params.resolveLogDir(request, LsfFilePathResolver.Format.WITH_LSF_PATTERN) + "\"";
    String logFileName = params.resolveLogFileName(request);
    executor.setOutFile(params.resolveLogDir(request, LsfFilePathResolver.Format.WITHOUT_LSF_PATTERN));
    String submitCmd = executor.getSubmitCmd(request);
    assertThat(submitCmd).isEqualTo("bsub" + " -outdir " + logDir + " -cwd " + logDir + " -oo " + logFileName + " -n 2 -M 1 -R \"rusage[mem=1]\" -W 1 -q TEST test");
}
Also used : StageExecutorRequest(pipelite.stage.executor.StageExecutorRequest) Stage(pipelite.stage.Stage) SimpleLsfExecutorParameters(pipelite.stage.parameters.SimpleLsfExecutorParameters) Test(org.junit.jupiter.api.Test)

Example 9 with SimpleLsfExecutorParameters

use of pipelite.stage.parameters.SimpleLsfExecutorParameters in project pipelite by enasequence.

the class SimpleLsfExecutorSubmitCmdTest method cmdJobGroup.

@Test
public void cmdJobGroup() throws IOException {
    SimpleLsfExecutor executor = new SimpleLsfExecutor();
    executor.setCmd("test");
    SimpleLsfExecutorParameters params = SimpleLsfExecutorParameters.builder().logDir(Files.createTempDirectory("TEMP").toString()).cpu(2).jobGroup("testGroup").timeout(Duration.ofMinutes(1)).queue("TEST").build();
    executor.setExecutorParams(params);
    Stage stage = Stage.builder().stageName(STAGE_NAME).executor(executor).build();
    StageExecutorRequest request = StageExecutorRequest.builder().pipelineName(PIPELINE_NAME).processId(PROCESS_ID).stage(stage).build();
    String logDir = "\"" + params.resolveLogDir(request, LsfFilePathResolver.Format.WITH_LSF_PATTERN) + "\"";
    String logFileName = params.resolveLogFileName(request);
    executor.setOutFile(params.resolveLogDir(request, LsfFilePathResolver.Format.WITHOUT_LSF_PATTERN));
    ;
    String submitCmd = executor.getSubmitCmd(request);
    assertThat(submitCmd).isEqualTo("bsub" + " -outdir " + logDir + " -cwd " + logDir + " -oo " + logFileName + " -n 2 -W 1 -g testGroup -q TEST test");
}
Also used : StageExecutorRequest(pipelite.stage.executor.StageExecutorRequest) Stage(pipelite.stage.Stage) SimpleLsfExecutorParameters(pipelite.stage.parameters.SimpleLsfExecutorParameters) Test(org.junit.jupiter.api.Test)

Example 10 with SimpleLsfExecutorParameters

use of pipelite.stage.parameters.SimpleLsfExecutorParameters 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

SimpleLsfExecutorParameters (pipelite.stage.parameters.SimpleLsfExecutorParameters)10 Test (org.junit.jupiter.api.Test)8 Stage (pipelite.stage.Stage)7 StageExecutorRequest (pipelite.stage.executor.StageExecutorRequest)6 SimpleLsfExecutor (pipelite.executor.SimpleLsfExecutor)2 ServiceConfiguration (pipelite.configuration.ServiceConfiguration)1 StageEntity (pipelite.entity.StageEntity)1 AbstractLsfExecutor (pipelite.executor.AbstractLsfExecutor)1 LsfDescribeJobsCache (pipelite.executor.describe.cache.LsfDescribeJobsCache)1 InternalErrorService (pipelite.service.InternalErrorService)1 LsfFilePathResolver (pipelite.stage.path.LsfFilePathResolver)1 LsfLogFilePathResolver (pipelite.stage.path.LsfLogFilePathResolver)1