reformat code and job array
This commit is contained in:
parent
a665ccd4fe
commit
9ff857db9f
64 changed files with 1497 additions and 2476 deletions
112
src/lib/client.c
112
src/lib/client.c
|
|
@ -26,8 +26,7 @@ typedef struct {
|
|||
xce_ctx_t ctx;
|
||||
} api_ctx_t;
|
||||
|
||||
int xcecli_ctx_init(xcecli_ctx_t* c,
|
||||
xce_client_config_t* cfg)
|
||||
int xcecli_ctx_init(xcecli_ctx_t* c, xce_client_config_t* cfg)
|
||||
{
|
||||
api_ctx_t* ctx;
|
||||
int rc;
|
||||
|
|
@ -46,16 +45,13 @@ int xcecli_ctx_init(xcecli_ctx_t* c,
|
|||
}
|
||||
|
||||
ctx->conf = cfg;
|
||||
rc = xce_ctx_init(&(ctx->ctx),
|
||||
ctx->conf->from,
|
||||
ctx->conf->key);
|
||||
rc = xce_ctx_init(&(ctx->ctx), ctx->conf->from, ctx->conf->key);
|
||||
if (rc < 0) {
|
||||
free(ctx);
|
||||
return rc;
|
||||
}
|
||||
|
||||
endpoint_init(&(ctx->ep), AF_INET,
|
||||
SOCK_STREAM, 0, 0);
|
||||
endpoint_init(&(ctx->ep), AF_INET, SOCK_STREAM, 0, 0);
|
||||
|
||||
xce_ctx_set_endpoint(&(ctx->ctx), &(ctx->ep));
|
||||
|
||||
|
|
@ -77,8 +73,7 @@ void xcecli_ctx_fini(xcecli_ctx_t c)
|
|||
free(ctx);
|
||||
}
|
||||
|
||||
int xcecli_set_handler(xcecli_ctx_t c,
|
||||
xce_request_handler_t handler)
|
||||
int xcecli_set_handler(xcecli_ctx_t c, xce_request_handler_t handler)
|
||||
{
|
||||
api_ctx_t* ctx = (api_ctx_t*)c;
|
||||
|
||||
|
|
@ -89,8 +84,7 @@ int xcecli_set_handler(xcecli_ctx_t c,
|
|||
return xce_ctx_set_handler(&(ctx->ctx), handler);
|
||||
}
|
||||
|
||||
int xcecli_wakeup(xcecli_ctx_t c,
|
||||
int status)
|
||||
int xcecli_wakeup(xcecli_ctx_t c, int status)
|
||||
{
|
||||
api_ctx_t* ctx = (api_ctx_t*)c;
|
||||
|
||||
|
|
@ -101,8 +95,7 @@ int xcecli_wakeup(xcecli_ctx_t c,
|
|||
return xce_wakeup(&(ctx->ctx), status);
|
||||
}
|
||||
|
||||
int xcecli_try_wakeup(xcecli_ctx_t c,
|
||||
int status)
|
||||
int xcecli_try_wakeup(xcecli_ctx_t c, int status)
|
||||
{
|
||||
api_ctx_t* ctx = (api_ctx_t*)c;
|
||||
|
||||
|
|
@ -122,8 +115,7 @@ int xcecli_start(xcecli_ctx_t c)
|
|||
return -EINVAL;
|
||||
}
|
||||
|
||||
rc = endpoint_connect(&(ctx->ep),
|
||||
ctx->conf->masters[0],
|
||||
rc = endpoint_connect(&(ctx->ep), ctx->conf->masters[0],
|
||||
ctx->conf->master_ports[0]);
|
||||
if (rc < 0) {
|
||||
endpoint_deref(&(ctx->ep));
|
||||
|
|
@ -169,8 +161,7 @@ xce_peerinfo_t* xcecli_get_myinfo(xcecli_ctx_t c)
|
|||
return &(ctx->ctx.myinfo);
|
||||
}
|
||||
|
||||
int xcecli_hello(xcecli_ctx_t c,
|
||||
char* msg)
|
||||
int xcecli_hello(xcecli_ctx_t c, char* msg)
|
||||
{
|
||||
api_ctx_t* ctx = (api_ctx_t*)c;
|
||||
|
||||
|
|
@ -192,8 +183,7 @@ int xcecli_shutdown(xcecli_ctx_t c)
|
|||
return xce_shutdown(&(ctx->ctx));
|
||||
}
|
||||
|
||||
int xcecli_reslist(xcecli_ctx_t c,
|
||||
xce_resource_t*** res)
|
||||
int xcecli_reslist(xcecli_ctx_t c, xce_resource_t*** res)
|
||||
{
|
||||
api_ctx_t* ctx = (api_ctx_t*)c;
|
||||
|
||||
|
|
@ -204,9 +194,7 @@ int xcecli_reslist(xcecli_ctx_t c,
|
|||
return xce_reslist(&(ctx->ctx), res);
|
||||
}
|
||||
|
||||
int xcecli_join(xcecli_ctx_t c,
|
||||
int role,
|
||||
hostattrs_t* attrs)
|
||||
int xcecli_join(xcecli_ctx_t c, int role, hostattrs_t* attrs)
|
||||
{
|
||||
api_ctx_t* ctx = (api_ctx_t*)c;
|
||||
if (ctx == NULL) {
|
||||
|
|
@ -216,8 +204,7 @@ int xcecli_join(xcecli_ctx_t c,
|
|||
return xce_join(&(ctx->ctx), role, attrs);
|
||||
}
|
||||
|
||||
int xcecli_workerlist(xcecli_ctx_t c,
|
||||
xce_worker_t*** workers)
|
||||
int xcecli_workerlist(xcecli_ctx_t c, xce_worker_t*** workers)
|
||||
{
|
||||
api_ctx_t* ctx = (api_ctx_t*)c;
|
||||
if (ctx == NULL) {
|
||||
|
|
@ -227,8 +214,7 @@ int xcecli_workerlist(xcecli_ctx_t c,
|
|||
return xce_workerlist(&(ctx->ctx), workers);
|
||||
}
|
||||
|
||||
int xcecli_jobdispatch(xcecli_ctx_t c,
|
||||
xce_job_dispatch_t* info)
|
||||
int xcecli_jobdispatch(xcecli_ctx_t c, xce_job_dispatch_t* info)
|
||||
{
|
||||
api_ctx_t* ctx = (api_ctx_t*)c;
|
||||
|
||||
|
|
@ -239,9 +225,7 @@ int xcecli_jobdispatch(xcecli_ctx_t c,
|
|||
return xce_jobdispatch(&(ctx->ctx), info);
|
||||
}
|
||||
|
||||
int xcecli_jobsubmit(xcecli_ctx_t c,
|
||||
xce_job_submit_t* submit,
|
||||
uint64_t* jobid)
|
||||
int xcecli_jobsubmit(xcecli_ctx_t c, xce_job_submit_t* submit, uint64_t* jobid)
|
||||
{
|
||||
api_ctx_t* ctx = (api_ctx_t*)c;
|
||||
|
||||
|
|
@ -252,8 +236,7 @@ int xcecli_jobsubmit(xcecli_ctx_t c,
|
|||
return xce_jobsubmit(&(ctx->ctx), submit, jobid);
|
||||
}
|
||||
|
||||
int xcecli_joblist(xcecli_ctx_t c,
|
||||
xce_job_t*** jobs)
|
||||
int xcecli_joblist(xcecli_ctx_t c, xce_job_t*** jobs)
|
||||
{
|
||||
api_ctx_t* ctx = (api_ctx_t*)c;
|
||||
|
||||
|
|
@ -264,8 +247,7 @@ int xcecli_joblist(xcecli_ctx_t c,
|
|||
return xce_joblist(&(ctx->ctx), jobs);
|
||||
}
|
||||
|
||||
int xcecli_clusterconf(xcecli_ctx_t c,
|
||||
xce_clusterconf_t** conf)
|
||||
int xcecli_clusterconf(xcecli_ctx_t c, xce_clusterconf_t** conf)
|
||||
{
|
||||
api_ctx_t* ctx = (api_ctx_t*)c;
|
||||
|
||||
|
|
@ -276,8 +258,7 @@ int xcecli_clusterconf(xcecli_ctx_t c,
|
|||
return xce_clusterconf(&(ctx->ctx), conf);
|
||||
}
|
||||
|
||||
int xcecli_notify_jobfinish(xcecli_ctx_t c,
|
||||
xce_jobfinish_t* jfinish)
|
||||
int xcecli_notify_jobfinish(xcecli_ctx_t c, xce_jobfinish_t* jfinish)
|
||||
{
|
||||
api_ctx_t* ctx = (api_ctx_t*)c;
|
||||
/* clang-format off */
|
||||
|
|
@ -300,9 +281,7 @@ int xcecli_notify_jobfinish(xcecli_ctx_t c,
|
|||
return xcecli_notify(ctx, &data);
|
||||
}
|
||||
|
||||
int xcecli_update_resvals(xcecli_ctx_t c,
|
||||
int nres,
|
||||
xce_resval_t** vals)
|
||||
int xcecli_update_resvals(xcecli_ctx_t c, int nres, xce_resval_t** vals)
|
||||
{
|
||||
api_ctx_t* ctx = (api_ctx_t*)c;
|
||||
int rc;
|
||||
|
|
@ -316,13 +295,8 @@ int xcecli_update_resvals(xcecli_ctx_t c,
|
|||
return rc;
|
||||
}
|
||||
|
||||
int xcecli_update_jusage(xcecli_ctx_t c,
|
||||
uint64_t jobid,
|
||||
int npids,
|
||||
int* pids,
|
||||
int npgids,
|
||||
int* pgids,
|
||||
int nusage,
|
||||
int xcecli_update_jusage(xcecli_ctx_t c, uint64_t jobid, int npids, int* pids,
|
||||
int npgids, int* pgids, int nusage,
|
||||
xce_rusage_t** usages)
|
||||
{
|
||||
api_ctx_t* ctx = (api_ctx_t*)c;
|
||||
|
|
@ -332,17 +306,13 @@ int xcecli_update_jusage(xcecli_ctx_t c,
|
|||
return -EINVAL;
|
||||
}
|
||||
|
||||
rc = xce_update_jusage(&(ctx->ctx), jobid,
|
||||
npids, pids, npgids, pgids,
|
||||
rc = xce_update_jusage(&(ctx->ctx), jobid, npids, pids, npgids, pgids,
|
||||
nusage, usages);
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
int xcecli_resval(xcecli_ctx_t c,
|
||||
char* host,
|
||||
char* res,
|
||||
xce_resval_t*** val)
|
||||
int xcecli_resval(xcecli_ctx_t c, char* host, char* res, xce_resval_t*** val)
|
||||
{
|
||||
api_ctx_t* ctx = (api_ctx_t*)c;
|
||||
|
||||
|
|
@ -357,8 +327,7 @@ int xcecli_resval(xcecli_ctx_t c,
|
|||
return xce_resval(&(ctx->ctx), host, res, val);
|
||||
}
|
||||
|
||||
int xcecli_notify(xcecli_ctx_t c,
|
||||
xce_notify_data_t* data)
|
||||
int xcecli_notify(xcecli_ctx_t c, xce_notify_data_t* data)
|
||||
{
|
||||
api_ctx_t* ctx = (api_ctx_t*)c;
|
||||
|
||||
|
|
@ -373,8 +342,7 @@ int xcecli_notify(xcecli_ctx_t c,
|
|||
return xce_notify(&(ctx->ctx), data);
|
||||
}
|
||||
|
||||
int xcecli_notify_jobstart(xcecli_ctx_t c,
|
||||
job_pidinfo_t* pidinfo)
|
||||
int xcecli_notify_jobstart(xcecli_ctx_t c, job_pidinfo_t* pidinfo)
|
||||
{
|
||||
api_ctx_t* ctx = (api_ctx_t*)c;
|
||||
/* clang-format off */
|
||||
|
|
@ -393,8 +361,7 @@ int xcecli_notify_jobstart(xcecli_ctx_t c,
|
|||
return xcecli_notify(ctx, &data);
|
||||
}
|
||||
|
||||
int xcecli_notify_jobfail(xcecli_ctx_t c,
|
||||
job_failinfo_t* failinfo)
|
||||
int xcecli_notify_jobfail(xcecli_ctx_t c, job_failinfo_t* failinfo)
|
||||
{
|
||||
api_ctx_t* ctx = (api_ctx_t*)c;
|
||||
/* clang-format off */
|
||||
|
|
@ -413,8 +380,7 @@ int xcecli_notify_jobfail(xcecli_ctx_t c,
|
|||
return xcecli_notify(ctx, &data);
|
||||
}
|
||||
|
||||
int xcecli_jobctrl(xcecli_ctx_t c,
|
||||
xce_jobctrl_t* ctrlinfo)
|
||||
int xcecli_jobctrl(xcecli_ctx_t c, xce_jobctrl_t* ctrlinfo)
|
||||
{
|
||||
api_ctx_t* ctx = (api_ctx_t*)c;
|
||||
int rc;
|
||||
|
|
@ -428,8 +394,7 @@ int xcecli_jobctrl(xcecli_ctx_t c,
|
|||
return rc;
|
||||
}
|
||||
|
||||
int xcecli_notify_jobstop(xcecli_ctx_t c,
|
||||
uint64_t jobid)
|
||||
int xcecli_notify_jobstop(xcecli_ctx_t c, uint64_t jobid)
|
||||
{
|
||||
api_ctx_t* ctx = (api_ctx_t*)c;
|
||||
/* clang-format off */
|
||||
|
|
@ -448,8 +413,7 @@ int xcecli_notify_jobstop(xcecli_ctx_t c,
|
|||
return xcecli_notify(ctx, &data);
|
||||
}
|
||||
|
||||
int xcecli_notify_jobresume(xcecli_ctx_t c,
|
||||
uint64_t jobid)
|
||||
int xcecli_notify_jobresume(xcecli_ctx_t c, uint64_t jobid)
|
||||
{
|
||||
api_ctx_t* ctx = (api_ctx_t*)c;
|
||||
/* clang-format off */
|
||||
|
|
@ -468,9 +432,7 @@ int xcecli_notify_jobresume(xcecli_ctx_t c,
|
|||
return xcecli_notify(ctx, &data);
|
||||
}
|
||||
|
||||
int xcecli_notify_jobchkpt(xcecli_ctx_t c,
|
||||
uint64_t jobid,
|
||||
char* info)
|
||||
int xcecli_notify_jobchkpt(xcecli_ctx_t c, uint64_t jobid, char* info)
|
||||
{
|
||||
api_ctx_t* ctx = (api_ctx_t*)c;
|
||||
/* clang-format off */
|
||||
|
|
@ -493,8 +455,7 @@ int xcecli_notify_jobchkpt(xcecli_ctx_t c,
|
|||
return xcecli_notify(ctx, &data);
|
||||
}
|
||||
|
||||
int xcecli_notify_jobpostdone(xcecli_ctx_t c,
|
||||
uint64_t jobid)
|
||||
int xcecli_notify_jobpostdone(xcecli_ctx_t c, uint64_t jobid)
|
||||
{
|
||||
api_ctx_t* ctx = (api_ctx_t*)c;
|
||||
/* clang-format off */
|
||||
|
|
@ -513,8 +474,7 @@ int xcecli_notify_jobpostdone(xcecli_ctx_t c,
|
|||
return xcecli_notify(ctx, &data);
|
||||
}
|
||||
|
||||
int xcecli_queuectrl(xcecli_ctx_t c,
|
||||
xce_queuectrl_t* ctrlinfo)
|
||||
int xcecli_queuectrl(xcecli_ctx_t c, xce_queuectrl_t* ctrlinfo)
|
||||
{
|
||||
api_ctx_t* ctx = (api_ctx_t*)c;
|
||||
int rc;
|
||||
|
|
@ -528,8 +488,7 @@ int xcecli_queuectrl(xcecli_ctx_t c,
|
|||
return rc;
|
||||
}
|
||||
|
||||
int xcecli_runtask(xcecli_ctx_t c,
|
||||
xce_taskrun_t* info)
|
||||
int xcecli_runtask(xcecli_ctx_t c, xce_taskrun_t* info)
|
||||
{
|
||||
api_ctx_t* ctx = (api_ctx_t*)c;
|
||||
int rc;
|
||||
|
|
@ -547,8 +506,7 @@ int xcecli_runtask(xcecli_ctx_t c,
|
|||
return rc;
|
||||
}
|
||||
|
||||
int xcecli_notify_taskstart(xcecli_ctx_t c,
|
||||
xce_task_pidinfo_t* pidinfo)
|
||||
int xcecli_notify_taskstart(xcecli_ctx_t c, xce_task_pidinfo_t* pidinfo)
|
||||
{
|
||||
api_ctx_t* ctx = (api_ctx_t*)c;
|
||||
/* clang-format off */
|
||||
|
|
@ -567,8 +525,7 @@ int xcecli_notify_taskstart(xcecli_ctx_t c,
|
|||
return xcecli_notify(ctx, &data);
|
||||
}
|
||||
|
||||
int xcecli_notify_taskfail(xcecli_ctx_t c,
|
||||
xce_task_failinfo_t* failinfo)
|
||||
int xcecli_notify_taskfail(xcecli_ctx_t c, xce_task_failinfo_t* failinfo)
|
||||
{
|
||||
api_ctx_t* ctx = (api_ctx_t*)c;
|
||||
/* clang-format off */
|
||||
|
|
@ -587,8 +544,7 @@ int xcecli_notify_taskfail(xcecli_ctx_t c,
|
|||
return xcecli_notify(ctx, &data);
|
||||
}
|
||||
|
||||
int xcecli_notify_taskfinish(xcecli_ctx_t c,
|
||||
xce_task_finish_t* info)
|
||||
int xcecli_notify_taskfinish(xcecli_ctx_t c, xce_task_finish_t* info)
|
||||
{
|
||||
api_ctx_t* ctx = (api_ctx_t*)c;
|
||||
/* clang-format off */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue