当前位置: 首页>>代码示例>>Java>>正文


Java JobTemplate类代码示例

本文整理汇总了Java中org.ggf.drmaa.JobTemplate的典型用法代码示例。如果您正苦于以下问题:Java JobTemplate类的具体用法?Java JobTemplate怎么用?Java JobTemplate使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


JobTemplate类属于org.ggf.drmaa包,在下文中一共展示了JobTemplate类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: execute

import org.ggf.drmaa.JobTemplate; //导入依赖的package包/类
@Override
public void execute(ServletContext servletContext, PlanBuilder planBuilder, Run run, boolean async) {
	SessionFactory sessionFactory = SessionFactory.getFactory();
	Session session = sessionFactory.getSession();
	try {
		session.init("");
		JobTemplate jobTemplate = createJobTemplate(servletContext, session, run);
		String jobId = enqueue(session, run, jobTemplate);
		if (async) {
			String status = waitForStatus(session, jobId);
			if (status != null) {
				run.addStatus(status, "", true);
			}
		}
		session.deleteJobTemplate(jobTemplate);
		session.exit();
	}
	catch (DrmaaException e) {
		throw new RuntimeException(e);
	}
}
 
开发者ID:Bibliome,项目名称:alvisnlp,代码行数:22,代码来源:DRMAAExecutor.java

示例2: createJobTemplate

import org.ggf.drmaa.JobTemplate; //导入依赖的package包/类
private static JobTemplate createJobTemplate(ServletContext servletContext, Session session, Run run) throws DrmaaException {
	JobTemplate result = session.createJobTemplate();
	result.setRemoteCommand("java");
	result.setArgs(Arrays.asList(
			"-cp",
			DRMAAContextParameter.JARS_PATH.getStringValue(servletContext),
			DRMAAExecutor.class.getCanonicalName(),
			AlvisNLPContextParameter.ROOT_PROCESSING_DIR.getStringValue(servletContext),
			AlvisNLPContextParameter.RESOURCE_DIR.getStringValue(servletContext),
			AlvisNLPContextParameter.PLAN_DIR.getStringValue(servletContext),
			run.getId()
			));
	String nativeSpecification = DRMAAContextParameter.NATIVE_SPECIFICATION.getStringValue(servletContext);
	if (nativeSpecification != null && !nativeSpecification.isEmpty()) {
		result.setNativeSpecification(nativeSpecification);
	}
	return result;
}
 
开发者ID:Bibliome,项目名称:alvisnlp,代码行数:19,代码来源:DRMAAExecutor.java

示例3: getJobSpecification

import org.ggf.drmaa.JobTemplate; //导入依赖的package包/类
@Override
public List<JobSpecification> getJobSpecification(JobPool jp) throws IOException, DrmaaException {
	if (commandFormat == null) {
		throw new IllegalArgumentException("missing remote command (and args)");
	}
	Collection<Map<String,String>> prod = new ProductMap<String,String>(variables, false);
	List<JobSpecification> result = new ArrayList<JobSpecification>(prod.size());
	FormatSequence sourceFormat = getSourceFormatSequence();
	for (Map<String,String> vars : prod) {
		JobSpecification js = jp.createJobSpecification(sourceFormat.build(vars, null));
		JobTemplate jt = js.getJobTemplate();
		setJobTemplateSpecs(jt, vars);
		result.add(js);
	}
	return result;
}
 
开发者ID:Bibliome,项目名称:bibliome-java-utils,代码行数:17,代码来源:ProductPatternSpecificationBuilder.java

示例4: setJobTemplateCommand

import org.ggf.drmaa.JobTemplate; //导入依赖的package包/类
private static void setJobTemplateCommand(JobTemplate jt, String line) throws IOException, DrmaaException {
	Reader r = new StringReader(line);
	StreamTokenizer tokenizer = new StreamTokenizer(r);
	tokenizer.quoteChar('"');
	tokenizer.quoteChar('\'');
	String cmd = null;
	List<String> args = new ArrayList<String>();
	for (int tok = tokenizer.nextToken(); tok != StreamTokenizer.TT_EOF; tok = tokenizer.nextToken()) {
		if (tok == StreamTokenizer.TT_WORD || tok == StreamTokenizer.TT_NUMBER) {
			if (cmd == null) {
				cmd = tokenizer.sval;
			}
			else {
				args.add(tokenizer.sval);
			}
		}
	}
	jt.setRemoteCommand(cmd);
	jt.setArgs(args);
}
 
开发者ID:Bibliome,项目名称:bibliome-java-utils,代码行数:21,代码来源:FileJobSpecificationBuilder.java

示例5: enqueue

import org.ggf.drmaa.JobTemplate; //导入依赖的package包/类
private static String enqueue(Session session, Run run, JobTemplate jobTemplate) throws DrmaaException {
	String result = session.runJob(jobTemplate);
	run.addStatus(RunStatus.QUEUED, result, false);
	run.setProperty(DRMAA_JOB_ID_PROPERTY, result);
	run.write();
	return result;
}
 
开发者ID:Bibliome,项目名称:alvisnlp,代码行数:8,代码来源:DRMAAExecutor.java

示例6: setJobTemplateSpecs

import org.ggf.drmaa.JobTemplate; //导入依赖的package包/类
private void setJobTemplateSpecs(JobTemplate jt, Map<String,String> vars) throws DrmaaException {
	String cmd = commandFormat.build(vars, null);
	jt.setRemoteCommand(cmd);
	List<String> args = getArgs(vars);
	jt.setArgs(args);
	if (geOptionsFormat != null) {
		String geOpts = geOptionsFormat.build(vars, null);
		jt.setNativeSpecification(geOpts);
	}
}
 
开发者ID:Bibliome,项目名称:bibliome-java-utils,代码行数:11,代码来源:ProductPatternSpecificationBuilder.java

示例7: setJobTemplateSpecs

import org.ggf.drmaa.JobTemplate; //导入依赖的package包/类
private static void setJobTemplateSpecs(JobTemplate jt, String line) throws DrmaaException, IOException {
	int ddash = line.indexOf("--");
	if (ddash != -1) {
		String geOpts = line.substring(0, ddash);
		jt.setNativeSpecification(geOpts);
		line = line.substring(ddash + 2);
	}
	setJobTemplateCommand(jt, line);
}
 
开发者ID:Bibliome,项目名称:bibliome-java-utils,代码行数:10,代码来源:FileJobSpecificationBuilder.java

示例8: submitJob

import org.ggf.drmaa.JobTemplate; //导入依赖的package包/类
private SubmittedJob submitJob(RuntimeStateProvider runtimeStateProvider, RuntimeContext runtimeContext,
        Timing timing) throws IOException, DrmaaException, InstanceProvisionException, LinkerException {
    RuntimeAnnotatedExecutionTrace executionTrace = runtimeStateProvider.provideExecutionTrace(runtimeContext);
    RuntimeProxyModule module = (RuntimeProxyModule) executionTrace.getModule();
    String declarationName = module.getDeclaration().getQualifiedName().toString();
    Path ioPath = Files.createTempDirectory(jobIOBasePath, declarationName);
    timing.ioPath = ioPath;
    try (ObjectOutputStream objectOutputStream
            = new ObjectOutputStream(Files.newOutputStream(stdinPath(ioPath)))) {
        objectOutputStream.writeObject(runtimeStateProvider);
    }
    JobTemplate jobTemplate = drmaaSession.createJobTemplate();
    try {
        jobTemplate.setJobName(getJobName(declarationName));
        ImmutableList<String> command = ImmutableList.copyOf(commandProvider.getCommand(executionTrace));
        timing.commandLine = command;
        jobTemplate.setRemoteCommand(command.get(0));
        jobTemplate.setArgs(command.subList(1, command.size()));
        jobTemplate.setTransferFiles(TRANSFER_FILES);
        jobTemplate.setInputPath(":" + stdinPath(ioPath));
        jobTemplate.setOutputPath(":" + stdoutPath(ioPath));
        jobTemplate.setErrorPath(":" + stderrPath(ioPath));
        String nativeSpecification = nativeSpecificationProvider.getNativeSpecification(executionTrace);
        timing.nativeArguments = nativeSpecification;
        jobTemplate.setNativeSpecification(nativeSpecification);
        timing.drmaaSubmissionTimeMillis = System.currentTimeMillis();
        SubmittedJob submittedJob = new SubmittedJob(executionTrace, drmaaSession.runJob(jobTemplate));
        timing.submittedJob = submittedJob;
        log.debug("{}, command: {}, native: {}", submittedJob, command, nativeSpecification);
        return submittedJob;
    } finally {
        drmaaSession.deleteJobTemplate(jobTemplate);
    }
}
 
开发者ID:cloudkeeper-project,项目名称:cloudkeeper,代码行数:35,代码来源:DrmaaSimpleModuleExecutor.java

示例9: runJob

import org.ggf.drmaa.JobTemplate; //导入依赖的package包/类
/**
 * Runs a job, by calling qsub using the job template settings, and
 * connection info provided when the session was created.
 *
 * @param jt job template
 */
@Override
public String runJob(JobTemplate jt) throws DrmaaException {
    CmdLine cmd = CmdLine.build(COMMAND_QSUB);
    addIf(cmd, StringUtils.isNotBlank(jt.getJobName()), Arrays.asList("-N", jt.getJobName()));
    // addIf(cmd, StringUtils.isNotBlank(jt.getWorkingDirectory()),
    // Arrays.asList("-N", jt.getWorkingDirectory()));
    addIf(cmd, StringUtils.isNotBlank(jt.getOutputPath()), Arrays.asList("-o", jt.getOutputPath()));
    addIf(cmd, StringUtils.isNotBlank(jt.getErrorPath()), Arrays.asList("-e", jt.getErrorPath()));
    addIf(cmd, jt.getJoinFiles(), Arrays.asList("-j", "oe"));
    addIf(cmd, jt.getHardWallclockTimeLimit() != 0,
            Arrays.asList("-l", "walltime=" + jt.getHardWallclockTimeLimit()));
    LOGGER.finest("native spec " + jt.getNativeSpecification());
    if (StringUtils.isNotBlank(jt.getNativeSpecification())) {
        add(cmd, Arrays.asList(jt.getNativeSpecification().split(" ")));
    }

    addIf(cmd, true, Arrays.asList(jt.getRemoteCommand()));

    if (jt.getArgs() != null && jt.getArgs().size() > 0) {
        for (Object arg : jt.getArgs()) {
            cmd.addArgument((String) arg);
        }
    }

    // inner class
    CommandOutput commandOutput;
    try {
        commandOutput = this.executeCommand(cmd);
    } catch (InterruptedException e) {
        throw new InvalidJobException(e.getMessage());
    }
    LOGGER.finest("qsub exit value: " + commandOutput.getExitValue());

    String out = handleCommandOutput(commandOutput);

    String jobId = out;
    LOGGER.info("jobId: " + jobId);
    return jobId.trim();
}
 
开发者ID:biouno,项目名称:drmaa-pbs,代码行数:46,代码来源:SessionImpl.java

示例10: JobSpecification

import org.ggf.drmaa.JobTemplate; //导入依赖的package包/类
JobSpecification(String source, JobTemplate jobTemplate) {
	super();
	this.source = source;
	this.jobTemplate = jobTemplate;
}
 
开发者ID:Bibliome,项目名称:bibliome-java-utils,代码行数:6,代码来源:JobSpecification.java

示例11: getJobTemplate

import org.ggf.drmaa.JobTemplate; //导入依赖的package包/类
public JobTemplate getJobTemplate() {
	return jobTemplate;
}
 
开发者ID:Bibliome,项目名称:bibliome-java-utils,代码行数:4,代码来源:JobSpecification.java

示例12: createJobSpecification

import org.ggf.drmaa.JobTemplate; //导入依赖的package包/类
public JobSpecification createJobSpecification(String source) throws DrmaaException {
	JobTemplate jt = session.createJobTemplate();
	return new JobSpecification(source, jt);
}
 
开发者ID:Bibliome,项目名称:bibliome-java-utils,代码行数:5,代码来源:JobPool.java

示例13: processLine

import org.ggf.drmaa.JobTemplate; //导入依赖的package包/类
private static JobSpecification processLine(JobPool jp, String source, String line) throws DrmaaException, IOException {
	JobSpecification result = jp.createJobSpecification(source);
	JobTemplate jt = result.getJobTemplate();
	setJobTemplateSpecs(jt, line);
	return result;
}
 
开发者ID:Bibliome,项目名称:bibliome-java-utils,代码行数:7,代码来源:FileJobSpecificationBuilder.java

示例14: createJobTemplate

import org.ggf.drmaa.JobTemplate; //导入依赖的package包/类
@Override
public JobTemplate createJobTemplate() throws DrmaaException {
    throw new NotImplementedException();
}
 
开发者ID:biouno,项目名称:drmaa-java,代码行数:5,代码来源:PbsSession.java

示例15: deleteJobTemplate

import org.ggf.drmaa.JobTemplate; //导入依赖的package包/类
@Override
public void deleteJobTemplate(JobTemplate arg0) throws DrmaaException {
    throw new NotImplementedException();
}
 
开发者ID:biouno,项目名称:drmaa-java,代码行数:5,代码来源:PbsSession.java


注:本文中的org.ggf.drmaa.JobTemplate类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。