⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pack_queues.c

📁 openPBS的开放源代码
💻 C
📖 第 1 页 / 共 2 页
字号:
		(schd_SMALL_JOB_MAX <= 0))	    {		if (!(job->flags & JFLAGS_PRIORITY)) {		    if (schd_primetime_limits(job, queue, 0, reason)) {			schd_comment_job(job, reason, JOB_COMMENT_OPTIONAL);			/* Note that a job could have run if it were not pt. */			if (!rerun)			    queue->flags |= QFLAGS_NPT_JOBS;			continue;		    }		}	    }	    /*	     * Check that this job will complete before the beginning of 	     * nonprime. The '0' indicates that we are interested in "now".	     */	    if (schd_NONPRIME_DRAIN_SYS) {		/* Note: Special jobs are not subject to this restriction */		if (!(job->flags & JFLAGS_PRIORITY)) {		    if (!schd_finish_before_np(job, queue, 0, reason)) {			schd_comment_job(job, reason, JOB_COMMENT_OPTIONAL);			/* Note that a job could have run if it were not pt. */			if (!rerun)			    queue->flags |= QFLAGS_NPT_JOBS;			continue;		    }		}	    }	    /*	     * Check that the queue is actually available to pack jobs	     * into.  Although it was checked above, the above test is	     * very inexpensive, so it's not a big deal to do it again. 	     */	    if (schd_check_queue_limits(queue, reason)) {		if (firstfit == queue)		    schd_comment_job(job, reason, JOB_COMMENT_OPTIONAL);		continue;	    }	    /* 	     * Check this job against the execution resource limits. 	     * There is no point to going any further if this job would	     * overrun the system limits.	     * It is possible for the size of the queues to be larger than	     * the available resources on the machine (i.e. a node board	     * goes down).  Make sure that jobs are not considered that will	     * not be able to run within the system's current resources.	     */	    if (!schd_resources_avail(job, queue->rsrcs, reason) ||		schd_resource_limits(job, queue->rsrcs, reason))	    {		if (firstfit == queue)		    schd_comment_job(job, reason, JOB_COMMENT_OPTIONAL);		/* Continue to the next job. */		continue;	    }	    /*	     * Check that this job will complete before the beginning of 	     * nonprime. The '0' indicates that we are interested in "now".	     * Note: Special jobs are not subject to this restriction.	     */	    if (schd_NONPRIME_DRAIN_SYS && !(job->flags & JFLAGS_PRIORITY)) {		if (!schd_finish_before_np(job, queue, 0, reason)) {		   schd_comment_job(job, reason, JOB_COMMENT_OPTIONAL);		   continue;		}	    }	    /*	     * If the queue is being drained, don't run the job in it unless	     * (1) there are unreserved resources available, or 	     * (2) it would *not* increase the time it will take to drain	     * the queue. Note that drain_by is the absolute time, while	     * the job->time_left is relative to now.	     */	    /* (1) are there unreserved nodes available?	     */	    if (job->nodes > 	       (queue->nodes_max - (queue->nodes_assn + queue->nodes_rsvd))) {		   /* no, so (2) see if we can backfill with this job... */	        if (queue->flags & QFLAGS_DRAINING) {		    if ((schd_TimeNow + job->walltime) > queue->drain_by) {		        (void)sprintf(reason, "Queue %s is being drained.",			    queue->qname);		        if (firstfit == queue)			    schd_comment_job(job, reason, JOB_COMMENT_OPTIONAL);		        continue;		    }	        }	    }	    	    /*	     * Queue can accept a job, provided the job does not overrun the	     * queue limits.	     */	    if (schd_user_limits(job, queue, reason)) {		if (firstfit == queue)		    schd_comment_job(job, reason, JOB_COMMENT_OPTIONAL);		continue;	    }	    /*	     * Check for fragmentation in the queue, and don't run it if so.	     * fragment_okay() returns -1 if queue is nonsensical, 1 if this	     * job would induce or perpetuate fragmentation.  If this job is	     * waiting, we don't care - just run it.	     */	    if (schd_AVOID_FRAGS && !(job->flags & JFLAGS_WAITING)) {		if (!schd_fragment_okay(job, queue, reason)) {		    if (firstfit == queue)			schd_comment_job(job, reason, JOB_COMMENT_OPTIONAL);		    continue;		}	    }#ifdef NODEMASK	    /*	     * Attempt to generate a nodemask for the job, if required.	     * If a nodemask cannot be generated, ignore this job.	     */	    if (queue->flags & QFLAGS_NODEMASK) {		nodesreq = job->nodes;		if (!schd_alloc_nodes(nodesreq, queue, &(job->nodemask))) {		    DBPRT(("%s: Can't alloc %d nodes from queue %s, "			"skipping job %s\n", id, nodesreq, queue->qname, 			job->jobid));		    continue;		}	    }#endif	/* NODEMASK */	    /*	     * If this job requires HPM support for its execution, check	     * the state of the hardware counters on the queue's exechost.	     * If that fails, comment the job, and go on to the next queue.	     */	    if (schd_MANAGE_HPM && job->flags & JFLAGS_NEEDS_HPM) {		if (!(queue->rsrcs->flags & RSRCS_FLAGS_HPM_USER)) {		    /* 		     * Attempt to set the HPM counters on the execution host		     * for this queue to user mode.		     */		    if (schd_hpm_ctl(queue->rsrcs, HPM_SETUP_USERMODE, reason))		    {			if (firstfit == queue)			    schd_comment_job(job, reason, JOB_COMMENT_OPTIONAL);			continue;		    }		}	    }	    /*	     * Found a queue on which this job can run.  Attempt to run it.	     */	    break;	}	/*	 * If the job was unable to fit on all of the queues, go on to the	 * next one.  For "strict" packing, make this a 'break' and it will	 * stop processing jobs when it finds the first one that does not	 * fit.	 */	if (!qptr) {	    /*	     * If the job did not fit in any of the provided queues, assume	     * that the queue it wants is not available.  Provide a comment,	     * even if it is sort of vague.	     */	    if (firstfit == NULL) {		schd_comment_job(job, schd_JobMsg[NO_RESOURCES], 			JOB_COMMENT_OPTIONAL);	    }	    continue;	}	/* There is a queue free enough to run this job. */	if (schd_run_job_on(job, qptr->queue, qptr->queue->exechost, 	    SET_JOB_COMMENT))	{	    (void)sprintf(log_buffer,		"Unable to run batch job %s on queue %s",		job->jobid, qptr->queue->qname);	    log_record(PBSEVENT_SYSTEM, PBS_EVENTCLASS_SERVER, id, log_buffer);	    return (-1);	}	/*	 * Account for the job's impact on the queue.	 * This includes subtracting the job's resource requests from the	 * queue's available resources, as well as updating the available	 * nodemask for the queue.	 */	schd_charge_job(job, queue, queue->rsrcs);	jobsrun ++;    }    /*     * Adjust the observance of primetime on the queues, if necessary.  Do     * it only if the queue is observing primetime, it has been idle for a     * while(*), it's close enough(*) to primetime, and there were some jobs     * that could have been run if primetime had been not-observed.     */    if (!rerun && 	(schd_ENFORCE_PRIME_TIME && schd_TimeNow >= schd_ENFORCE_PRIME_TIME) && 	schd_NP_DRAIN_BACKTIME > 0 && 	schd_prime_time(0) &&	schd_secs_til_nonprime(0) <= schd_NP_DRAIN_BACKTIME)    {	for (qptr = qlist; qptr != NULL; qptr = qptr->next) {	    queue = qptr->queue;	    /* Were there any jobs that could have run if it were non-pt? */	    if (!(queue->flags & QFLAGS_NPT_JOBS))		continue;	    if (queue->running)		continue;	    /* Already disabled or idle - ignore this queue. */	    if (!queue->observe_pt)		continue;	    /* If a minimum idle time is given, check it. */	    if ((schd_NP_DRAIN_IDLETIME > 0) && 		(schd_TimeNow - queue->idle_since) <= schd_NP_DRAIN_IDLETIME)		continue;	    /* 	     * Queue has been idle for some time.  Start non-primetime early 	     * so those jobs that were refused can start running now.	     */	    (void)sprintf(log_buffer,		"Turning off prime-time enforcement on queue %s\n", 		    queue->qname);	    log_record(PBSEVENT_SYSTEM, PBS_EVENTCLASS_SERVER, id, log_buffer);	    queue->observe_pt = 0;	    rerun ++;	}	if (rerun) {	    (void)sprintf(log_buffer,		"Prime-time enforcement adjusted - reconsidering active jobs.");	    log_record(PBSEVENT_SYSTEM, PBS_EVENTCLASS_SERVER, id, log_buffer);	    DBPRT(("%s: %s\n", id, log_buffer));	    goto run_job_list;	}    }    return (jobsrun);}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -