forked from lei.chen/myxce
fix scheduler notification data pointer ownership and better trace log for unsatisfy_()
This commit is contained in:
parent
a07a74a943
commit
9f6741c2c4
2 changed files with 21 additions and 6 deletions
|
|
@ -294,18 +294,26 @@ int sched_handle_notify(xce_scheduler_t* sched, xce_notify_data_t* notify)
|
|||
case NotifyData_data_schedUpdateJob:
|
||||
rc = sched_handle_sched_update_job(sched,
|
||||
notify->data.sched_update_job);
|
||||
if (rc >= 0)
|
||||
notify->data.sched_update_job = NULL;
|
||||
break;
|
||||
case NotifyData_data_schedUpdateQueue:
|
||||
rc = sched_handle_sched_update_queue(sched,
|
||||
notify->data.sched_update_queue);
|
||||
if (rc >= 0)
|
||||
notify->data.sched_update_queue = NULL;
|
||||
break;
|
||||
case NotifyData_data_schedUpdateResvals:
|
||||
rc = sched_handle_sched_update_resvals(
|
||||
sched, notify->data.sched_update_resvals);
|
||||
if (rc >= 0)
|
||||
notify->data.sched_update_resvals = NULL;
|
||||
break;
|
||||
case NotifyData_data_schedJobRusages:
|
||||
rc = sched_handle_sched_job_rusage(sched,
|
||||
notify->data.sched_job_rusages);
|
||||
if (rc >= 0)
|
||||
notify->data.sched_job_rusages = NULL;
|
||||
break;
|
||||
default:
|
||||
rc = -EINVAL;
|
||||
|
|
|
|||
|
|
@ -93,9 +93,9 @@ int put_resvals(zarray_t* array, int nres, int* idxs, float* vals)
|
|||
return nres;
|
||||
}
|
||||
|
||||
static int unsatisfy_(int nres, int* idxs, float* total, float* inuse,
|
||||
float* uncomitted, float* wanted, int* unmeet_idxs,
|
||||
float* unmeet_vals)
|
||||
static int unsatisfy_(xce_scheduler_t* sched, int nres, int* idxs, float* total,
|
||||
float* inuse, float* uncomitted, float* wanted,
|
||||
int* unmeet_idxs, float* unmeet_vals)
|
||||
{
|
||||
int i, j;
|
||||
int count;
|
||||
|
|
@ -116,8 +116,15 @@ static int unsatisfy_(int nres, int* idxs, float* total, float* inuse,
|
|||
j = 0;
|
||||
for (i = 0; i < nres; i++) {
|
||||
if (total[i] < inuse[i] + uncomitted[i] + wanted[i]) {
|
||||
xce_resource_t* r = NULL;
|
||||
float need = inuse[i] + uncomitted[i] + wanted[i] - total[i];
|
||||
|
||||
vget(sched->resmgr, idxs[i], (void**)&r);
|
||||
TRACE("%s unmet resource %d (%s) shortfall %f", __func__, idxs[i],
|
||||
r ? r->name : "?", need);
|
||||
|
||||
unmeet_idxs[j] = idxs[i];
|
||||
unmeet_vals[j] = inuse[i] + wanted[i] + uncomitted[i] - total[i];
|
||||
unmeet_vals[j] = need;
|
||||
j++;
|
||||
}
|
||||
}
|
||||
|
|
@ -249,7 +256,7 @@ static int sched_check_shared_satisfy_(xce_scheduler_t* sched, xvec_t* total,
|
|||
return rc;
|
||||
}
|
||||
|
||||
rc = unsatisfy_(nres, (int*)wanted->idxs.data, (float*)total->data,
|
||||
rc = unsatisfy_(sched, nres, (int*)wanted->idxs.data, (float*)total->data,
|
||||
(float*)inuse->data, (float*)uncomitted->data,
|
||||
(float*)wanted->vals.data, (int*)unmeet->idxs.data,
|
||||
(float*)unmeet->vals.data);
|
||||
|
|
@ -324,7 +331,7 @@ static int sched_check_host_satisfy_(xce_scheduler_t* sched,
|
|||
return rc;
|
||||
}
|
||||
|
||||
rc = unsatisfy_(nres, (int*)wanted->idxs.data, (float*)total->data,
|
||||
rc = unsatisfy_(sched, nres, (int*)wanted->idxs.data, (float*)total->data,
|
||||
(float*)inuse->data, (float*)uncomitted->data,
|
||||
(float*)wanted->vals.data, (int*)unmeet->idxs.data,
|
||||
(float*)unmeet->vals.data);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue