Ejemplo n.º 1
0
static void
write_single_job( QofInstance *term_p, gpointer data_p )
{
    write_objects_t* s = (write_objects_t*)data_p;

    g_return_if_fail( term_p != NULL );
    g_return_if_fail( GNC_IS_JOB(term_p) );
    g_return_if_fail( data_p != NULL );

    if ( s->is_ok && job_should_be_saved( GNC_JOB(term_p) ) )
    {
        s->is_ok = save_job( s->be, term_p );
    }
}
Ejemplo n.º 2
0
drmaa2_j drmaa2_jsession_run_job(const drmaa2_jsession js, const drmaa2_jtemplate jt) {
    if (!jsession_is_valid(js)) {
        drmaa2_lasterror_v = DRMAA2_INVALID_SESSION;
        drmaa2_lasterror_text_v = "Job session is invalid.";
        return NULL;
    }

    if (jt->jobCategory != DRMAA2_UNSET_STRING) {
        drmaa2_string_list sl = drmaa2_jsession_get_job_categories(js);
        drmaa2_bool supported = DRMAA2_FALSE;
        size_t i;
        for (i = 0; i < drmaa2_list_size(sl); i++) {
            if (strcmp(jt->jobCategory, drmaa2_list_get(sl, i)) == 0) {
                supported = DRMAA2_TRUE;
                break;
            }
        }
        if (supported == DRMAA2_FALSE) {
            drmaa2_lasterror_v = DRMAA2_INVALID_ARGUMENT;
            drmaa2_lasterror_text_v = "Given job category is not supported.";
            return NULL;
        }
    }

    if (!drmaa2_supports(DRMAA2_JT_EMAIL) && (jt->email != DRMAA2_UNSET_LIST
            || jt->emailOnStarted != DRMAA2_UNSET_BOOL || jt->emailOnTerminated != DRMAA2_UNSET_BOOL)) {
        drmaa2_lasterror_v = DRMAA2_UNSUPPORTED_ATTRIBUTE;
        drmaa2_lasterror_text_v = "Email is not supported.";
        return NULL;
    }

    if (!drmaa2_supports(DRMAA2_JT_MAXSLOTS) && jt->maxSlots != DRMAA2_UNSET_NUM) {
        drmaa2_lasterror_v = DRMAA2_UNSUPPORTED_ATTRIBUTE;
        drmaa2_lasterror_text_v = "MaxSlot is not supported.";
        return NULL;
    }

    if (!drmaa2_supports(DRMAA2_JT_DEADLINE) && jt->deadlineTime != DRMAA2_UNSET_TIME) {
        drmaa2_lasterror_v = DRMAA2_UNSUPPORTED_ATTRIBUTE;
        drmaa2_lasterror_text_v = "DeadLineTime is not supported.";
        return NULL;
    }

    if (!drmaa2_supports(DRMAA2_JT_STAGING) && (jt->stageInFiles != DRMAA2_UNSET_DICT ||
            jt->stageOutFiles != DRMAA2_UNSET_DICT)) {
        drmaa2_lasterror_v = DRMAA2_UNSUPPORTED_ATTRIBUTE;
        drmaa2_lasterror_text_v = "Staging is not supported.";
        return NULL;
    }

    if (!drmaa2_supports(DRMAA2_JT_ACCOUNTINGID) && jt->accountingId != DRMAA2_UNSET_STRING) {
        drmaa2_lasterror_v = DRMAA2_UNSUPPORTED_ATTRIBUTE;
        drmaa2_lasterror_text_v = "AccountingID is not supported.";
        return NULL;
    }

    // further evaluation can be done here

    long long template_id = save_jtemplate(jt, js->name);
    long long job_id = save_job(js, template_id); 
    return submit_job_to_DRMS(js, job_id, jt);
}
Ejemplo n.º 3
0
void Job::save(FILE *file){
	fprintf(file,"%d ",job_type());
	save_job(file);
}