Exemplo n.º 1
0
/**
 *
 *	@brief update all node partitions of all queues on the server
 *	@note Call update_all_nodepart() after all nodes have been processed
 *		by update_node_on_end/update_node_on_run
 *
 *	  @param[in] policy - policy info
 *	  @param[in] sinfo - server info
 *	  @param[in] flags - flags to modify behavior
 *	  			NO_ALLPART - do not update the metadata in the allpart.
 *	  				     There are circumstances (e.g., calendaring) where
 *	  				     the allpart provides limited use and will constantly
 *	  				     be updated.  It is best to just skip it.
 *
 *	@return nothing
 *
 */
void
update_all_nodepart(status *policy, server_info *sinfo, unsigned int flags)
{
	queue_info *qinfo;
	int i;

	if (sinfo == NULL || sinfo->queues == NULL)
		return;

	if(sinfo->allpart == NULL)
		return;

	if (sinfo->node_group_enable && sinfo->node_group_key != NULL) {
		node_partition_update_array(policy, sinfo->nodepart);
		qsort(sinfo->nodepart, sinfo->num_parts,
			sizeof(node_partition *), cmp_placement_sets);
	}

	/* Update and resort the placement sets on the queues */
	for (i = 0; sinfo->queues[i] != NULL; i++) {
		qinfo = sinfo->queues[i];

		if (sinfo->node_group_enable && qinfo->node_group_key != NULL) {
			node_partition_update_array(policy, qinfo->nodepart);

			qsort(qinfo->nodepart, qinfo->num_parts,
			   sizeof(node_partition *), cmp_placement_sets);
		}
		if ((flags & NO_ALLPART) == 0) {
			if(qinfo->allpart != NULL && qinfo->allpart->res == NULL)
				node_partition_update(policy, qinfo->allpart);
		}
	}

	/* Update and resort the hostsets */
	node_partition_update_array(policy, sinfo->hostsets);
	if (policy->node_sort[0].res_name != NULL &&
	    conf.node_sort_unused && sinfo->hostsets != NULL) {
		/* Resort the nodes in host sets to correctly reflect unused resources */
		qsort(sinfo->hostsets, sinfo->num_hostsets, sizeof(node_partition*), multi_nodepart_sort);
	}

	if ((flags & NO_ALLPART) == 0)
			node_partition_update(policy, sinfo->allpart);

	sinfo->pset_metadata_stale = 0;

}
Exemplo n.º 2
0
/**
 *
 *	@brief update all node partitions of all queues on the server
 *	@note Call update_all_nodepart() after all nodes have been processed
 *		by update_node_on_end/update_node_on_run
 *
 *	  @param[in] policy - policy info
 *	  @param[in] sinfo - server info
 *	  @param[in] resresv- the job that was just run
 *
 *	@return nothing
 *
 */
void
update_all_nodepart(status *policy, server_info *sinfo, resource_resv *resresv)
{
	queue_info *qinfo;
	int update_allpart = 1;
	int i;

	if (sinfo == NULL || sinfo->queues == NULL)
		return;
	
	if(sinfo->allpart == NULL)
		return;

	if (resresv != NULL && resresv ->is_job) {
		if (resresv->job != NULL) {
			queue_info *job_queue;
			job_queue = resresv->job->queue;
			if (job_queue->has_nodes) {
				update_allpart = 0;
				node_partition_update(policy, job_queue->allpart);
			}
		}
	}
	if (update_allpart || sinfo->allpart->res == NULL)
		node_partition_update(policy, sinfo->allpart);

	node_partition_update_array(policy, sinfo->hostsets);
	if (policy->node_sort[0].res_name != NULL &&
	    conf.node_sort_unused && sinfo->hostsets != NULL) {
		/* Resort the nodes in host sets to correctly reflect unused resources */
		qsort(sinfo->hostsets, sinfo->num_hostsets, sizeof(node_partition*), multi_nodepart_sort);
	}

	for (i = 0; sinfo->queues[i] != NULL; i++) {
		qinfo = sinfo->queues[i];

		if (qinfo->node_group_key) {
			node_partition_update_array(policy, qinfo->nodepart);

			qsort(qinfo->nodepart, qinfo->num_parts,
			   sizeof(node_partition *), cmp_placement_sets);
		}
		if(qinfo->allpart != NULL && qinfo->allpart->res == NULL)
			node_partition_update(policy, qinfo->allpart);
	}
}