示例#1
0
void
prtJobReserv(struct jobInfoEnt *job)
{
    char prline[MAXLINELEN];

    
    int                 i = 0;
    NAMELIST  *hostList = NULL;

    if (lsbParams[LSB_SHORT_HOSTLIST].paramValue && job->numExHosts > 1
         && strcmp(lsbParams[LSB_SHORT_HOSTLIST].paramValue, "1") == 0) {
        hostList = lsb_compressStrList(job->exHosts, job->numExHosts);
        if (!hostList) {
            exit(99);
        }   
    }   
    

    if (job->numExHosts > 0 && job->reserveTime > 0) {
	if (job->numExHosts > 1)
            sprintf(prline, (_i18n_msg_get(ls_catd,NL_SETN,618, "%s: Reserved <%d> job slots on host(s)")), /* catgets  618  */
                _i18n_ctime(ls_catd, CTIME_FORMAT_a_b_d_T, &job->reserveTime), 
		job->numExHosts);
        else
            sprintf(prline, (_i18n_msg_get(ls_catd,NL_SETN,619, "%s: Reserved <%d> job slot on host")), /* catgets  619  */
                _i18n_ctime(ls_catd, CTIME_FORMAT_a_b_d_T, &job->reserveTime), 
		job->numExHosts);
        prtLine(prline);
        
        if (lsbParams[LSB_SHORT_HOSTLIST].paramValue && job->numExHosts > 1 
             && strcmp(lsbParams[LSB_SHORT_HOSTLIST].paramValue, "1") == 0) {
            for (i = 0; i < hostList->listSize; i++) {
                sprintf(prline, " <%d*%s>", hostList->counter[i],
                                            hostList->names[i]);
                prtLine(prline);
            }   
        } else {
            for (i = 0; i < job->numExHosts; i++) {
                sprintf(prline, " <%s>", job->exHosts[i]);
                prtLine(prline);
            }   
        }   
        
    }

} 
示例#2
0
void
prtJobStart(struct jobInfoEnt *job, int prtFlag, int jobPid, int tFormat)
{
    char prline[MAXLINELEN], tBuff[20];
    time_t startTime;



    int                 i = 0;
    struct nameList  *hostList = NULL;


    if (lsbParams[LSB_SHORT_HOSTLIST].paramValue && job->numExHosts > 1
         &&  strcmp(lsbParams[LSB_SHORT_HOSTLIST].paramValue, "1") == 0) {
        hostList = lsb_compressStrList(job->exHosts, job->numExHosts);
        if (!hostList) {
            exit(99);
        }
    }


    if (tFormat) {
        sprintf (tBuff, "%s <%s>", I18N_Job, lsb_jobid2str(job->jobId));
    }
    else if (LSB_ARRAY_IDX(job->jobId) > 0 )
        sprintf (tBuff, " [%d]", LSB_ARRAY_IDX(job->jobId));
    else
       tBuff[0] = '\0';

    if (job->startTime && job->numExHosts) {


        if (job->startTime < job->submitTime)
            startTime = job->submitTime;
        else
            startTime = job->startTime;

        if ((job->submit.options & SUB_PRE_EXEC)
             && (prtFlag != BJOBS_PRINT)) {
            if (prtFlag == BHIST_PRINT_PRE_EXEC)
	    {
		if (tBuff[0] == '\0')
	            sprintf(prline, "%s: %s",
		            _i18n_ctime(ls_catd, CTIME_FORMAT_a_b_d_T,
					 &startTime),
		            I18N(604, "The pre-exec command is started on")); /* catgets  604  */
		else
	            sprintf(prline, "%s:%s, %s",
			    _i18n_ctime(ls_catd, CTIME_FORMAT_a_b_d_T,
					&startTime),
		            tBuff,
			    I18N(605, "the pre-exec command is started on")); /* catgets  605  */
	    }
	    else
	    {
		if (tBuff[0] == '\0')
	            sprintf(prline, "%s: %s",
			    _i18n_ctime(ls_catd, CTIME_FORMAT_a_b_d_T, &startTime),
			    I18N(606, "The batch job command is started on")); /*catgets 606 */
		else
	            sprintf(prline, "%s:%s, %s",
			   _i18n_ctime(ls_catd, CTIME_FORMAT_a_b_d_T, &startTime),
			   tBuff,
			   I18N(607, "the batch job command is started on")); /*catgets 607 */
	    }
	} else {
	    if (jobPid > 0)
	    {
		if (tBuff[0] == '\0')
		    sprintf(prline, "%s: %s",
			    _i18n_ctime(ls_catd, CTIME_FORMAT_a_b_d_T, &startTime),
			    I18N(608, "Started on")); /* catgets  608  */
		else
		    sprintf(prline, "%s:%s %s",
			    _i18n_ctime(ls_catd, CTIME_FORMAT_a_b_d_T, &startTime),
			    tBuff,
			    I18N(609, "started on")); /* catgets  609  */
	    }
	    else
	    {
		if (tBuff[0] == '\0')
		    sprintf(prline, "%s: %s",
			    _i18n_ctime(ls_catd, CTIME_FORMAT_a_b_d_T, &startTime),
			    I18N(610, "Dispatched to")); /* catgets 610 */
		else
		    sprintf(prline, "%s: %s %s",
			    _i18n_ctime(ls_catd, CTIME_FORMAT_a_b_d_T, &startTime),
			    tBuff,
			    I18N(611, "dispatched to")); /* catgets  611 */
	    }
	}


        prtLineWUF(prline);
        if (job->numExHosts > 1) {
            sprintf(prline, " %d %s",
		    job->numExHosts,
		    I18N(612, "Hosts/Processors")); /* catgets  612  */
            prtLineWUF(prline);
        }

        if (lsbParams[LSB_SHORT_HOSTLIST].paramValue && job->numExHosts > 1
             && strcmp(lsbParams[LSB_SHORT_HOSTLIST].paramValue, "1") == 0) {
            for (i = 0; i < hostList->listSize; i++) {
                sprintf(prline, " <%d*%s>", hostList->counter[i],
                                            hostList->names[i]);
                prtLineWUF(prline);
            }
        } else {
            for (i = 0; i < job->numExHosts; i++) {
                sprintf(prline, " <%s>", job->exHosts[i]);
                prtLineWUF(prline);
            }
        }

	if (job->execHome && strcmp (job->execHome, "")) {
	    sprintf(prline, ", %s <%s>",
		    I18N(615, "Execution Home"),  /* catgets 615 */
		    job->execHome);
	    prtLineWUF(prline);
        }
	if (job->execCwd && strcmp (job->execCwd, "")) {
	    sprintf(prline, ", %s <%s>",
		    I18N(616, "Execution CWD"), /* catgets 616 */
		    job->execCwd);
	    prtLineWUF(prline);
        }
	if (job->execUsername && strcmp(job->execUsername, "") &&
		strcmp(job->user, job->execUsername)) {
	    sprintf(prline, ", %s <%s>",
		    I18N(617, "Execution user name"), /* catgets 617 */
		    job->execUsername);
            prtLineWUF(prline);
        }
	sprintf(prline, ";\n");
	prtLineWUF(prline);
    }
}
示例#3
0
static void
tryStop (char *myhostnm, struct hostLoad *myload)
{
    static char fname[] = "tryStop";
    struct jobCard *jobCard, *next;
    int reasons, subreasons, stopmore = FALSE;
    static int errCount = 0, lastTryStopTime = 0;

    if (now - lastTryStopTime < sbdSleepTime) {

        return;
    }
    lastTryStopTime = now;

    for (jobCard = jobQueHead->forw; jobCard != jobQueHead; jobCard = next) {
        next = jobCard->forw;

	if (jobCard->jobSpecs.numToHosts == 1) {

            if  ((jobCard->jobSpecs.jStatus & JOB_STAT_RUN)
                && (now >= jobCard->jobSpecs.startTime + sbdSleepTime)
                && shouldStop (myload, jobCard, &reasons, &subreasons, 1, &stopmore)) {


    	        jobSuspendAction (jobCard, SIG_SUSP_LOAD, reasons, subreasons);
	        if (stopmore)
                    continue;
                else
	            return;
	    }
	} else {
	    struct hostLoad *load;
            int numh;
            struct nameList *hostList;

            numh = jobCard->jobSpecs.numToHosts;
            hostList = lsb_compressStrList(jobCard->jobSpecs.toHosts, numh);
            numh = hostList->listSize;



           if (hostList->listSize == 1) {
               load = myload;
           } else {
                load = ls_loadofhosts ("-", &numh, EFFECTIVE, 0,
                                    hostList->names, hostList->listSize);
           }

	    if (load == NULL) {
                if (errCount < 3)
		    ls_syslog(LOG_ERR, I18N_JOB_FAIL_S_MM, fname,
			      lsb_jobid2str(jobCard->jobSpecs.jobId),
			      "ls_loadofhosts");
		errCount++;
                if (lserrno == LSE_LIM_BADHOST)
                    relife();
		if (lserrno == LSE_BAD_XDR)
	            relife();
		if (lserrno == LSE_LIM_DOWN || lserrno == LSE_TIME_OUT)
		    myStatus |= NO_LIM;
		continue;
	    } else {
                errCount = 0;
		myStatus = 0;
            }

	    if ((jobCard->jobSpecs.jStatus & JOB_STAT_RUN)
                && now >= jobCard->jobSpecs.startTime + sbdSleepTime) {
		if (shouldStop (load, jobCard, &reasons, &subreasons, numh, &stopmore)) {

                    jobSuspendAction (jobCard, SIG_SUSP_LOAD, reasons, subreasons);
                    if (stopmore)
		        break;
                    else
		        return;
		}
            }
        }
    }
    return;

}
示例#4
0
static void
tryResume (struct hostLoad *myload)
{
    char fname[] = "tryResume";
    struct jobCard *jobCard, *next;

    static int errCount = 0, lastTryResumeTime = 0;


    if (now - lastTryResumeTime < sbdSleepTime) {

        return;
    }
    lastTryResumeTime = now;

    for (jobCard = jobQueHead->back; jobCard != jobQueHead; jobCard = next) {
        next = jobCard->back;

	if (!(jobCard->jobSpecs.jStatus & JOB_STAT_SSUSP) ||
	    jobCard->jobSpecs.actPid)
            continue;

        if (jobCard->jobSpecs.numToHosts == 1) {
            if (shouldResume (myload, jobCard, 1)) {


                if (jobResumeAction(jobCard, SIG_RESUME_LOAD, LOAD_REASONS) < 0)
                    continue;
                else
                    return;
            }
	} else {
            int numh;
	    struct hostLoad *load;
            struct nameList *hostList;

	    numh = jobCard->jobSpecs.numToHosts;
            hostList = lsb_compressStrList(jobCard->jobSpecs.toHosts, numh);
            numh = hostList->listSize;
            load = ls_loadofhosts ("-", &numh, EFFECTIVE, 0,
                                   hostList->names, hostList->listSize);

	    if (load == NULL) {
                if (errCount < 3)
		    ls_syslog(LOG_ERR, I18N_JOB_FAIL_S_M, fname,
			      lsb_jobid2str(jobCard->jobSpecs.jobId),
			      "ls_loadofhosts");
                errCount++;
		if (lserrno == LSE_LIM_BADHOST)
		    relife();
		if (lserrno == LSE_BAD_XDR)
		    relife();
		if (lserrno == LSE_LIM_DOWN || lserrno == LSE_TIME_OUT)
		    myStatus |= NO_LIM;
		continue;
	    } else {
		myStatus = 0;
                errCount = 0;
            }
            if (!shouldResume (load, jobCard, numh))
                continue;



	    if (jobResumeAction(jobCard, SIG_RESUME_LOAD, LOAD_REASONS) < 0)

		continue;
	    else
	        return;
        }
    }
    return;

}