mirror of https://github.com/BOINC/boinc.git
parent
58f9876db7
commit
85295ea998
|
@ -2446,3 +2446,11 @@ David Nov 30 2002
|
|||
Makefile.in
|
||||
client_state.C,h
|
||||
cs_scheduler.C
|
||||
|
||||
David Nov 30 200
|
||||
- first part of work sequence implementation
|
||||
|
||||
db/
|
||||
schema.sql
|
||||
db.h
|
||||
db_mysql.C
|
||||
|
|
20
db/db.h
20
db/db.h
|
@ -211,8 +211,9 @@ struct WORKUNIT {
|
|||
int canonical_resultid; // ID of canonical result, or zero
|
||||
double canonical_credit; // credit that all correct results get
|
||||
double retry_check_time; // when to check for result retry
|
||||
int state; // see values above
|
||||
int delay_bound; // determines result deadline, retry check time
|
||||
int state; // see values above
|
||||
int workseq_next; // if part of a sequence, the next WU
|
||||
|
||||
// the following not used in the DB
|
||||
char app_name[256];
|
||||
|
@ -224,6 +225,8 @@ struct WORKUNIT {
|
|||
#define RESULT_STATE_DONE 4
|
||||
#define RESULT_STATE_TIMEOUT 5
|
||||
#define RESULT_STATE_ERROR 6
|
||||
#define RESULT_STATE_UNSENT_SEQ 7
|
||||
// unsent, part of a work sequence
|
||||
|
||||
#define VALIDATE_STATE_INITIAL 0
|
||||
#define VALIDATE_STATE_NEED_CHECK 1
|
||||
|
@ -256,6 +259,20 @@ struct RESULT {
|
|||
int parse_from_client(FILE*);
|
||||
};
|
||||
|
||||
#define WORKSEQ_STATE_UNASSIGNED 0
|
||||
#define WORKSEQ_STATE_ASSIGNED 1
|
||||
#define WORKSEQ_STATE_DONE 2
|
||||
|
||||
struct WORKSEQ {
|
||||
int id;
|
||||
unsigned int create_time;
|
||||
int state;
|
||||
int hostid; // host this seq is assigned to
|
||||
int wuid_last_done; // last validated WU or zero
|
||||
int wuid_last_sent; // last sent WU or zero
|
||||
int workseqid_master; // if part of a redundant group, master ID
|
||||
};
|
||||
|
||||
extern int db_open(char* dbname, char* passwd);
|
||||
extern int db_close();
|
||||
extern void db_print_error(char*);
|
||||
|
@ -312,4 +329,5 @@ extern int db_result_enum_state(RESULT&, int);
|
|||
extern int db_result_enum_wuid(RESULT&);
|
||||
extern int db_result_count_state(int state, int&);
|
||||
|
||||
extern int db_workseq_new(WORKSEQ& p);
|
||||
#endif
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
#define TYPE_HOST 7
|
||||
#define TYPE_WORKUNIT 8
|
||||
#define TYPE_RESULT 9
|
||||
#define TYPE_WORKSEQ 10
|
||||
|
||||
char* table_name[] = {
|
||||
"",
|
||||
|
@ -46,6 +47,7 @@ char* table_name[] = {
|
|||
"host",
|
||||
"workunit",
|
||||
"result",
|
||||
"workseq",
|
||||
};
|
||||
|
||||
void struct_to_str(void* vp, char* q, int type) {
|
||||
|
@ -58,8 +60,8 @@ void struct_to_str(void* vp, char* q, int type) {
|
|||
HOST* hp;
|
||||
WORKUNIT* wup;
|
||||
RESULT* rp;
|
||||
assert(vp!=NULL);
|
||||
assert(q!=NULL);
|
||||
WORKSEQ* wsp;
|
||||
|
||||
switch(type) {
|
||||
case TYPE_PROJECT:
|
||||
prp = (PROJECT*)vp;
|
||||
|
@ -195,13 +197,15 @@ void struct_to_str(void* vp, char* q, int type) {
|
|||
"rsc_fpops=%f, rsc_iops=%f, rsc_memory=%f, rsc_disk=%f, "
|
||||
"need_validate=%d, "
|
||||
"canonical_resultid=%d, canonical_credit=%f, "
|
||||
"retry_check_time=%f, delay_bound=%d, state=%d",
|
||||
"retry_check_time=%f, delay_bound=%d, state=%d, "
|
||||
"workseq_next=%d",
|
||||
wup->id, wup->create_time, wup->appid,
|
||||
wup->name, wup->xml_doc, wup->batch,
|
||||
wup->rsc_fpops, wup->rsc_iops, wup->rsc_memory, wup->rsc_disk,
|
||||
wup->need_validate,
|
||||
wup->canonical_resultid, wup->canonical_credit,
|
||||
wup->retry_check_time, wup->delay_bound, wup->state
|
||||
wup->retry_check_time, wup->delay_bound, wup->state,
|
||||
wup->workseq_next
|
||||
);
|
||||
break;
|
||||
case TYPE_RESULT:
|
||||
|
@ -221,6 +225,19 @@ void struct_to_str(void* vp, char* q, int type) {
|
|||
rp->claimed_credit, rp->granted_credit
|
||||
);
|
||||
break;
|
||||
case TYPE_WORKSEQ:
|
||||
wsp = (WORKSEQ*)vp;
|
||||
sprintf(q,
|
||||
"id=%d, create_time=%d, "
|
||||
"state=%d, hostid=%d, "
|
||||
"wuid_last_done=%d, wuid_last_sent=%d, "
|
||||
"workseqid_master=%d",
|
||||
wsp->id, wsp->create_time,
|
||||
wsp->state, wsp->hostid,
|
||||
wsp->wuid_last_done, wsp->wuid_last_sent,
|
||||
wsp->workseqid_master
|
||||
);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -239,9 +256,9 @@ void row_to_struct(MYSQL_ROW& r, void* vp, int type) {
|
|||
HOST* hp;
|
||||
WORKUNIT* wup;
|
||||
RESULT* rp;
|
||||
|
||||
WORKSEQ* wsp;
|
||||
int i=0;
|
||||
assert(vp!=NULL);
|
||||
|
||||
switch(type) {
|
||||
case TYPE_PROJECT:
|
||||
prp = (PROJECT*)vp;
|
||||
|
@ -363,6 +380,7 @@ void row_to_struct(MYSQL_ROW& r, void* vp, int type) {
|
|||
wup->retry_check_time = atof(r[i++]);
|
||||
wup->delay_bound = atoi(r[i++]);
|
||||
wup->state = atoi(r[i++]);
|
||||
wup->workseq_next = atoi(r[i++]);
|
||||
break;
|
||||
case TYPE_RESULT:
|
||||
rp = (RESULT*)vp;
|
||||
|
@ -387,6 +405,16 @@ void row_to_struct(MYSQL_ROW& r, void* vp, int type) {
|
|||
rp->claimed_credit = atof(r[i++]);
|
||||
rp->granted_credit = atof(r[i++]);
|
||||
break;
|
||||
case TYPE_WORKSEQ:
|
||||
wsp = (WORKSEQ*)vp;
|
||||
memset(wsp, 0, sizeof(WORKSEQ));
|
||||
wsp->id = atoi(r[i++]);
|
||||
wsp->create_time = atoi(r[i++]);
|
||||
wsp->state = atoi(r[i++]);
|
||||
wsp->hostid = atoi(r[i++]);
|
||||
wsp->wuid_last_done = atoi(r[i++]);
|
||||
wsp->wuid_last_sent = atoi(r[i++]);
|
||||
wsp->workseqid_master = atoi(r[i++]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -634,3 +662,9 @@ int db_result_count_state(int state, int& n) {
|
|||
sprintf(buf, " where state=%d", state);
|
||||
return db_count(&n, "*", TYPE_RESULT, buf);
|
||||
}
|
||||
|
||||
/////////// WORKSEQ ///////////////
|
||||
|
||||
int db_workseq_new(WORKSEQ& p) {
|
||||
return db_new(&p, TYPE_WORKSEQ);
|
||||
}
|
||||
|
|
|
@ -131,6 +131,7 @@ create table workunit (
|
|||
retry_check_time double not null,
|
||||
delay_bound integer not null,
|
||||
state integer not null,
|
||||
workseq_next integer not null,
|
||||
primary key (id)
|
||||
);
|
||||
|
||||
|
@ -156,3 +157,14 @@ create table result (
|
|||
granted_credit double not null,
|
||||
primary key (id)
|
||||
);
|
||||
|
||||
create table workseq (
|
||||
id integer not null auto_increment,
|
||||
create_time integer not null,
|
||||
state integer not null,
|
||||
hostid integer not null,
|
||||
wuid_last_done integer not null,
|
||||
wuid_last_sent integer not null,
|
||||
workseqid_master integer not null,
|
||||
|
||||
);
|
||||
|
|
Loading…
Reference in New Issue