Esempio n. 1
0
batch_job_id_t batch_job_submit_simple(struct batch_queue * q, const char *cmd, const char *extra_input_files, const char *extra_output_files)
{
	if(!q->job_table)
		q->job_table = itable_create(0);

	if(q->type == BATCH_QUEUE_TYPE_LOCAL) {
		return batch_job_submit_simple_local(q, cmd, extra_input_files, extra_output_files);
	} else if(q->type == BATCH_QUEUE_TYPE_CONDOR) {
		return batch_job_submit_simple_condor(q, cmd, extra_input_files, extra_output_files);
	} else if(q->type == BATCH_QUEUE_TYPE_SGE) {
		return batch_job_submit_simple_cluster(q, cmd, extra_input_files, extra_output_files);
	} else if(q->type == BATCH_QUEUE_TYPE_MOAB) {
		return batch_job_submit_simple_cluster(q, cmd, extra_input_files, extra_output_files);
	} else if(q->type == BATCH_QUEUE_TYPE_TORQUE) {
		return batch_job_submit_simple_cluster(q, cmd, extra_input_files, extra_output_files);
	} else if(q->type == BATCH_QUEUE_TYPE_CLUSTER) {
		return batch_job_submit_simple_cluster(q, cmd, extra_input_files, extra_output_files);
	} else if(q->type == BATCH_QUEUE_TYPE_WORK_QUEUE) {
		return batch_job_submit_simple_work_queue(q, cmd, extra_input_files, extra_output_files);
	} else if(q->type == BATCH_QUEUE_TYPE_WORK_QUEUE_SHAREDFS) {
		return batch_job_submit_simple_work_queue(q, cmd, extra_input_files, extra_output_files);
	} else if(q->type == BATCH_QUEUE_TYPE_HADOOP) {
		return batch_job_submit_simple_hadoop(q, cmd, extra_input_files, extra_output_files);
	} else if(q->type == BATCH_QUEUE_TYPE_MPI_QUEUE) {
		return batch_job_submit_simple_mpi_queue(q, cmd, extra_input_files, extra_output_files);
	} else {
		errno = EINVAL;
		return -1;
	}
}
Esempio n. 2
0
batch_job_id_t batch_job_submit_local(struct batch_queue * q, const char *cmd, const char *args, const char *infile, const char *outfile, const char *errfile, const char *extra_input_files, const char *extra_output_files)
{
    if(cmd == NULL)
        cmd = "/bin/false";
    if(args == NULL)
        args = "";
    if(infile == NULL)
        infile = "/dev/null";
    if(outfile == NULL)
        outfile = "/dev/null";
    if(errfile == NULL)
        errfile = "/dev/null";

    char *command = string_format("%s %s <%s >%s 2>%s", cmd, args, infile, outfile, errfile);

    batch_job_id_t status = batch_job_submit_simple_local(q, command, extra_input_files, extra_output_files);
    free(command);
    return status;
}