- use librtti
- Fix issue to xce_get() api cause client side crash - add parse resreq section - add rusage parser - parse resreq with basic support alternative & compound, still miss select
This commit is contained in:
parent
e7dc09c604
commit
cd4f3953b2
20 changed files with 1422 additions and 15 deletions
128
src/include/resreq.h
Normal file
128
src/include/resreq.h
Normal file
|
|
@ -0,0 +1,128 @@
|
|||
#if !defined(_RESREQ_H_)
|
||||
|
||||
#define _RESREQ_H_ 1
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "xlist.h"
|
||||
|
||||
typedef struct xce_resreq_select_ xce_select_t;
|
||||
typedef struct xce_resreq_rusages_ xce_rusages_t;
|
||||
typedef struct xce_resreq_span_ xce_span_t;
|
||||
typedef struct xce_resreq_same_ xce_same_t;
|
||||
typedef struct xce_resreq_affinity_ xce_affinity_t;
|
||||
typedef struct xce_resreq_data_ xce_resreq_data_t;
|
||||
|
||||
struct xce_resreq_data_ {
|
||||
char* selectString;
|
||||
char* rusageString;
|
||||
char* spanString;
|
||||
char* sameString;
|
||||
char* affinityString;
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
const char* input;
|
||||
int pos;
|
||||
char* errmsg;
|
||||
int err_pos;
|
||||
int has_error;
|
||||
xce_resreq_data_t data;
|
||||
} section_context_t;
|
||||
|
||||
typedef enum {
|
||||
PER_TASK = 0,
|
||||
PER_JOB,
|
||||
PER_HOST
|
||||
} rusage_per_type_t;
|
||||
|
||||
typedef struct {
|
||||
const char* input;
|
||||
int pos;
|
||||
int err_pos;
|
||||
int has_error;
|
||||
xlist_t* rusages;
|
||||
char* resname;
|
||||
rusage_per_type_t per_flag;
|
||||
float resvalue;
|
||||
float duration_value;
|
||||
int decay_flag;
|
||||
float tmp_value;
|
||||
float duration_multiply;
|
||||
} rusage_context_t;
|
||||
|
||||
typedef struct {
|
||||
char* res;
|
||||
float value;
|
||||
rusage_per_type_t per_flag;
|
||||
float duration;
|
||||
int decay_flag;
|
||||
} rusage_value_t;
|
||||
|
||||
struct xce_resreq_select_ { };
|
||||
|
||||
struct xce_resreq_span_ { };
|
||||
|
||||
struct xce_resreq_same_ { };
|
||||
|
||||
struct xce_resreq_affinity_ { };
|
||||
|
||||
typedef struct {
|
||||
int minTasks;
|
||||
int maxTasks;
|
||||
xce_select_t* select;
|
||||
xlist_t rusages;
|
||||
xce_span_t* span;
|
||||
xce_same_t* same;
|
||||
xce_affinity_t* affinity;
|
||||
} xce_primary_resreq_t;
|
||||
|
||||
typedef struct {
|
||||
xlist_t primaries;
|
||||
} xce_compound_resreq_t;
|
||||
|
||||
typedef struct {
|
||||
xlist_t compounds;
|
||||
} xce_alter_resreq_t;
|
||||
|
||||
typedef enum {
|
||||
XCE_RESREQ_PRIMARY = 0,
|
||||
XCE_RESREQ_COMPOUND,
|
||||
XCE_RESREQ_ALTER
|
||||
} xce_resreq_tag_t;
|
||||
|
||||
typedef struct {
|
||||
xce_resreq_tag_t tag;
|
||||
union {
|
||||
xce_primary_resreq_t* primary;
|
||||
xce_compound_resreq_t* compound;
|
||||
xce_alter_resreq_t* alter;
|
||||
} u;
|
||||
} xce_resreq_t;
|
||||
|
||||
typedef struct {
|
||||
const char* input;
|
||||
int pos;
|
||||
int err_pos;
|
||||
int has_error;
|
||||
char* errmsg;
|
||||
xce_resreq_t* resreq;
|
||||
xce_alter_resreq_t* alter;
|
||||
xce_compound_resreq_t* compound;
|
||||
xce_primary_resreq_t* primary;
|
||||
int resreq_fact_count;
|
||||
} resreq_context_t;
|
||||
|
||||
extern void kill_section_ctx(section_context_t*);
|
||||
extern void kill_resreq_data(xce_resreq_data_t*);
|
||||
extern int parse_section(xce_resreq_data_t*, char*, char**);
|
||||
extern int parse_rusage(xlist_t*, char*, char**);
|
||||
extern void kill_rusage_value(rusage_value_t*);
|
||||
extern int parse_resreq_primary(xce_primary_resreq_t*, char*, char**);
|
||||
extern int parse_resreq(xce_resreq_t*, char*, char**);
|
||||
extern void kill_resreq(xce_resreq_t*);
|
||||
extern int format_resreq(char**, xce_resreq_t*);
|
||||
|
||||
#endif
|
||||
Loading…
Add table
Add a link
Reference in a new issue