static void lsfdrmaa_job_control( fsd_job_t *self, int action ) { /* * XXX: waiting for job state change was removed * since it is not required for drmaa_control * to return after change completes. */ lsfdrmaa_job_t *lsf_self = (lsfdrmaa_job_t*)self; LS_LONG_INT job_id; int signal; fsd_log_enter(( "({job_id=%s}, action=%d)", self->job_id, action )); job_id = lsf_self->int_job_id; switch( action ) { case DRMAA_CONTROL_SUSPEND: case DRMAA_CONTROL_HOLD: signal = SIGSTOP; break; case DRMAA_CONTROL_RESUME: case DRMAA_CONTROL_RELEASE: signal = SIGCONT; break; case DRMAA_CONTROL_TERMINATE: /* TODO: sending SIGTERM (configurable)? */ signal = SIGKILL; break; default: fsd_exc_raise_fmt( FSD_ERRNO_INVALID_ARGUMENT, "job::control: unknown action %d", action ); } fsd_mutex_lock( &self->session->drm_connection_mutex ); TRY { int rc = lsb_signaljob( lsf_self->int_job_id, signal ); fsd_log_debug(( "lsb_signaljob( %d[%d], %d ) = %d", LSB_ARRAY_JOBID(lsf_self->int_job_id), LSB_ARRAY_IDX(lsf_self->int_job_id), signal, rc )); if( rc < 0 ) fsd_exc_raise_fmt( FSD_ERRNO_INTERNAL_ERROR, "job::control: could not send %s to job %s", fsd_strsignal( signal ), self->job_id ); } FINALLY { fsd_mutex_unlock( &self->session->drm_connection_mutex ); } END_TRY fsd_log_return(( "" )); }
SEXP lsf_resume_job(SEXP sexp_jobid) { int jobid, rc; jobid = INTEGER(sexp_jobid)[0]; rc = lsb_signaljob(jobid, SIGCONT); if (rc < 0) { Rprintf("lsf_resume_job: lsb_signaljob: %s\n", lsb_sysmsg()); return AsInt(-1); } return AsInt(0); }
static int signalJobs (LS_LONG_INT *jobIds, int numJobs) { int failsignal = FALSE, signaled = FALSE; int i, cc; char msg[80]; for (i = 0; i < numJobs; i++) { if (sigValue == SIGCHK) cc = lsb_chkpntjob(jobIds[i], chkPeriod, chkOptions); else if (sigValue == SIGDEL) cc = lsb_deletejob(jobIds[i], runCount, 0); else if (sigValue == SIGFORCE) cc = lsb_forcekilljob(jobIds[i]); else cc = lsb_signaljob(jobIds[i], sigValue); if (cc < 0) { if (sigValue == SIGCHK && lsberrno == LSBE_NOT_STARTED && chkPeriod != LSB_CHKPERIOD_NOCHNG) { if (chkPeriod) printf((_i18n_msg_get(ls_catd,NL_SETN,470, "Job <%s>: Checkpoint period is now %d min.\n")), /* catgets 470 */ lsb_jobid2str(jobIds[i]), (int) (chkPeriod / 60)); else printf((_i18n_msg_get(ls_catd,NL_SETN,471, "Job <%s>: Periodic checkpointing is disabled\n")), /* catgets 471 */ lsb_jobid2str(jobIds[i])); signaled = TRUE; } else { failsignal = TRUE; sprintf (msg, "%s <%s>", I18N_Job, lsb_jobid2str(jobIds[i])); lsb_perror (msg); } } else { signaled = TRUE; prtSignaled (sigValue, jobIds[i]); } } return (signaled ? !failsignal : FALSE); }