public boolean isPlugin(Job job) { return Boolean.parseBoolean(Objects.toString(job.getAttributes().get("plugin"))); }
void cleanPrivateJobInformation(Job job) { // Remove the session id from the job attributes job.getAttributes().remove(Job.OPENCGA_TMP_DIR); job.getAttributes().remove(Job.OPENCGA_OUTPUT_DIR); job.getAttributes().remove(Job.OPENCGA_STUDY); ObjectMap params = new ObjectMap(JobDBAdaptor.QueryParams.ATTRIBUTES.key(), job.getAttributes()); try { dbAdaptorFactory.getCatalogJobDBAdaptor().update(job.getUid(), params, QueryOptions.empty()); } catch (CatalogException e) { logger.error("Could not remove session id from attributes of job {}. ", job.getUid(), e); } }
void closeSessionId(Job job) { // Remove the session id from the job attributes job.getAttributes().remove("sessionId"); ObjectMap params = new ObjectMap(JobDBAdaptor.QueryParams.ATTRIBUTES.key(), job.getAttributes()); try { jobDBAdaptor.update(job.getUid(), params, QueryOptions.empty()); } catch (CatalogException e) { logger.error("Could not remove session id from attributes of job {}. ", job.getUid(), e); } } }
Path outdir = Paths.get((String) job.getAttributes().get(TMP_OUT_DIR)); Job.JobStatus status = objectMapper.reader(Job.JobStatus.class).readValue(outdir.resolve(JOB_STATUS_FILE).toFile());
if (job.getAttributes().get(INDEX_TYPE).toString().equalsIgnoreCase(VARIANT_TYPE)) { try { job.getParams().put("path", dbAdaptorFactory.getCatalogFileDBAdaptor().get(job.getOutDir().getUid(), commandLine.append(" -s ").append(job.getAttributes().get(Job.OPENCGA_STUDY)); updateObjectMap.put(JobDBAdaptor.QueryParams.ATTRIBUTES.key(), job.getAttributes());
job.getAttributes().put(Job.OPENCGA_TMP_DIR, path.toString()); .append(JobDBAdaptor.QueryParams.COMMAND_LINE.key(), commandLine.toString()) .append(JobDBAdaptor.QueryParams.STATUS_NAME.key(), Job.JobStatus.QUEUED) .append(JobDBAdaptor.QueryParams.ATTRIBUTES.key(), job.getAttributes()) .append(JobDBAdaptor.QueryParams.RESOURCE_MANAGER_ATTRIBUTES.key(), job.getResourceManagerAttributes());
String studyStr = (String) job.getAttributes().get(Job.OPENCGA_STUDY); String outputDir = (String) job.getAttributes().get(Job.OPENCGA_OUTPUT_DIR);
String studyFqn = catalogManager.getStudyManager().get(query, QueryOptions.empty(), sessionId).first().getFqn(); String outDir = (String) job.getAttributes().get(Job.OPENCGA_TMP_DIR); Path outDirPath = Paths.get(outDir); fileManager.createFolder(studyFqn, (String) job.getAttributes().get(Job.OPENCGA_OUTPUT_DIR), new File.FileStatus(), true, "", QueryOptions.empty(), sessionId);
if (ALIGNMENT_TYPE.equals(String.valueOf(job.getAttributes().get(INDEX_TYPE)))) { String userToken = catalogManager.getUserManager().getSystemTokenForUser(job.getUserId(), sessionId); outputRecorder.recordJobOutput(job, tmpOutdirPath, userToken);
Map<String, Object> attributes = job.getAttributes(); ObjectMap opencgaAttributes; if (!attributes.containsKey(Constants.PRIVATE_OPENCGA_ATTRIBUTES)) { Map<String, Object> attributes = job.getAttributes(); ObjectMap opencgaAttributes; if (!attributes.containsKey(Constants.PRIVATE_OPENCGA_ATTRIBUTES)) { Map<String, Object> attributes = job.getAttributes(); ObjectMap opencgaAttributes; if (!attributes.containsKey(Constants.PRIVATE_OPENCGA_ATTRIBUTES)) {
job.setParams(ParamUtils.defaultObject(job.getParams(), HashMap::new)); job.setResourceManagerAttributes(ParamUtils.defaultObject(job.getResourceManagerAttributes(), HashMap::new)); job.setAttributes(ParamUtils.defaultObject(job.getAttributes(), HashMap::new)); job.setUserId(userId); job.setRelease(catalogManager.getStudyManager().getCurrentRelease(study, userId));