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);
}
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" + "}");
}
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;
}
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");
}
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");
}
Aggregations