reformat code and job array
This commit is contained in:
parent
a665ccd4fe
commit
9ff857db9f
64 changed files with 1497 additions and 2476 deletions
|
|
@ -8,15 +8,12 @@
|
|||
#include "xce/cluster_def.h"
|
||||
#include "xce/errnox.h"
|
||||
|
||||
static int validate_host(cluster_t* c,
|
||||
const char* host,
|
||||
const char* key)
|
||||
static int validate_host(cluster_t* c, const char* host, const char* key)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int handle_client_join(cluster_t* c,
|
||||
endpoint_t* ep,
|
||||
static int handle_client_join(cluster_t* c, endpoint_t* ep,
|
||||
xce_request_t* request)
|
||||
{
|
||||
xce_reply_t reply;
|
||||
|
|
@ -31,8 +28,7 @@ static int handle_client_join(cluster_t* c,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int handle_worker_join(cluster_t* c,
|
||||
endpoint_t* ep,
|
||||
static int handle_worker_join(cluster_t* c, endpoint_t* ep,
|
||||
xce_request_t* request)
|
||||
{
|
||||
int idx;
|
||||
|
|
@ -42,14 +38,12 @@ static int handle_worker_join(cluster_t* c,
|
|||
int rc = 0;
|
||||
xce_joindata_t* joinmsg = NULL;
|
||||
|
||||
TRACE("%s worker %s joining...",
|
||||
__func__, from->name);
|
||||
TRACE("%s worker %s joining...", __func__, from->name);
|
||||
|
||||
init_reply_by_req(&reply, request);
|
||||
|
||||
if (!validate_host(c, from->name, from->key)) {
|
||||
ERROR("%s reject join of host %s",
|
||||
__func__, from->name);
|
||||
ERROR("%s reject join of host %s", __func__, from->name);
|
||||
rc = -EPERM;
|
||||
|
||||
reply.status = rc;
|
||||
|
|
@ -61,25 +55,18 @@ static int handle_worker_join(cluster_t* c,
|
|||
|
||||
joinmsg = request->body.joinmsg;
|
||||
|
||||
xce_run_hooks(&(c->hooksys),
|
||||
XCE_CONTROLLER_HOOK_WORKER,
|
||||
HOOK_BEFORE_EVENT,
|
||||
HOOK_DETAIL_WORKER_JOIN,
|
||||
c, from->name, 0);
|
||||
xce_run_hooks(&(c->hooksys), XCE_CONTROLLER_HOOK_WORKER, HOOK_BEFORE_EVENT,
|
||||
HOOK_DETAIL_WORKER_JOIN, c, from->name, 0);
|
||||
idx = add_worker(c, ep, from->name, joinmsg->data.attrs);
|
||||
|
||||
reply.status = idx;
|
||||
reply.data_which = RequestReply_data_nodata;
|
||||
xce_reply(ep, c->myhost, &reply);
|
||||
|
||||
xce_run_hooks(&(c->hooksys),
|
||||
XCE_CONTROLLER_HOOK_WORKER,
|
||||
HOOK_AFTER_EVENT,
|
||||
HOOK_DETAIL_WORKER_JOIN,
|
||||
c, from->name, idx);
|
||||
xce_run_hooks(&(c->hooksys), XCE_CONTROLLER_HOOK_WORKER, HOOK_AFTER_EVENT,
|
||||
HOOK_DETAIL_WORKER_JOIN, c, from->name, idx);
|
||||
if (idx < 0) {
|
||||
ERROR("worker %s join failed, rc %d",
|
||||
from->name, idx);
|
||||
ERROR("worker %s join failed, rc %d", from->name, idx);
|
||||
|
||||
return idx;
|
||||
}
|
||||
|
|
@ -90,15 +77,13 @@ static int handle_worker_join(cluster_t* c,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int handle_scheduler_join(cluster_t* c,
|
||||
endpoint_t* ep,
|
||||
static int handle_scheduler_join(cluster_t* c, endpoint_t* ep,
|
||||
xce_request_t* request)
|
||||
{
|
||||
xce_reply_t reply;
|
||||
ep_private_t* priv = (ep_private_t*)ep->data;
|
||||
|
||||
TRACE("%s scheduler join, ep %p",
|
||||
__func__, ep);
|
||||
TRACE("%s scheduler join, ep %p", __func__, ep);
|
||||
|
||||
init_reply_by_req(&reply, request);
|
||||
|
||||
|
|
@ -114,8 +99,7 @@ static int handle_scheduler_join(cluster_t* c,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int handle_controller_join(cluster_t* c,
|
||||
endpoint_t* ep,
|
||||
static int handle_controller_join(cluster_t* c, endpoint_t* ep,
|
||||
xce_request_t* request)
|
||||
{
|
||||
xce_reply_t reply;
|
||||
|
|
@ -132,9 +116,7 @@ static int handle_controller_join(cluster_t* c,
|
|||
return rc;
|
||||
}
|
||||
|
||||
static int handle_join_(cluster_t* c,
|
||||
endpoint_t* ep,
|
||||
xce_request_t* request)
|
||||
static int handle_join_(cluster_t* c, endpoint_t* ep, xce_request_t* request)
|
||||
{
|
||||
ep_private_t* priv;
|
||||
int rc = -EINVAL;
|
||||
|
|
@ -160,8 +142,7 @@ static int handle_join_(cluster_t* c,
|
|||
role = request->body.joinmsg->role;
|
||||
priv->role = role;
|
||||
|
||||
TRACE("%s role %d join from %s",
|
||||
__func__, role, from->name);
|
||||
TRACE("%s role %d join from %s", __func__, role, from->name);
|
||||
|
||||
switch (role) {
|
||||
case HostRole_client:
|
||||
|
|
@ -178,8 +159,7 @@ static int handle_join_(cluster_t* c,
|
|||
break;
|
||||
default:
|
||||
rc = -E_XCE_BAD_ROLE;
|
||||
ERROR("unknown role %d from host %s",
|
||||
role, from->name);
|
||||
ERROR("unknown role %d from host %s", role, from->name);
|
||||
|
||||
reply.status = rc;
|
||||
reply.data_which = RequestReply_data_nodata;
|
||||
|
|
@ -190,9 +170,7 @@ static int handle_join_(cluster_t* c,
|
|||
return rc;
|
||||
}
|
||||
|
||||
int handle_join(cluster_t* c,
|
||||
endpoint_t* ep,
|
||||
xce_request_t* request)
|
||||
int handle_join(cluster_t* c, endpoint_t* ep, xce_request_t* request)
|
||||
{
|
||||
int rc = 0;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue