Search in sources :

Example 1 with LsfExecutorParameters

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

the class LsfDefinitionFilePathResolverTest method testWithoutDirWithoutUser.

@Test
public void testWithoutDirWithoutUser() {
    StageExecutorRequest request = request();
    LsfExecutorParameters params = LsfExecutorParameters.builder().build();
    LsfDefinitionFilePathResolver resolver = new LsfDefinitionFilePathResolver(request, params);
    String user = System.getProperty("user.name");
    assertThat(resolver.getDir(LsfFilePathResolver.Format.WITHOUT_LSF_PATTERN)).isEqualTo(user + "/" + PIPELITE_NAME + "/" + PROCESS_ID);
    assertThat(resolver.getFile(LsfFilePathResolver.Format.WITHOUT_LSF_PATTERN)).isEqualTo(user + "/" + PIPELITE_NAME + "/" + PROCESS_ID + "/" + STAGE_NAME + ".job");
    assertThat(resolver.getDir(LsfFilePathResolver.Format.WITH_LSF_PATTERN)).isEqualTo("%U/" + PIPELITE_NAME + "/" + PROCESS_ID);
    assertThat(resolver.getFile(LsfFilePathResolver.Format.WITH_LSF_PATTERN)).isEqualTo("%U/" + PIPELITE_NAME + "/" + PROCESS_ID + "/" + STAGE_NAME + ".job");
}
Also used : StageExecutorRequest(pipelite.stage.executor.StageExecutorRequest) LsfExecutorParameters(pipelite.stage.parameters.LsfExecutorParameters) Test(org.junit.jupiter.api.Test)

Example 2 with LsfExecutorParameters

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

the class LsfExecutorSubmitCmdTest method test.

@Test
public void test() throws IOException {
    LsfExecutor executor = new LsfExecutor();
    executor.setCmd("test");
    LsfExecutorParameters params = LsfExecutorParameters.builder().logDir(Files.createTempDirectory("TEMP").toString()).definition("pipelite/executor/lsf.yaml").format(LsfExecutorParameters.Format.YAML).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 definitionFile = params.resolveDefinitionFile(request, LsfFilePathResolver.Format.WITHOUT_LSF_PATTERN);
    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));
    executor.setDefinitionFile(definitionFile);
    String submitCmd = executor.getSubmitCmd(request);
    assertThat(submitCmd).isEqualTo("bsub" + " -outdir " + logDir + " -cwd " + logDir + " -oo " + logFileName + " -yaml " + definitionFile + " test");
}
Also used : StageExecutorRequest(pipelite.stage.executor.StageExecutorRequest) LsfExecutorParameters(pipelite.stage.parameters.LsfExecutorParameters) Stage(pipelite.stage.Stage) Test(org.junit.jupiter.api.Test)

Example 3 with LsfExecutorParameters

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

the class LsfExecutorSerializeTest method test.

@Test
public void test() {
    String cmd = "echo test";
    LsfExecutor executor = StageExecutor.createLsfExecutor(cmd);
    Stage stage = Stage.builder().stageName("STAGE_NAME").executor(executor).build();
    StageExecutorRequest request = StageExecutorRequest.builder().pipelineName("PIPELINE_NAME").processId("PROCESS_ID").stage(stage).build();
    LsfExecutorParameters params = LsfExecutorParameters.builder().user("user").logDir("logDir").definitionDir("definitionDir").build();
    LsfFilePathResolver.Format format = LsfFilePathResolver.Format.WITHOUT_LSF_PATTERN;
    executor.setJobId("test");
    executor.setOutFile(new LsfLogFilePathResolver(request, params).getFile(format));
    executor.setDefinitionFile(new LsfDefinitionFilePathResolver(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" + "  \"definitionFile\" : \"definitionDir/user/PIPELINE_NAME/PROCESS_ID/STAGE_NAME.job\"\n" + "}");
    LsfExecutor deserializedLsfExecutor = Json.deserialize(json, LsfExecutor.class);
    assertThat(deserializedLsfExecutor.getCmd()).isEqualTo(cmd);
    assertThat(deserializedLsfExecutor.getJobId()).isEqualTo("test");
    assertThat(deserializedLsfExecutor.getOutFile()).isEqualTo("logDir/user/PIPELINE_NAME/PROCESS_ID/STAGE_NAME.out");
    assertThat(deserializedLsfExecutor.getDefinitionFile()).isEqualTo("definitionDir/user/PIPELINE_NAME/PROCESS_ID/STAGE_NAME.job");
}
Also used : LsfDefinitionFilePathResolver(pipelite.stage.path.LsfDefinitionFilePathResolver) StageExecutorRequest(pipelite.stage.executor.StageExecutorRequest) LsfLogFilePathResolver(pipelite.stage.path.LsfLogFilePathResolver) LsfExecutorParameters(pipelite.stage.parameters.LsfExecutorParameters) LsfFilePathResolver(pipelite.stage.path.LsfFilePathResolver) Stage(pipelite.stage.Stage) Test(org.junit.jupiter.api.Test)

Example 4 with LsfExecutorParameters

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

the class LsfDefinitionFilePathResolverTest method testWithoutDirWithUser.

@Test
public void testWithoutDirWithUser() {
    StageExecutorRequest request = request();
    LsfExecutorParameters params = LsfExecutorParameters.builder().user("user").build();
    LsfDefinitionFilePathResolver resolver = new LsfDefinitionFilePathResolver(request, params);
    assertThat(resolver.getDir(LsfFilePathResolver.Format.WITHOUT_LSF_PATTERN)).isEqualTo("user/" + PIPELITE_NAME + "/" + PROCESS_ID);
    assertThat(resolver.getFile(LsfFilePathResolver.Format.WITHOUT_LSF_PATTERN)).isEqualTo("user/" + PIPELITE_NAME + "/" + PROCESS_ID + "/" + STAGE_NAME + ".job");
    assertThat(resolver.getDir(LsfFilePathResolver.Format.WITH_LSF_PATTERN)).isEqualTo("%U/" + PIPELITE_NAME + "/" + PROCESS_ID);
    assertThat(resolver.getFile(LsfFilePathResolver.Format.WITH_LSF_PATTERN)).isEqualTo("%U/" + PIPELITE_NAME + "/" + PROCESS_ID + "/" + STAGE_NAME + ".job");
}
Also used : StageExecutorRequest(pipelite.stage.executor.StageExecutorRequest) LsfExecutorParameters(pipelite.stage.parameters.LsfExecutorParameters) Test(org.junit.jupiter.api.Test)

Example 5 with LsfExecutorParameters

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

the class LsfDefinitionFilePathResolverTest method testWithDirWithoutUser.

@Test
public void testWithDirWithoutUser() {
    StageExecutorRequest request = request();
    LsfExecutorParameters params = LsfExecutorParameters.builder().definitionDir("a/b").build();
    LsfDefinitionFilePathResolver resolver = new LsfDefinitionFilePathResolver(request, params);
    String user = System.getProperty("user.name");
    assertThat(resolver.getDir(LsfFilePathResolver.Format.WITHOUT_LSF_PATTERN)).isEqualTo("a/b/" + user + "/" + PIPELITE_NAME + "/" + PROCESS_ID);
    assertThat(resolver.getFile(LsfFilePathResolver.Format.WITHOUT_LSF_PATTERN)).isEqualTo("a/b/" + user + "/" + PIPELITE_NAME + "/" + PROCESS_ID + "/" + STAGE_NAME + ".job");
    assertThat(resolver.getDir(LsfFilePathResolver.Format.WITH_LSF_PATTERN)).isEqualTo("a/b/%U/" + PIPELITE_NAME + "/" + PROCESS_ID);
    assertThat(resolver.getFile(LsfFilePathResolver.Format.WITH_LSF_PATTERN)).isEqualTo("a/b/%U/" + PIPELITE_NAME + "/" + PROCESS_ID + "/" + STAGE_NAME + ".job");
}
Also used : StageExecutorRequest(pipelite.stage.executor.StageExecutorRequest) LsfExecutorParameters(pipelite.stage.parameters.LsfExecutorParameters) Test(org.junit.jupiter.api.Test)

Aggregations

Test (org.junit.jupiter.api.Test)6 StageExecutorRequest (pipelite.stage.executor.StageExecutorRequest)6 LsfExecutorParameters (pipelite.stage.parameters.LsfExecutorParameters)6 Stage (pipelite.stage.Stage)2 LsfDefinitionFilePathResolver (pipelite.stage.path.LsfDefinitionFilePathResolver)1 LsfFilePathResolver (pipelite.stage.path.LsfFilePathResolver)1 LsfLogFilePathResolver (pipelite.stage.path.LsfLogFilePathResolver)1