public Job runJob()

in src/main/java/com/epam/grid/engine/provider/job/sge/SgeJobProvider.java [151:173]


    public Job runJob(final JobOptions options, final String logDir) {
        if (options.getParallelExecutionOptions() != null) {
            throw new UnsupportedOperationException("ParallelExecutionOptions can be used only for SLURM grid engine. "
                    + "For SGE engine please use ParallelEnvOptions");
        }
        if (!isValidParallelEnvOptions(options.getParallelEnvOptions())) {
            throw new GridEngineException(HttpStatus.BAD_REQUEST, "Invalid PE specification!");
        }
        final CommandResult result = simpleCmdExecutor.execute(makeQsubCommand(options, logDir));
        if (result.getExitCode() != 0 || result.getStdOut().isEmpty()) {
            CommandsUtils.throwExecutionDetails(result, HttpStatus.INTERNAL_SERVER_ERROR);
        }
        final Matcher matcher = SUBMITTED_JOB_ID_PATTERN.matcher(result.getStdOut().get(0));
        if (!matcher.find()) {
            CommandsUtils.throwExecutionDetails(result, HttpStatus.INTERNAL_SERVER_ERROR);
        }
        return Job.builder()
                .id(Long.parseLong(matcher.group(1)))
                .state(JobState.builder()
                        .category(JobState.Category.PENDING)
                        .build())
                .build();
    }