reformat code and job array

This commit is contained in:
Rongsong Shen 2025-11-07 16:14:27 +08:00
parent a665ccd4fe
commit 9ff857db9f
64 changed files with 1497 additions and 2476 deletions

View file

@ -7,10 +7,7 @@
#include "xce/types.h"
#include "xlist.h"
int add_to_xlist(xlist_t* l, void* data)
{
return xlist_store(l, data);
}
int add_to_xlist(xlist_t* l, void* data) { return xlist_store(l, data); }
int add_worker_to_xlist(xlist_t* l, void* data)
{
@ -43,17 +40,14 @@ int get_ep_role(endpoint_t* ep)
priv = (ep_private_t*)ep->data;
if (priv == NULL) {
ERROR("priv data of endpoint %p is NULL",
ep);
ERROR("priv data of endpoint %p is NULL", ep);
return -EINVAL;
}
return priv->role;
}
worker_t* get_ep_worker(cluster_t* c,
endpoint_t* ep,
int op)
worker_t* get_ep_worker(cluster_t* c, endpoint_t* ep, int op)
{
int role, idx;
worker_t* w = NULL;
@ -78,10 +72,8 @@ worker_t* get_ep_worker(cluster_t* c,
return w;
}
int update_host_runusage(xce_job_runusage_t** runusage,
char* host,
int count,
xce_rusage_t** usages)
int update_host_runusage(xce_job_runusage_t** runusage, char* host, int count,
xce_rusage_t** usages)
{
xce_job_runusage_t* rusages = NULL;
int i, j;
@ -105,8 +97,8 @@ int update_host_runusage(xce_job_runusage_t** runusage,
if (j < 0) {
int cnt = rusages->num_hosts + 1;
xce_host_runusage_t** hru = (xce_host_runusage_t**)realloc(rusages->host_runusage,
cnt * sizeof(xce_host_runusage_t*));
xce_host_runusage_t** hru = (xce_host_runusage_t**)realloc(
rusages->host_runusage, cnt * sizeof(xce_host_runusage_t*));
if (hru == NULL) {
return -ENOMEM;
}
@ -138,9 +130,7 @@ int update_host_runusage(xce_job_runusage_t** runusage,
return 0;
}
int update_pids(job_pidinfo_t** pidinfo,
int npids,
int* pids)
int update_pids(job_pidinfo_t** pidinfo, int npids, int* pids)
{
job_pidinfo_t* info;
int i;
@ -158,8 +148,7 @@ int update_pids(job_pidinfo_t** pidinfo,
info->pids = (unsigned int*)calloc(npids, sizeof(unsigned int));
} else if (info->npids < npids) {
unsigned int* ptr;
ptr = (unsigned int*)realloc(info->pids,
npids * sizeof(unsigned int));
ptr = (unsigned int*)realloc(info->pids, npids * sizeof(unsigned int));
if (ptr == NULL) {
return -ENOMEM;
}
@ -176,9 +165,7 @@ int update_pids(job_pidinfo_t** pidinfo,
return 0;
}
int update_pgids(job_pidinfo_t** pidinfo,
int npgids,
int* pgids)
int update_pgids(job_pidinfo_t** pidinfo, int npgids, int* pgids)
{
job_pidinfo_t* info;
int i;