Search in sources :

Example 1 with LsfLogFilePathResolver

use of pipelite.stage.path.LsfLogFilePathResolver 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 2 with LsfLogFilePathResolver

use of pipelite.stage.path.LsfLogFilePathResolver 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

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