forked from lei.chen/myxce
save works
This commit is contained in:
parent
3f74f14687
commit
47fc32b02c
6 changed files with 155 additions and 25 deletions
|
|
@ -79,9 +79,87 @@ static void lock_objs(xlist_t* l, int op)
|
|||
for (i = 0; i < l->count; i++) {
|
||||
var obj = xlist_get(l, i);
|
||||
|
||||
if (obj != NULL) {
|
||||
lock(obj, op);
|
||||
if (obj == NULL) {
|
||||
continue;
|
||||
}
|
||||
|
||||
lock(obj, op);
|
||||
}
|
||||
}
|
||||
|
||||
static void lock_collect_queues(xlist_t* l, int op)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < l->count; i++) {
|
||||
xce_queue_t* q = (xce_queue_t*)xlist_get(l, i);
|
||||
queue_t* q1;
|
||||
|
||||
if (q == NULL) {
|
||||
continue;
|
||||
}
|
||||
|
||||
q1 = CONTAINER_OF(q, queue_t, queue);
|
||||
lock(q1, op);
|
||||
}
|
||||
}
|
||||
|
||||
static void lock_collect_workers(xlist_t* l, int op)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < l->count; i++) {
|
||||
xce_worker_t* w = (xce_worker_t*)xlist_get(l, i);
|
||||
worker_t* w1;
|
||||
|
||||
if (w == NULL) {
|
||||
continue;
|
||||
}
|
||||
|
||||
w1 = CONTAINER_OF(w, worker_t, host);
|
||||
lock(w1, op);
|
||||
}
|
||||
}
|
||||
|
||||
static void lock_collect_jobs(xlist_t* l, int op)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < l->count; i++) {
|
||||
xce_job_t* j = (xce_job_t*)xlist_get(l, i);
|
||||
job_t* j1;
|
||||
|
||||
if (j == NULL) {
|
||||
continue;
|
||||
}
|
||||
|
||||
j1 = CONTAINER_OF(j, job_t, job);
|
||||
lock(j1, op);
|
||||
}
|
||||
}
|
||||
|
||||
static void collect_resvals_workers(xlist_t* l)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < l->count; i++) {
|
||||
xlist_t lst;
|
||||
xce_worker_t* w = xlist_get(l, i);
|
||||
void* p = NULL;
|
||||
|
||||
if (w == NULL) {
|
||||
continue;
|
||||
}
|
||||
|
||||
xlist_init(&lst, 128);
|
||||
|
||||
collect_resval_with_idx(&(w->resvals), &lst);
|
||||
|
||||
w->nresvals_to_sched = lst.count;
|
||||
MOVE_PTR(p, lst.data);
|
||||
w->resvals_to_sched = (xce_val_with_idx_t**)p;
|
||||
|
||||
xlist_fini(&lst);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -157,7 +235,7 @@ void collect_queues(cluster_t* c, collect_check_fn_t fn, xlist_t* l)
|
|||
iter_destroy(&it);
|
||||
unlock(c->qmgr);
|
||||
|
||||
lock_objs(l, RTTI_LOCK_READ);
|
||||
lock_collect_queues(l, RTTI_LOCK_READ);
|
||||
}
|
||||
|
||||
void collect_resources(cluster_t* c, collect_check_fn_t fn, xlist_t* l)
|
||||
|
|
@ -233,7 +311,7 @@ void collect_jobs(cluster_t* c, collect_check_fn_t fn, xlist_t* l)
|
|||
iter_destroy(&it);
|
||||
unlock(c->jobmgr);
|
||||
|
||||
lock_objs(l, RTTI_LOCK_READ);
|
||||
lock_collect_jobs(l, RTTI_LOCK_READ);
|
||||
|
||||
return;
|
||||
}
|
||||
|
|
@ -272,7 +350,9 @@ void collect_workers(cluster_t* c, collect_check_fn_t fn, xlist_t* l)
|
|||
iter_destroy(&it);
|
||||
unlock(c->workermgr);
|
||||
|
||||
lock_objs(l, RTTI_LOCK_READ);
|
||||
lock_collect_workers(l, RTTI_LOCK_WRITE);
|
||||
|
||||
collect_resvals_workers(l);
|
||||
|
||||
return;
|
||||
}
|
||||
|
|
@ -321,6 +401,8 @@ void unlock_collect_workers(xlist_t* l)
|
|||
continue;
|
||||
}
|
||||
|
||||
free_resval_with_idx_list(&(w->resvals_to_sched), w->nresvals_to_sched);
|
||||
|
||||
w1 = CONTAINER_OF(w, worker_t, host);
|
||||
unlock(w1);
|
||||
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ worker_t* get_ep_worker(cluster_t* c, endpoint_t* ep)
|
|||
}
|
||||
|
||||
lock(c->workermgr, RTTI_LOCK_READ);
|
||||
rc = key_find(c->workermgr, (void*)idx, (void**)&w);
|
||||
rc = vget(c->workermgr, idx, (void**)&w);
|
||||
if (w != NULL) {
|
||||
reference(w);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@
|
|||
#include "utils.h"
|
||||
#include "xce/types.h"
|
||||
#include "xstring.h"
|
||||
#include "preason.h"
|
||||
|
||||
static struct {
|
||||
mylock_t lock;
|
||||
|
|
@ -569,18 +570,43 @@ static void job_destroy(meta_obj_t* obj)
|
|||
dereference(j->job.submit);
|
||||
dereference(j->job.ckptinfo);
|
||||
|
||||
/* FIXME: */
|
||||
if (j->job.pidinfo != NULL) { }
|
||||
if (j->job.pidinfo != NULL) {
|
||||
FREEUP(j->job.pidinfo->pids);
|
||||
FREEUP(j->job.pidinfo->pgids);
|
||||
FREEUP(j->job.pidinfo->exdata);
|
||||
FREEUP(j->job.pidinfo);
|
||||
}
|
||||
|
||||
if (j->job.allocs != NULL) { }
|
||||
if (j->job.allocs != NULL) {
|
||||
free_JobAlloc_ptr(&(j->job.allocs));
|
||||
}
|
||||
|
||||
if (j->job.accounts != NULL) { }
|
||||
if (j->job.accounts != NULL) {
|
||||
/* FIXME??? */
|
||||
}
|
||||
|
||||
if (j->job.run_usage != NULL) { }
|
||||
if (j->job.run_usage != NULL) {
|
||||
int i;
|
||||
|
||||
if (j->job.exit_info != NULL) { }
|
||||
for(i = 0; i < j->job.run_usage->num_hosts; i ++) {
|
||||
if (j->job.run_usage->host_runusage[i] != NULL) {
|
||||
FREEUP(j->job.run_usage->host_runusage[i]->host_name);
|
||||
}
|
||||
|
||||
FREEUP(j->job.run_usage->host_runusage[i]);
|
||||
}
|
||||
|
||||
if (j->job.pend_reasons != NULL) { }
|
||||
FREEUP(j->job.run_usage->host_runusage);
|
||||
FREEUP(j->job.run_usage);
|
||||
}
|
||||
|
||||
if (j->job.exit_info != NULL) {
|
||||
FREEUP(j->job.exit_info);
|
||||
}
|
||||
|
||||
if (j->job.pend_reasons != NULL) {
|
||||
erase_job_preason(j->job.pend_reasons);
|
||||
}
|
||||
|
||||
my_rwlock_fini(&(priv->lock));
|
||||
memset(priv, 0x0, sizeof(*priv));
|
||||
|
|
|
|||
|
|
@ -68,20 +68,33 @@ static void queue_destroy(meta_obj_t* obj)
|
|||
dereference(q->queue.queue);
|
||||
dereference(q->queue.resreq);
|
||||
|
||||
/* FIXME: */
|
||||
if (q->queue.users != NULL) { }
|
||||
if (q->queue.users != NULL) {
|
||||
free_GroupConfig_ptr(&(q->queue.users));
|
||||
}
|
||||
|
||||
if (q->queue.hosts != NULL) { }
|
||||
if (q->queue.hosts != NULL) {
|
||||
free_GroupConfig_ptr(&(q->queue.hosts));
|
||||
}
|
||||
|
||||
if (q->queue.thresholds != NULL) { }
|
||||
if (q->queue.thresholds != NULL) {
|
||||
free_Threshold_list(q->queue.nthresholds, q->queue.thresholds);
|
||||
}
|
||||
|
||||
if (q->queue.runwindow != NULL) { }
|
||||
if (q->queue.runwindow != NULL) {
|
||||
/* FIXME: */
|
||||
}
|
||||
|
||||
if (q->queue.dispatchwindow != NULL) { }
|
||||
if (q->queue.dispatchwindow != NULL) {
|
||||
/* FIXME: */
|
||||
}
|
||||
|
||||
if (q->queue.runwindow_config != NULL) { }
|
||||
if (q->queue.runwindow_config != NULL) {
|
||||
free_TimeWindow_ptr(&(q->queue.runwindow_config));
|
||||
}
|
||||
|
||||
if (q->queue.dispatchwindow_config != NULL) { }
|
||||
if (q->queue.dispatchwindow_config != NULL) {
|
||||
free_TimeWindow_ptr(&(q->queue.dispatchwindow_config));
|
||||
}
|
||||
|
||||
dereference(q->queue.pre_exec);
|
||||
dereference(q->queue.post_exec);
|
||||
|
|
|
|||
|
|
@ -74,11 +74,16 @@ static void worker_destroy(meta_obj_t* obj)
|
|||
FREEUP(w->host.attrs);
|
||||
}
|
||||
|
||||
if (w->host.dispatch_window_config != NULL) { }
|
||||
if (w->host.dispatch_window_config != NULL) {
|
||||
free_timewindow_config(w->host.dispatch_window_config);
|
||||
w->host.dispatch_window_config = NULL;
|
||||
}
|
||||
|
||||
if (w->host.thresholds != NULL) { }
|
||||
|
||||
if (w->host.resvals_to_sched != NULL) { }
|
||||
if (w->host.thresholds != NULL) {
|
||||
free_resource_thresholds(w->host.thresholds, w->host.nthresholds);
|
||||
w->host.thresholds = NULL;
|
||||
w->host.nthresholds = 0;
|
||||
}
|
||||
|
||||
zarray_fini(&(w->host.resvals));
|
||||
|
||||
|
|
|
|||
|
|
@ -101,6 +101,8 @@ static int unsatisfy_(int nres, int* idxs, float* total, float* inuse,
|
|||
|
||||
count = 0;
|
||||
for (i = 0; i < nres; i++) {
|
||||
TRACE("%s resource %d total %f inuse %f uncomit %f wanted %f", __func__,
|
||||
idxs[i], total[i], inuse[i], uncomitted[i], wanted[i]);
|
||||
if (total[i] < inuse[i] + uncomitted[i] + wanted[i]) {
|
||||
count++;
|
||||
}
|
||||
|
|
@ -340,6 +342,8 @@ static int sched_update_res_accounts(xce_scheduler_t* sched, zarray_t* array,
|
|||
|
||||
for (i = 0; i < naccounts; i++) {
|
||||
float val = accounts[i]->used + accounts[i]->reserved;
|
||||
TRACE("%s resource %d old %f delta %f charge %d", __func__, vals[i],
|
||||
val, charge);
|
||||
if (charge) {
|
||||
vals[i] += val;
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue