Search in sources :

Example 1 with AbstractLsfExecutorParameters

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

the class LsfLogFilePathResolverTest method testWithoutDirWithoutUser.

@Test
public void testWithoutDirWithoutUser() {
    StageExecutorRequest request = request();
    AbstractLsfExecutorParameters params = AbstractLsfExecutorParameters.builder().build();
    LsfLogFilePathResolver resolver = new LsfLogFilePathResolver(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 + ".out");
    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 + ".out");
}
Also used : StageExecutorRequest(pipelite.stage.executor.StageExecutorRequest) AbstractLsfExecutorParameters(pipelite.stage.parameters.AbstractLsfExecutorParameters) Test(org.junit.jupiter.api.Test)

Example 2 with AbstractLsfExecutorParameters

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

the class AbstractLsfExecutor method extractResultFromOutFile.

/**
 * Extracts stage execution result from out file. Returns null if the result could not be
 * extracted.
 */
public static StageExecutorResult extractResultFromOutFile(CmdRunner cmdRunner, String outFile) {
    log.atWarning().log("Checking LSF job result from output file: " + outFile);
    // Extract the job execution result from the out file. The format
    // is the same as in the bhist result.
    AbstractLsfExecutorParameters executorParams = AbstractLsfExecutorParameters.builder().logLines(JOB_RECOVERY_LOG_LINES).build();
    String str = readOutFile(cmdRunner, outFile, executorParams);
    return extractResultFromBhistOutputOrOutFile(str);
}
Also used : AbstractLsfExecutorParameters(pipelite.stage.parameters.AbstractLsfExecutorParameters)

Example 3 with AbstractLsfExecutorParameters

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

the class AbstractLsfExecutorFilesTest method resolveDefaultLogFile.

@Test
public void resolveDefaultLogFile() {
    TestLsfExecutor executor = new TestLsfExecutor();
    Stage stage = Stage.builder().stageName("STAGE_NAME").executor(executor).build();
    StageExecutorRequest request = StageExecutorRequest.builder().pipelineName("PIPELINE_NAME").processId("PROCESS_ID").stage(stage).build();
    AbstractLsfExecutorParameters params = AbstractLsfExecutorParameters.builder().build();
    assertThat(params.resolveLogFile(request, LsfFilePathResolver.Format.WITH_LSF_PATTERN)).isEqualTo("%U/PIPELINE_NAME/PROCESS_ID/STAGE_NAME.out");
    params = AbstractLsfExecutorParameters.builder().user("user").build();
    assertThat(params.resolveLogFile(request, LsfFilePathResolver.Format.WITHOUT_LSF_PATTERN)).isEqualTo("user/PIPELINE_NAME/PROCESS_ID/STAGE_NAME.out");
}
Also used : StageExecutorRequest(pipelite.stage.executor.StageExecutorRequest) AbstractLsfExecutorParameters(pipelite.stage.parameters.AbstractLsfExecutorParameters) Stage(pipelite.stage.Stage) Test(org.junit.jupiter.api.Test)

Example 4 with AbstractLsfExecutorParameters

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

the class AbstractLsfExecutorFilesTest method resolveDefaultLogDir.

@Test
public void resolveDefaultLogDir() {
    TestLsfExecutor executor = new TestLsfExecutor();
    Stage stage = Stage.builder().stageName("STAGE_NAME").executor(executor).build();
    StageExecutorRequest request = StageExecutorRequest.builder().pipelineName("PIPELINE_NAME").processId("PROCESS_ID").stage(stage).build();
    AbstractLsfExecutorParameters params = AbstractLsfExecutorParameters.builder().build();
    assertThat(params.resolveLogDir(request, LsfFilePathResolver.Format.WITH_LSF_PATTERN)).isEqualTo("%U/PIPELINE_NAME/PROCESS_ID");
    params = AbstractLsfExecutorParameters.builder().user("user").build();
    assertThat(params.resolveLogDir(request, LsfFilePathResolver.Format.WITHOUT_LSF_PATTERN)).isEqualTo("user/PIPELINE_NAME/PROCESS_ID");
}
Also used : StageExecutorRequest(pipelite.stage.executor.StageExecutorRequest) AbstractLsfExecutorParameters(pipelite.stage.parameters.AbstractLsfExecutorParameters) Stage(pipelite.stage.Stage) Test(org.junit.jupiter.api.Test)

Example 5 with AbstractLsfExecutorParameters

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

the class LsfLogFilePathResolverTest method testWithDirWithoutUser.

@Test
public void testWithDirWithoutUser() {
    StageExecutorRequest request = request();
    AbstractLsfExecutorParameters params = AbstractLsfExecutorParameters.builder().logDir("a/b").build();
    LsfLogFilePathResolver resolver = new LsfLogFilePathResolver(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 + ".out");
    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 + ".out");
}
Also used : StageExecutorRequest(pipelite.stage.executor.StageExecutorRequest) AbstractLsfExecutorParameters(pipelite.stage.parameters.AbstractLsfExecutorParameters) Test(org.junit.jupiter.api.Test)

Aggregations

AbstractLsfExecutorParameters (pipelite.stage.parameters.AbstractLsfExecutorParameters)7 Test (org.junit.jupiter.api.Test)6 StageExecutorRequest (pipelite.stage.executor.StageExecutorRequest)6 Stage (pipelite.stage.Stage)2