@Override public File getWorkDir() { File f = new File(FilenameUtils.concat(ji.getNode().getTmpDirectory(), Integer.toString(this.ji.getId()))); if (!f.isDirectory()) { try { FileUtils.forceMkdir(f); } catch (Exception e) { throw new JqmRuntimeException("Could not create work directory", e); } } return f; }
@Override public File getWorkDir() { File f = new File(FilenameUtils.concat(ji.getNode().getTmpDirectory(), Integer.toString(this.ji.getId()))); if (!f.isDirectory()) { try { FileUtils.forceMkdir(f); } catch (Exception e) { throw new JqmRuntimeException("Could not create work directory", e); } } return f; }
@Override public Integer addDeliverable(String path, String fileLabel) { DbConn cnx = Helpers.getNewDbSession(); try { String outputRoot = this.ji.getNode().getDlRepo(); String ext = FilenameUtils.getExtension(path); String relDestPath = ji.getJD().getApplicationName() + "/" + ji.getId() + "/" + UUID.randomUUID() + "." + ext; String absDestPath = FilenameUtils.concat(outputRoot, relDestPath); String fileName = FilenameUtils.getName(path); jqmlogger.debug("A deliverable is added. Stored as " + absDestPath + ". Initial name: " + fileName); FileUtils.moveFile(new File(path), new File(absDestPath)); cnx.commit(); int res = Helpers.createDeliverable(relDestPath, fileName, fileLabel, this.ji.getId(), cnx); cnx.commit(); return res; } catch (IOException e) { throw new JqmClientException(e); } finally { Helpers.closeQuietly(cnx); } }
@Override public Integer addDeliverable(String path, String fileLabel) { DbConn cnx = Helpers.getNewDbSession(); try { String outputRoot = this.ji.getNode().getDlRepo(); String ext = FilenameUtils.getExtension(path); String relDestPath = ji.getJD().getApplicationName() + "/" + ji.getId() + "/" + UUID.randomUUID() + "." + ext; String absDestPath = FilenameUtils.concat(outputRoot, relDestPath); String fileName = FilenameUtils.getName(path); jqmlogger.debug("A deliverable is added. Stored as " + absDestPath + ". Initial name: " + fileName); FileUtils.moveFile(new File(path), new File(absDestPath)); cnx.commit(); int res = Helpers.createDeliverable(relDestPath, fileName, fileLabel, this.ji.getId(), cnx); cnx.commit(); return res; } catch (IOException e) { throw new JqmClientException(e); } finally { Helpers.closeQuietly(cnx); } }
pb.directory(new File(this.ji.getNode().getRepo())); pb.redirectErrorStream(false); env.put("JQM_JI_DELIVERY_DIR", this.deliveryDir.getAbsolutePath()); env.put("JQM_NODE_NAME", this.ji.getNode().getName()); env.put("JQM_NODE_APPLICATION_ROOT", this.ji.getNode().getRepo()); env.put("JQM_NODE_LOG_LEVEL", this.ji.getNode().getRootLogLevel());
File tmpDir = new File(FilenameUtils.concat(this.ji.getNode().getTmpDirectory(), "" + this.ji.getId())); if (tmpDir.isDirectory())
pb.directory(new File(this.ji.getNode().getRepo())); pb.redirectErrorStream(false); env.put("JQM_JI_DELIVERY_DIR", this.deliveryDir.getAbsolutePath()); env.put("JQM_NODE_NAME", this.ji.getNode().getName()); env.put("JQM_NODE_APPLICATION_ROOT", this.ji.getNode().getRepo()); env.put("JQM_NODE_LOG_LEVEL", this.ji.getNode().getRootLogLevel());
File tmpDir = new File(FilenameUtils.concat(this.ji.getNode().getTmpDirectory(), "" + this.ji.getId())); if (tmpDir.isDirectory())
/** * Returns all the URL that should be inside the classpath. This includes the jar itself if any. * * @throws JqmPayloadException */ private URL[] getClasspath(JobInstance ji, JobRunnerCallback cb) throws JqmPayloadException { switch (ji.getJD().getPathType()) { case MAVEN: return mavenResolver.resolve(ji); case MEMORY: return new URL[0]; case FS: default: return fsResolver.getLibraries(ji.getNode(), ji.getJD()); } }
File jarFile = new File(FilenameUtils.concat(new File(ji.getNode().getRepo()).getAbsolutePath(), jd.getJarPath()));
/** * Create an History object from a {@link JobInstance}. * */ public static void create(DbConn cnx, JobInstance ji, State finalState, Calendar endDate) { JobDef jd = ji.getJD(); Node n = ji.getNode(); Queue q = ji.getQ(); if (endDate == null) { cnx.runUpdate("history_insert", ji.getId(), jd.getApplication(), jd.getApplicationName(), ji.getAttributionDate(), ji.getEmail(), ji.getCreationDate(), ji.getExecutionDate(), jd.isHighlander(), ji.getApplication(), ji.getKeyword1(), ji.getKeyword2(), ji.getKeyword3(), ji.getModule(), jd.getKeyword1(), jd.getKeyword2(), jd.getKeyword3(), jd.getModule(), n == null ? null : n.getName(), ji.getParentId(), ji.getProgress(), q == null ? null : q.getName(), 0, ji.getSessionID(), finalState.toString(), ji.getUserName(), ji.getJdId(), n == null ? null : n.getId(), ji.getQueue(), ji.isFromSchedule(), ji.getPriority()); } else { cnx.runUpdate("history_insert_with_end_date", ji.getId(), jd.getApplication(), jd.getApplicationName(), ji.getAttributionDate(), ji.getEmail(), endDate, ji.getCreationDate(), ji.getExecutionDate(), jd.isHighlander(), ji.getApplication(), ji.getKeyword1(), ji.getKeyword2(), ji.getKeyword3(), ji.getModule(), jd.getKeyword1(), jd.getKeyword2(), jd.getKeyword3(), jd.getModule(), n.getName(), ji.getParentId(), ji.getProgress(), q.getName(), 0, ji.getSessionID(), finalState.toString(), ji.getUserName(), ji.getJdId(), ji.getNode().getId(), ji.getQueue(), ji.isFromSchedule(), ji.getPriority()); } }
/** * Create an History object from a {@link JobInstance}. * */ public static void create(DbConn cnx, JobInstance ji, State finalState, Calendar endDate) { JobDef jd = ji.getJD(); Node n = ji.getNode(); Queue q = ji.getQ(); if (endDate == null) { cnx.runUpdate("history_insert", ji.getId(), jd.getApplication(), jd.getApplicationName(), ji.getAttributionDate(), ji.getEmail(), ji.getCreationDate(), ji.getExecutionDate(), jd.isHighlander(), ji.getApplication(), ji.getKeyword1(), ji.getKeyword2(), ji.getKeyword3(), ji.getModule(), jd.getKeyword1(), jd.getKeyword2(), jd.getKeyword3(), jd.getModule(), n == null ? null : n.getName(), ji.getParentId(), ji.getProgress(), q == null ? null : q.getName(), 0, ji.getSessionID(), finalState.toString(), ji.getUserName(), ji.getJdId(), n == null ? null : n.getId(), ji.getQueue(), ji.isFromSchedule(), ji.getPriority()); } else { cnx.runUpdate("history_insert_with_end_date", ji.getId(), jd.getApplication(), jd.getApplicationName(), ji.getAttributionDate(), ji.getEmail(), endDate, ji.getCreationDate(), ji.getExecutionDate(), jd.isHighlander(), ji.getApplication(), ji.getKeyword1(), ji.getKeyword2(), ji.getKeyword3(), ji.getModule(), jd.getKeyword1(), jd.getKeyword2(), jd.getKeyword3(), jd.getModule(), n.getName(), ji.getParentId(), ji.getProgress(), q.getName(), 0, ji.getSessionID(), finalState.toString(), ji.getUserName(), ji.getJdId(), ji.getNode().getId(), ji.getQueue(), ji.isFromSchedule(), ji.getPriority()); } }