forked from lei.chen/myxce
support limit
This commit is contained in:
parent
bef32ace38
commit
ecf1916d78
33 changed files with 3036 additions and 243 deletions
|
|
@ -28,14 +28,6 @@ typedef struct {
|
|||
int port;
|
||||
} master_candidate_t;
|
||||
|
||||
typedef struct {
|
||||
char* name;
|
||||
char* prov_type;
|
||||
char* conf_path;
|
||||
char* script_path;
|
||||
char* script_option;
|
||||
} scaler_config_t;
|
||||
|
||||
typedef struct {
|
||||
char* clustername;
|
||||
int port;
|
||||
|
|
@ -51,9 +43,9 @@ typedef struct {
|
|||
int nqueues;
|
||||
xce_queue_t** queues;
|
||||
int nugroups;
|
||||
xce_group_t** ugroups;
|
||||
xce_group_config_t** ugroups;
|
||||
int nhgroups;
|
||||
xce_group_t** hgroups;
|
||||
xce_group_config_t** hgroups;
|
||||
int nhconfigs;
|
||||
xce_hostconfig_t** hconfigs;
|
||||
jobmgr_config_t* jobmgr;
|
||||
|
|
@ -63,6 +55,8 @@ typedef struct {
|
|||
xstrings_config_t* xstrings;
|
||||
int nhproviders;
|
||||
scaler_config_t** hproviders;
|
||||
int nlimits;
|
||||
xce_limit_config_t** limits;
|
||||
} cluster_config_t;
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ typedef uint64_t jobid_t;
|
|||
#define BUG_EMAIL "rshen@shenrs.eu"
|
||||
#define DEFAULT_WORKDIR "/tmp/xce"
|
||||
|
||||
#define XCE_MAXNAME_LEN (64)
|
||||
#define XCE_MAXNAME_LEN (256)
|
||||
#define XCE_MAXHOSTNAME_LEN (256) /* hostname suggest to 256 */
|
||||
#define XCE_MAXDESC_LEN (4096) /* enlarge to 4096 */
|
||||
#define XCE_MAXKEY_LEN (256)
|
||||
|
|
|
|||
26
src/include/group.h
Normal file
26
src/include/group.h
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
#if !defined(_GROUP_H_)
|
||||
|
||||
#define _GROUP_H_ 1
|
||||
|
||||
#include "kvmgr.h"
|
||||
#include "xce/types.h"
|
||||
#include "xlist.h"
|
||||
#include "zarray.h"
|
||||
|
||||
typedef struct {
|
||||
kvmgr_t groups;
|
||||
} groupmgr_t;
|
||||
|
||||
extern int groupmgr_init(groupmgr_t*, int, int);
|
||||
extern void groupmgr_fini(groupmgr_t*);
|
||||
extern int groupmgr_add(groupmgr_t*, xce_group_t*);
|
||||
extern xce_group_t* groupmgr_lock(groupmgr_t*, char*, int);
|
||||
extern void groupmgr_del(groupmgr_t*, xce_group_t*);
|
||||
extern int groupmgr_iter(groupmgr_t*, xlist_t*, void*);
|
||||
extern xce_group_t* build_group(groupmgr_t*, xce_group_config_t*, char*);
|
||||
extern int is_in_group(xce_group_t*, char*);
|
||||
extern xce_group_t* get_group(groupmgr_t*, char*);
|
||||
extern int fmt_group(char*, int, xce_group_t*);
|
||||
extern int is_group_all(xce_group_t*);
|
||||
|
||||
#endif
|
||||
|
|
@ -42,11 +42,15 @@ typedef struct {
|
|||
int n_queues;
|
||||
xce_queue_t** queues;
|
||||
int n_ugroups;
|
||||
xce_group_t** ugroups;
|
||||
xce_group_config_t** ugroups;
|
||||
int n_hgroups;
|
||||
xce_group_t** hgroups;
|
||||
xce_group_config_t** hgroups;
|
||||
int nresvals;
|
||||
xce_val_with_idx_t** resvals;
|
||||
int nlimits;
|
||||
xce_limit_config_t** limits;
|
||||
int nhproviders;
|
||||
scaler_config_t** hproviders;
|
||||
} xce_conf4sched_t;
|
||||
|
||||
typedef struct {
|
||||
|
|
|
|||
|
|
@ -81,6 +81,7 @@ typedef struct {
|
|||
#define XCE_RESF_RELEASE (0x20)
|
||||
#define XCE_RESF_DEFAULT_HOST (0x40)
|
||||
#define XCE_RESF_CONSUMABLE (0x80)
|
||||
#define XCE_RESF_LIMIT (0x100)
|
||||
|
||||
typedef struct {
|
||||
int count;
|
||||
|
|
@ -111,12 +112,12 @@ typedef struct {
|
|||
char* name;
|
||||
xce_strlist_t members;
|
||||
xce_strlist_t ex_members;
|
||||
} xce_group_t;
|
||||
} xce_group_config_t;
|
||||
|
||||
typedef struct {
|
||||
int count;
|
||||
xce_group_t** groups;
|
||||
} xce_grouplist_t;
|
||||
int count;
|
||||
xce_group_config_t** groups;
|
||||
} xce_group_configlist_t;
|
||||
|
||||
typedef struct {
|
||||
xce_val_t* value;
|
||||
|
|
@ -501,8 +502,8 @@ typedef struct {
|
|||
int32_t accept_interval;
|
||||
int32_t sched_delay;
|
||||
char* resreq;
|
||||
xce_group_t* users;
|
||||
xce_group_t* hosts;
|
||||
xce_group_config_t* users;
|
||||
xce_group_config_t* hosts;
|
||||
int32_t nthresholds;
|
||||
xce_res_threshold_t** thresholds;
|
||||
xce_timewindow_t* runwindow;
|
||||
|
|
@ -525,13 +526,13 @@ typedef struct {
|
|||
} xce_queuelist_t;
|
||||
|
||||
typedef struct {
|
||||
char* name;
|
||||
xce_reslist_t reslist;
|
||||
xce_queuelist_t qlist;
|
||||
xce_workerlist_t wlist;
|
||||
xce_grouplist_t uglist;
|
||||
xce_grouplist_t hglist;
|
||||
xce_configlist_t cfglist;
|
||||
char* name;
|
||||
xce_reslist_t reslist;
|
||||
xce_queuelist_t qlist;
|
||||
xce_workerlist_t wlist;
|
||||
xce_group_configlist_t uglist;
|
||||
xce_group_configlist_t hglist;
|
||||
xce_configlist_t cfglist;
|
||||
} xce_clusterconf_t;
|
||||
|
||||
typedef enum {
|
||||
|
|
@ -695,4 +696,76 @@ typedef struct {
|
|||
xce_pendreason_t** reasons;
|
||||
} xce_preason_set_t;
|
||||
|
||||
typedef struct {
|
||||
char* name;
|
||||
char* prov_type;
|
||||
char* conf_path;
|
||||
char* script_path;
|
||||
char* script_option;
|
||||
} scaler_config_t;
|
||||
|
||||
typedef struct xce_group_ xce_group_t;
|
||||
typedef struct xce_g_member_ xce_g_member_t;
|
||||
|
||||
struct xce_g_member_ {
|
||||
unsigned int is_group : 1;
|
||||
union {
|
||||
char* name;
|
||||
xce_group_t* g;
|
||||
} u;
|
||||
};
|
||||
|
||||
struct xce_group_ {
|
||||
char* name;
|
||||
unsigned int dirty : 1;
|
||||
xlist_t affecteds; /* groups affected by this group */
|
||||
xlist_t members;
|
||||
xlist_t ex_members;
|
||||
};
|
||||
|
||||
typedef enum {
|
||||
CONSUMER_USER = 0,
|
||||
CONSUMER_QUEUE,
|
||||
CONSUMER_PROJECT,
|
||||
CONSUMER_HOST,
|
||||
CONSUMER_MAX /* keep this the last */
|
||||
} xce_consumer_type_t;
|
||||
|
||||
typedef struct {
|
||||
xce_consumer_type_t ctype;
|
||||
unsigned int per_consumer : 1;
|
||||
xce_group_t* group;
|
||||
} xce_consumer_t;
|
||||
|
||||
typedef struct {
|
||||
char* resname;
|
||||
unsigned int percent : 1;
|
||||
float val;
|
||||
} xce_limit_val_t;
|
||||
|
||||
typedef struct {
|
||||
char* name;
|
||||
unsigned int per_user : 1;
|
||||
unsigned int per_queue : 1;
|
||||
unsigned int per_project : 1;
|
||||
unsigned int per_host : 1;
|
||||
xce_group_config_t* users;
|
||||
xce_group_config_t* queues;
|
||||
xce_group_config_t* projects;
|
||||
xce_group_config_t* hosts;
|
||||
xce_limit_val_t* val;
|
||||
} xce_limit_config_t;
|
||||
|
||||
typedef struct {
|
||||
char* name;
|
||||
xce_consumer_t* consumers[CONSUMER_MAX];
|
||||
xce_limit_val_t val;
|
||||
} xce_limit_t;
|
||||
|
||||
typedef struct {
|
||||
xce_resource_t* vres;
|
||||
xce_resource_t* res;
|
||||
xce_limit_t* limit;
|
||||
} xce_vres_t;
|
||||
|
||||
#endif
|
||||
|
|
|
|||
29
src/include/xcelimit.h
Normal file
29
src/include/xcelimit.h
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
#if !defined(_XCELIMIT_H_)
|
||||
|
||||
#define _XCELIMIT_H_ 1
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "group.h"
|
||||
#include "kvmgr.h"
|
||||
#include "xce/types.h"
|
||||
|
||||
extern int build_consumer(xce_consumer_t**, groupmgr_t*, xce_consumer_type_t,
|
||||
int, xce_group_config_t*, char*);
|
||||
extern void kill_consumer(xce_consumer_t*);
|
||||
extern int build_limit(xce_limit_t**, groupmgr_t*, groupmgr_t*, groupmgr_t*,
|
||||
groupmgr_t*, xce_limit_config_t*);
|
||||
extern int match_limit(xce_limit_t*, int, ...);
|
||||
extern int build_vres_name(char**, xce_limit_t*, char*, char*, char*);
|
||||
extern int is_host_based_limit(resmgr_t*, xce_limit_t*);
|
||||
extern int fmt_consumer(char*, int, xce_consumer_t*);
|
||||
extern int fmt_limit(char*, int, xce_limit_t*);
|
||||
extern void kill_limit(xce_limit_t*);
|
||||
extern int instantiate_limit(xce_vres_t**, resmgr_t*, xce_limit_t*, char*,
|
||||
char*, char*);
|
||||
extern void kill_vres(xce_vres_t*);
|
||||
extern int add_vres(xce_resource_t**, resmgr_t*, char*, int);
|
||||
|
||||
#endif
|
||||
|
|
@ -18,6 +18,8 @@ typedef int (*xlist_action_fn_t)(xlist_t*, void*);
|
|||
|
||||
extern int xlist_init(xlist_t*, int);
|
||||
extern int xlist_store(xlist_t*, void*);
|
||||
extern void* xlist_get(xlist_t*, int);
|
||||
extern int xlist_del(xlist_t*, void*);
|
||||
extern void xlist_clear(xlist_t*);
|
||||
extern int xlist_iter(xlist_t*, xlist_iter_fn_t, void*);
|
||||
extern void* xlist_find(xlist_t*, xlist_find_fn_t, ...);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue