Search in sources :

Example 1 with SimpleLsfExecutorParameters

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

the class SingleStageSimpleLsfTestProcessConfiguration method configure.

@Override
protected void configure(ProcessBuilder builder) {
    SimpleLsfExecutorParameters.SimpleLsfExecutorParametersBuilder<?, ?> executorParamsBuilder = SimpleLsfExecutorParameters.builder();
    executorParamsBuilder.host(lsfTestConfiguration.getHost()).user(lsfTestConfiguration.getUser()).logDir(lsfTestConfiguration.getLogDir()).queue(lsfTestConfiguration.getQueue()).timeout(Duration.ofSeconds(180)).maximumRetries(maximumRetries()).immediateRetries(immediateRetries());
    SimpleLsfExecutorParameters executorParams = executorParamsBuilder.build();
    executorParams.setPermanentErrors(testType().permanentErrors());
    builder.execute(stageName()).withSimpleLsfExecutor(testType().nextCmd(pipelineName(), builder.getProcessId(), stageName()), executorParams);
}
Also used : SimpleLsfExecutorParameters(pipelite.stage.parameters.SimpleLsfExecutorParameters)

Example 2 with SimpleLsfExecutorParameters

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

the class StageExecutorSerializerTest method deserializeExecutionAsync.

@Test
public void deserializeExecutionAsync() {
    SimpleLsfExecutor lsfExecutor = StageExecutor.createSimpleLsfExecutor("test");
    lsfExecutor.setJobId("test");
    SimpleLsfExecutorParameters params = new SimpleLsfExecutorParameters();
    params.setHost("host");
    params.setQueue("queue");
    lsfExecutor.setExecutorParams(params);
    StageEntity stageEntity = new StageEntity();
    Stage stage = Stage.builder().stageName("STAGE1").executor(lsfExecutor).build();
    stage.setStageEntity(stageEntity);
    stageEntity.startExecution();
    StageService.prepareSaveStage(stage);
    assertThat(StageExecutorSerializer.deserializeExecution(stage, StageExecutorSerializer.Deserialize.ASYNC_EXECUTOR)).isTrue();
    assertThat(stage.getExecutor()).isNotNull();
    assertThat(stage.getExecutor()).isInstanceOf(SimpleLsfExecutor.class);
    assertThat(stageEntity.getExecutorName()).isEqualTo("pipelite.executor.SimpleLsfExecutor");
    assertThat(stageEntity.getExecutorData()).isEqualTo("{\n" + "  \"jobId\" : \"test\",\n" + "  \"cmd\" : \"test\"\n" + "}");
    assertThat(stageEntity.getExecutorParams()).isEqualTo("{\n" + "  \"timeout\" : 604800000,\n" + "  \"maximumRetries\" : 3,\n" + "  \"immediateRetries\" : 3,\n" + "  \"logLines\" : 1000,\n" + "  \"host\" : \"host\",\n" + "  \"logTimeout\" : 10000,\n" + "  \"queue\" : \"queue\"\n" + "}");
}
Also used : Stage(pipelite.stage.Stage) StageEntity(pipelite.entity.StageEntity) SimpleLsfExecutor(pipelite.executor.SimpleLsfExecutor) SimpleLsfExecutorParameters(pipelite.stage.parameters.SimpleLsfExecutorParameters) Test(org.junit.jupiter.api.Test)

Example 3 with SimpleLsfExecutorParameters

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

the class AbstractAsyncExecutorTest method executor.

private AbstractAsyncExecutor executor() {
    SimpleLsfExecutor simpleLsfExecutor = Mockito.spy(StageExecutor.createSimpleLsfExecutor("test"));
    simpleLsfExecutor.setExecutorParams(new SimpleLsfExecutorParameters());
    simpleLsfExecutor.setSubmitExecutorService(PipeliteExecutorService.createExecutorService("test", "test-%d", 10, null));
    return simpleLsfExecutor;
}
Also used : SimpleLsfExecutorParameters(pipelite.stage.parameters.SimpleLsfExecutorParameters)

Example 4 with SimpleLsfExecutorParameters

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

the class SimpleLsfExecutorSubmitCmdTest method cmdMemUnitsM.

@Test
public void cmdMemUnitsM() throws IOException {
    SimpleLsfExecutor executor = new SimpleLsfExecutor();
    executor.setCmd("test");
    SimpleLsfExecutorParameters params = SimpleLsfExecutorParameters.builder().logDir(Files.createTempDirectory("TEMP").toString()).cpu(2).memory(1).memoryUnits("M").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 1M -R \"rusage[mem=1M: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 5 with SimpleLsfExecutorParameters

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

the class SimpleLsfExecutorSerializeTest method test.

@Test
public void test() {
    String cmd = "echo test";
    SimpleLsfExecutor executor = StageExecutor.createSimpleLsfExecutor(cmd);
    Stage stage = Stage.builder().stageName("STAGE_NAME").executor(executor).build();
    StageExecutorRequest request = StageExecutorRequest.builder().pipelineName("PIPELINE_NAME").processId("PROCESS_ID").stage(stage).build();
    SimpleLsfExecutorParameters params = SimpleLsfExecutorParameters.builder().user("user").logDir("logDir").build();
    LsfFilePathResolver.Format format = LsfFilePathResolver.Format.WITHOUT_LSF_PATTERN;
    executor.setJobId("test");
    executor.setOutFile(new LsfLogFilePathResolver(request, params).getFile(format));
    String json = Json.serialize(executor);
    assertThat(json).isEqualTo("{\n" + "  \"jobId\" : \"test\",\n" + "  \"cmd\" : \"echo test\",\n" + "  \"outFile\" : \"logDir/user/PIPELINE_NAME/PROCESS_ID/STAGE_NAME.out\"\n" + "}");
    SimpleLsfExecutor deserializedLsfExecutor = Json.deserialize(json, SimpleLsfExecutor.class);
    assertThat(deserializedLsfExecutor.getCmd()).isEqualTo(cmd);
    assertThat(deserializedLsfExecutor.getJobId()).isEqualTo("test");
    assertThat(deserializedLsfExecutor.getOutFile()).isEqualTo("logDir/user/PIPELINE_NAME/PROCESS_ID/STAGE_NAME.out");
}
Also used : StageExecutorRequest(pipelite.stage.executor.StageExecutorRequest) LsfLogFilePathResolver(pipelite.stage.path.LsfLogFilePathResolver) LsfFilePathResolver(pipelite.stage.path.LsfFilePathResolver) Stage(pipelite.stage.Stage) SimpleLsfExecutorParameters(pipelite.stage.parameters.SimpleLsfExecutorParameters) 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