save works
This commit is contained in:
parent
c1e42b1ee2
commit
cd0bca3138
8 changed files with 127 additions and 6 deletions
|
|
@ -7,6 +7,7 @@
|
|||
|
||||
#include "client.h"
|
||||
#include "controller.capnp.h"
|
||||
#include "decision.h"
|
||||
#include "kvmgr.h"
|
||||
#include "objmgr.h"
|
||||
#include "plugin.h"
|
||||
|
|
@ -29,7 +30,37 @@ static void* sched_job_picker(void* arg)
|
|||
|
||||
static xce_decision_t* calc_decision(xce_scheduler_t* sched, uint64_t jobid)
|
||||
{
|
||||
return NULL;
|
||||
xce_sched_job_t* job = sched_get_job(sched, jobid);
|
||||
xce_sched_plugin_t* plugin = NULL;
|
||||
xce_job_alloc_t* alloc = NULL;
|
||||
|
||||
if (job == NULL) {
|
||||
ERROR("%s job %lu can not be found", __func__, jobid);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (job->allocator == NULL) {
|
||||
ERROR("%s job %lu has invalid allocator", __func__, jobid);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
plugin = (xce_sched_plugin_t*)job->allocator;
|
||||
if (plugin->job_alloc_fn == NULL) {
|
||||
ERROR("%s plugin %s has no allocation function", __func__,
|
||||
plugin->name);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
alloc = plugin->job_alloc_fn(job->allocator, jobid);
|
||||
if (alloc == NULL) {
|
||||
return make_pend_decision(jobid);
|
||||
}
|
||||
|
||||
return make_dispatch_decision(alloc);
|
||||
}
|
||||
|
||||
static int commit_decision(xce_scheduler_t *sched, xce_decision_t *decision) {
|
||||
return sched_commit_decision(sched, decision);
|
||||
}
|
||||
|
||||
static void* sched_allocator(void* arg)
|
||||
|
|
@ -54,6 +85,8 @@ static void* sched_allocator(void* arg)
|
|||
/* calculate decision for jobid */
|
||||
decision = calc_decision(sched, jobid);
|
||||
|
||||
commit_decision(sched, decision);
|
||||
|
||||
cbuf_put(&(sched->decisions), &decision);
|
||||
}
|
||||
|
||||
|
|
@ -98,6 +131,7 @@ static void sched_pend_update_killer(data_item_t* it)
|
|||
static int sched_register_plugins(xce_scheduler_t* sched)
|
||||
{
|
||||
register_fcfs(sched);
|
||||
register_default_allocator(sched);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -366,3 +400,7 @@ xce_sched_project_t* sched_get_project(xce_scheduler_t* sched, char* name)
|
|||
int sched_job_is_ready(xce_sched_job_t* j) { return 1; }
|
||||
|
||||
int sched_queue_is_ready(xce_sched_queue_t* q) { return 1; }
|
||||
|
||||
int sched_commit_decision(xce_scheduler_t *sched, xce_decision_t *decision) {
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue