2008-08-06 18:36:30 +00:00
|
|
|
// This file is part of BOINC.
|
2005-01-20 23:22:22 +00:00
|
|
|
// http://boinc.berkeley.edu
|
2008-08-06 18:36:30 +00:00
|
|
|
// Copyright (C) 2008 University of California
|
2003-07-25 20:26:38 +00:00
|
|
|
//
|
2008-08-06 18:36:30 +00:00
|
|
|
// BOINC is free software; you can redistribute it and/or modify it
|
|
|
|
// under the terms of the GNU Lesser General Public License
|
|
|
|
// as published by the Free Software Foundation,
|
|
|
|
// either version 3 of the License, or (at your option) any later version.
|
2003-07-25 20:26:38 +00:00
|
|
|
//
|
2008-08-06 18:36:30 +00:00
|
|
|
// BOINC is distributed in the hope that it will be useful,
|
2005-01-20 23:22:22 +00:00
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
// See the GNU Lesser General Public License for more details.
|
2002-04-30 22:22:54 +00:00
|
|
|
//
|
2008-08-06 18:36:30 +00:00
|
|
|
// You should have received a copy of the GNU Lesser General Public License
|
|
|
|
// along with BOINC. If not, see <http://www.gnu.org/licenses/>.
|
2002-04-30 22:22:54 +00:00
|
|
|
|
2003-05-02 23:29:57 +00:00
|
|
|
#ifndef _BOINC_DB_
|
|
|
|
#define _BOINC_DB_
|
2002-04-30 22:22:54 +00:00
|
|
|
|
2002-09-26 05:57:10 +00:00
|
|
|
// Structures corresponding to database records.
|
|
|
|
// Some of these types have counterparts in client/types.h,
|
|
|
|
// but don't be deceived - client and server have different variants.
|
2002-04-30 22:22:54 +00:00
|
|
|
|
|
|
|
// The parse and write functions are for use in scheduler RPC.
|
|
|
|
// They don't necessarily serialize the entire records.
|
|
|
|
|
2004-07-13 13:54:09 +00:00
|
|
|
#include <cstdio>
|
2004-07-01 20:24:00 +00:00
|
|
|
#include <vector>
|
2010-04-21 20:11:41 +00:00
|
|
|
#include <string.h>
|
2002-04-30 22:22:54 +00:00
|
|
|
|
2003-08-31 01:21:31 +00:00
|
|
|
#include "db_base.h"
|
2012-04-10 00:32:35 +00:00
|
|
|
#include "boinc_db_types.h"
|
2003-08-31 01:21:31 +00:00
|
|
|
|
2003-09-05 21:26:21 +00:00
|
|
|
extern DB_CONN boinc_db;
|
|
|
|
|
2004-07-01 20:24:00 +00:00
|
|
|
struct TRANSITIONER_ITEM {
|
2015-07-23 17:11:08 +00:00
|
|
|
DB_ID_TYPE id; // WARNING: this is the WU ID
|
2004-07-01 18:43:36 +00:00
|
|
|
char name[256];
|
2015-07-23 17:11:08 +00:00
|
|
|
DB_ID_TYPE appid;
|
2004-12-06 22:41:19 +00:00
|
|
|
int min_quorum;
|
2004-07-01 18:43:36 +00:00
|
|
|
bool need_validate;
|
2015-07-23 17:11:08 +00:00
|
|
|
DB_ID_TYPE canonical_resultid;
|
2004-12-06 22:41:19 +00:00
|
|
|
int transition_time;
|
|
|
|
int delay_bound;
|
|
|
|
int error_mask;
|
|
|
|
int max_error_results;
|
|
|
|
int max_total_results;
|
|
|
|
int file_delete_state;
|
|
|
|
int assimilate_state;
|
|
|
|
int target_nresults;
|
2004-08-04 06:05:17 +00:00
|
|
|
char result_template_file[64];
|
2004-12-06 22:41:19 +00:00
|
|
|
int priority;
|
2007-05-29 23:41:31 +00:00
|
|
|
int hr_class;
|
2006-01-26 00:19:05 +00:00
|
|
|
int batch;
|
2015-07-23 17:11:08 +00:00
|
|
|
DB_ID_TYPE app_version_id;
|
2012-01-30 22:39:13 +00:00
|
|
|
int transitioner_flags;
|
2013-04-25 07:27:35 +00:00
|
|
|
int size_class;
|
2015-07-23 17:11:08 +00:00
|
|
|
DB_ID_TYPE res_id; // This is the RESULT ID
|
2004-07-02 17:53:31 +00:00
|
|
|
char res_name[256];
|
2004-12-06 22:41:19 +00:00
|
|
|
int res_report_deadline;
|
|
|
|
int res_server_state;
|
|
|
|
int res_outcome;
|
|
|
|
int res_validate_state;
|
|
|
|
int res_file_delete_state;
|
|
|
|
int res_sent_time;
|
2015-07-23 17:11:08 +00:00
|
|
|
DB_ID_TYPE res_hostid;
|
2007-04-05 17:02:01 +00:00
|
|
|
int res_received_time;
|
2015-07-23 17:11:08 +00:00
|
|
|
DB_ID_TYPE res_app_version_id;
|
2014-05-23 06:54:56 +00:00
|
|
|
int res_exit_status;
|
2004-12-16 21:58:10 +00:00
|
|
|
|
2004-07-01 18:43:36 +00:00
|
|
|
void clear();
|
2004-07-01 20:24:00 +00:00
|
|
|
void parse(MYSQL_ROW&);
|
2004-07-01 18:43:36 +00:00
|
|
|
};
|
|
|
|
|
2010-03-29 22:28:20 +00:00
|
|
|
struct DB_HOST_APP_VERSION : public DB_BASE, public HOST_APP_VERSION {
|
|
|
|
DB_HOST_APP_VERSION(DB_CONN* p=0);
|
|
|
|
void db_print(char*);
|
|
|
|
void db_parse(MYSQL_ROW &row);
|
- server: change the following from per-host to per-(host, app version):
- daily quota mechanism
- reliable mechanism (accelerated retries)
- "trusted" mechanism (adaptive replication)
- scheduler: enforce host scale probation only for apps with
host_scale_check set.
- validator: do scale probation on invalid results
(need this in addition to error and timeout cases)
- feeder: update app version scales every 10 min, not 10 sec
- back-end apps: support --foo as well as -foo for options
Notes:
- If you have, say, cuda, cuda23 and cuda_fermi plan classes,
a host will have separate quotas for each one.
That means it could error out on 100 jobs for cuda_fermi,
and when its quota goes to zero,
error out on 100 jobs for cuda23, etc.
This is intentional; there may be cases where one version
works but not the others.
- host.error_rate and host.max_results_day are deprecated
TODO:
- the values in the app table for limits on jobs in progress etc.
should override rather than config.xml.
Implementation notes:
scheduler:
process_request():
read all host_app_versions for host at start;
Compute "reliable" and "trusted" for each one.
write modified records at end
get_app_version():
add "reliable_only" arg; if set, use only reliable versions
skip over-quota versions
Multi-pass scheduling: if have at least one reliable version,
do a pass for jobs that need reliable,
and use only reliable versions.
Then clear best_app_versions cache.
Score-based scheduling: for need-reliable jobs,
it will pick the fastest version,
then give a score bonus if that version happens to be reliable.
When get back a successful result from client:
increase daily quota
When get back an error result from client:
impose scale probation
decrease daily quota if not aborted
Validator:
when handling a WU, create a vector of HOST_APP_VERSION
parallel to vector of RESULT.
Pass it to assign_credit_set().
Make copies of originals so we can update only modified ones
update HOST_APP_VERSION error rates
Transitioner:
decrease quota on timeout
svn path=/trunk/boinc/; revision=21181
2010-04-15 03:13:56 +00:00
|
|
|
int update_scheduler(DB_HOST_APP_VERSION&);
|
|
|
|
int update_validator(DB_HOST_APP_VERSION&);
|
2010-03-29 22:28:20 +00:00
|
|
|
};
|
|
|
|
|
2012-12-06 07:09:22 +00:00
|
|
|
struct DB_USER_SUBMIT : public DB_BASE, public USER_SUBMIT {
|
|
|
|
DB_USER_SUBMIT(DB_CONN* p=0);
|
|
|
|
void db_print(char*);
|
|
|
|
void db_parse(MYSQL_ROW &row);
|
|
|
|
};
|
|
|
|
|
2009-06-23 21:45:22 +00:00
|
|
|
struct STATE_COUNTS {
|
2015-07-23 17:11:08 +00:00
|
|
|
DB_ID_TYPE appid;
|
2009-06-23 21:45:22 +00:00
|
|
|
int last_update_time;
|
|
|
|
int result_server_state_2;
|
|
|
|
int result_server_state_4;
|
|
|
|
int result_file_delete_state_1;
|
|
|
|
int result_file_delete_state_2;
|
|
|
|
int result_server_state_5_and_file_delete_state_0;
|
|
|
|
int workunit_need_validate_1;
|
|
|
|
int workunit_assimilate_state_1;
|
|
|
|
int workunit_file_delete_state_1;
|
|
|
|
int workunit_file_delete_state_2;
|
|
|
|
|
|
|
|
void clear();
|
|
|
|
};
|
|
|
|
|
|
|
|
struct DB_STATE_COUNTS : public DB_BASE, public STATE_COUNTS {
|
|
|
|
DB_STATE_COUNTS(DB_CONN* p=0);
|
2015-08-13 21:05:53 +00:00
|
|
|
DB_ID_TYPE get_id();
|
2009-06-23 21:45:22 +00:00
|
|
|
void db_print(char *);
|
|
|
|
void db_parse(MYSQL_ROW &row);
|
|
|
|
};
|
|
|
|
|
2004-10-08 22:41:33 +00:00
|
|
|
struct VALIDATOR_ITEM {
|
2004-10-08 23:07:59 +00:00
|
|
|
WORKUNIT wu;
|
|
|
|
RESULT res;
|
2004-10-08 22:41:33 +00:00
|
|
|
|
2004-12-06 22:41:19 +00:00
|
|
|
void clear();
|
|
|
|
void parse(MYSQL_ROW&);
|
2004-10-08 22:41:33 +00:00
|
|
|
};
|
|
|
|
|
2003-06-04 17:21:26 +00:00
|
|
|
class DB_PLATFORM : public DB_BASE, public PLATFORM {
|
|
|
|
public:
|
2004-10-04 23:23:57 +00:00
|
|
|
DB_PLATFORM(DB_CONN* p=0);
|
2015-08-13 21:05:53 +00:00
|
|
|
DB_ID_TYPE get_id();
|
2003-06-04 17:21:26 +00:00
|
|
|
void db_print(char*);
|
|
|
|
void db_parse(MYSQL_ROW &row);
|
|
|
|
};
|
|
|
|
|
|
|
|
class DB_APP : public DB_BASE, public APP {
|
|
|
|
public:
|
2004-10-04 23:23:57 +00:00
|
|
|
DB_APP(DB_CONN* p=0);
|
2015-08-13 21:05:53 +00:00
|
|
|
DB_ID_TYPE get_id();
|
2003-06-04 17:21:26 +00:00
|
|
|
void db_print(char*);
|
|
|
|
void db_parse(MYSQL_ROW &row);
|
|
|
|
};
|
|
|
|
|
|
|
|
class DB_APP_VERSION : public DB_BASE, public APP_VERSION {
|
|
|
|
public:
|
2004-10-04 23:23:57 +00:00
|
|
|
DB_APP_VERSION(DB_CONN* p=0);
|
2015-08-13 21:05:53 +00:00
|
|
|
DB_ID_TYPE get_id();
|
2003-06-04 17:21:26 +00:00
|
|
|
void db_print(char*);
|
|
|
|
void db_parse(MYSQL_ROW &row);
|
2010-03-29 22:28:20 +00:00
|
|
|
void operator=(APP_VERSION& w) {APP_VERSION::operator=(w);}
|
2003-06-04 17:21:26 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class DB_USER : public DB_BASE, public USER {
|
|
|
|
public:
|
2004-10-04 23:23:57 +00:00
|
|
|
DB_USER(DB_CONN* p=0);
|
2015-08-13 21:05:53 +00:00
|
|
|
DB_ID_TYPE get_id();
|
2003-06-04 17:21:26 +00:00
|
|
|
void db_print(char*);
|
|
|
|
void db_parse(MYSQL_ROW &row);
|
|
|
|
void operator=(USER& r) {USER::operator=(r);}
|
|
|
|
};
|
|
|
|
|
|
|
|
class DB_TEAM : public DB_BASE, public TEAM {
|
|
|
|
public:
|
2004-10-04 23:23:57 +00:00
|
|
|
DB_TEAM(DB_CONN* p=0);
|
2015-08-13 21:05:53 +00:00
|
|
|
DB_ID_TYPE get_id();
|
2003-06-04 17:21:26 +00:00
|
|
|
void db_print(char*);
|
|
|
|
void db_parse(MYSQL_ROW &row);
|
|
|
|
};
|
|
|
|
|
|
|
|
class DB_HOST : public DB_BASE, public HOST {
|
|
|
|
public:
|
2004-10-04 23:23:57 +00:00
|
|
|
DB_HOST(DB_CONN* p=0);
|
2015-08-13 21:05:53 +00:00
|
|
|
DB_ID_TYPE get_id();
|
2010-03-29 22:28:20 +00:00
|
|
|
int update_diff_sched(HOST&);
|
|
|
|
int update_diff_validator(HOST&);
|
2011-09-13 21:01:42 +00:00
|
|
|
int fpops_percentile(double percentile, double& fpops);
|
|
|
|
// return the given percentile of p_fpops
|
2012-01-09 17:35:48 +00:00
|
|
|
int fpops_mean(double& mean);
|
|
|
|
int fpops_stddev(double& stddev);
|
2003-06-04 17:21:26 +00:00
|
|
|
void db_print(char*);
|
|
|
|
void db_parse(MYSQL_ROW &row);
|
|
|
|
void operator=(HOST& r) {HOST::operator=(r);}
|
|
|
|
};
|
|
|
|
|
|
|
|
class DB_RESULT : public DB_BASE, public RESULT {
|
|
|
|
public:
|
2004-10-04 23:23:57 +00:00
|
|
|
DB_RESULT(DB_CONN* p=0);
|
2015-08-13 21:05:53 +00:00
|
|
|
DB_ID_TYPE get_id();
|
2011-02-23 21:22:45 +00:00
|
|
|
int mark_as_sent(int old_server_state, int report_grace_period);
|
2003-06-04 17:21:26 +00:00
|
|
|
void db_print(char*);
|
2004-07-21 21:50:25 +00:00
|
|
|
void db_print_values(char*);
|
2003-06-04 17:21:26 +00:00
|
|
|
void db_parse(MYSQL_ROW &row);
|
|
|
|
void operator=(RESULT& r) {RESULT::operator=(r);}
|
2015-06-03 07:30:18 +00:00
|
|
|
int get_unsent_counts(APP&, int* unsent, int count_max);
|
2013-04-25 07:27:35 +00:00
|
|
|
int make_unsent(
|
|
|
|
APP&, int size_class, int n, const char* order_clause, int& nchanged
|
|
|
|
);
|
2003-06-04 17:21:26 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class DB_WORKUNIT : public DB_BASE, public WORKUNIT {
|
|
|
|
public:
|
2004-10-04 23:23:57 +00:00
|
|
|
DB_WORKUNIT(DB_CONN* p=0);
|
2015-08-13 21:05:53 +00:00
|
|
|
DB_ID_TYPE get_id();
|
2003-06-04 17:21:26 +00:00
|
|
|
void db_print(char*);
|
2014-04-11 06:53:19 +00:00
|
|
|
void db_print_values(char*);
|
2003-06-04 17:21:26 +00:00
|
|
|
void db_parse(MYSQL_ROW &row);
|
2003-09-21 21:00:25 +00:00
|
|
|
void operator=(WORKUNIT& w) {WORKUNIT::operator=(w);}
|
2003-06-04 17:21:26 +00:00
|
|
|
};
|
|
|
|
|
2007-05-02 23:17:52 +00:00
|
|
|
class DB_CREDITED_JOB : public DB_BASE, public CREDITED_JOB {
|
2007-05-02 18:51:51 +00:00
|
|
|
public:
|
2007-05-02 23:17:52 +00:00
|
|
|
DB_CREDITED_JOB(DB_CONN* p=0);
|
2007-05-02 18:51:51 +00:00
|
|
|
void db_print(char*);
|
|
|
|
void db_parse(MYSQL_ROW &row);
|
2007-05-02 23:17:52 +00:00
|
|
|
void operator=(CREDITED_JOB& wh) {CREDITED_JOB::operator=(wh);}
|
2007-05-02 18:51:51 +00:00
|
|
|
};
|
|
|
|
|
2004-06-22 22:56:50 +00:00
|
|
|
class DB_MSG_FROM_HOST : public DB_BASE, public MSG_FROM_HOST {
|
2004-03-17 01:26:44 +00:00
|
|
|
public:
|
2004-10-04 23:23:57 +00:00
|
|
|
DB_MSG_FROM_HOST(DB_CONN* p=0);
|
2015-08-13 21:05:53 +00:00
|
|
|
DB_ID_TYPE get_id();
|
2004-03-17 01:26:44 +00:00
|
|
|
void db_print(char*);
|
|
|
|
void db_parse(MYSQL_ROW &row);
|
|
|
|
};
|
|
|
|
|
2004-06-22 22:56:50 +00:00
|
|
|
class DB_MSG_TO_HOST : public DB_BASE, public MSG_TO_HOST {
|
2004-01-04 06:48:40 +00:00
|
|
|
public:
|
2004-10-04 23:23:57 +00:00
|
|
|
DB_MSG_TO_HOST(DB_CONN* p=0);
|
2015-08-13 21:05:53 +00:00
|
|
|
DB_ID_TYPE get_id();
|
2004-01-04 06:48:40 +00:00
|
|
|
void db_print(char*);
|
|
|
|
void db_parse(MYSQL_ROW &row);
|
|
|
|
};
|
|
|
|
|
2008-02-21 00:47:50 +00:00
|
|
|
class DB_ASSIGNMENT : public DB_BASE, public ASSIGNMENT {
|
|
|
|
public:
|
|
|
|
DB_ASSIGNMENT(DB_CONN* p=0);
|
2015-08-13 21:05:53 +00:00
|
|
|
DB_ID_TYPE get_id();
|
2008-02-21 00:47:50 +00:00
|
|
|
void db_print(char*);
|
|
|
|
void db_parse(MYSQL_ROW& row);
|
|
|
|
};
|
|
|
|
|
2004-07-01 20:24:00 +00:00
|
|
|
// The transitioner uses this to get (WU, result) pairs efficiently.
|
|
|
|
// Each call to enumerate() returns a list of the pairs for a single WU
|
|
|
|
//
|
|
|
|
class DB_TRANSITIONER_ITEM_SET : public DB_BASE_SPECIAL {
|
2004-07-01 18:43:36 +00:00
|
|
|
public:
|
2004-10-04 23:23:57 +00:00
|
|
|
DB_TRANSITIONER_ITEM_SET(DB_CONN* p=0);
|
2004-07-01 20:24:00 +00:00
|
|
|
TRANSITIONER_ITEM last_item;
|
2004-07-02 23:24:36 +00:00
|
|
|
int nitems_this_query;
|
2004-07-01 20:24:00 +00:00
|
|
|
|
|
|
|
int enumerate(
|
|
|
|
int transition_time,
|
|
|
|
int nresult_limit,
|
2005-08-11 23:53:24 +00:00
|
|
|
int wu_id_modulus,
|
|
|
|
int wu_id_remainder,
|
2004-07-01 20:24:00 +00:00
|
|
|
std::vector<TRANSITIONER_ITEM>& items
|
|
|
|
);
|
2004-07-02 19:45:33 +00:00
|
|
|
int update_result(TRANSITIONER_ITEM&);
|
2005-03-30 06:36:11 +00:00
|
|
|
int update_workunit(TRANSITIONER_ITEM&, TRANSITIONER_ITEM&);
|
2004-07-01 18:43:36 +00:00
|
|
|
};
|
|
|
|
|
2004-10-08 22:41:33 +00:00
|
|
|
// The validator uses this to get (WU, result) pairs efficiently.
|
|
|
|
// Each call to enumerate() returns a list of the pairs for a single WU
|
|
|
|
//
|
|
|
|
class DB_VALIDATOR_ITEM_SET : public DB_BASE_SPECIAL {
|
|
|
|
public:
|
|
|
|
DB_VALIDATOR_ITEM_SET(DB_CONN* p=0);
|
|
|
|
VALIDATOR_ITEM last_item;
|
|
|
|
int nitems_this_query;
|
|
|
|
|
|
|
|
int enumerate(
|
2015-07-23 17:11:08 +00:00
|
|
|
DB_ID_TYPE appid,
|
2004-10-08 22:41:33 +00:00
|
|
|
int nresult_limit,
|
2005-02-22 20:12:31 +00:00
|
|
|
int wu_id_modulus,
|
|
|
|
int wu_id_remainder,
|
2015-07-23 17:11:08 +00:00
|
|
|
DB_ID_TYPE wu_id_min,
|
|
|
|
DB_ID_TYPE wu_id_max,
|
2004-10-08 22:41:33 +00:00
|
|
|
std::vector<VALIDATOR_ITEM>& items
|
|
|
|
);
|
|
|
|
int update_result(RESULT&);
|
|
|
|
int update_workunit(WORKUNIT&);
|
|
|
|
};
|
|
|
|
|
2008-07-22 23:36:55 +00:00
|
|
|
|
2004-07-02 22:48:33 +00:00
|
|
|
// used by the feeder and scheduler for outgoing work
|
|
|
|
//
|
|
|
|
struct WORK_ITEM {
|
2015-07-23 17:11:08 +00:00
|
|
|
DB_ID_TYPE res_id;
|
2007-04-05 17:02:01 +00:00
|
|
|
int res_priority;
|
2009-08-31 19:35:46 +00:00
|
|
|
int res_server_state;
|
|
|
|
double res_report_deadline;
|
2004-07-03 16:57:28 +00:00
|
|
|
WORKUNIT wu;
|
2004-07-02 22:48:33 +00:00
|
|
|
void parse(MYSQL_ROW& row);
|
|
|
|
};
|
|
|
|
|
|
|
|
class DB_WORK_ITEM : public WORK_ITEM, public DB_BASE_SPECIAL {
|
2015-07-23 17:11:08 +00:00
|
|
|
DB_ID_TYPE start_id;
|
2007-06-22 23:48:37 +00:00
|
|
|
// when enumerate_all is used, keeps track of which ID to start from
|
2004-07-02 22:48:33 +00:00
|
|
|
public:
|
2004-10-04 23:23:57 +00:00
|
|
|
DB_WORK_ITEM(DB_CONN* p=0);
|
2005-09-22 00:15:43 +00:00
|
|
|
int enumerate(
|
2006-05-02 22:33:00 +00:00
|
|
|
int limit, const char* select_clause, const char* order_clause
|
2005-09-22 00:30:01 +00:00
|
|
|
);
|
2004-07-02 22:48:33 +00:00
|
|
|
// used by feeder
|
2007-06-22 23:48:37 +00:00
|
|
|
int enumerate_all(
|
|
|
|
int limit, const char* select_clause
|
|
|
|
);
|
|
|
|
// used by feeder when HR is used.
|
|
|
|
// Successive calls cycle through all results.
|
2004-07-02 22:48:33 +00:00
|
|
|
int read_result();
|
|
|
|
// used by scheduler to read result server state
|
|
|
|
int update();
|
|
|
|
// used by scheduler to update WU transition time
|
|
|
|
// and various result fields
|
|
|
|
};
|
|
|
|
|
2007-04-05 17:02:01 +00:00
|
|
|
// Used by the scheduler to send <result_abort> or <result_abort_if_not_started>
|
|
|
|
// messages if the result is no longer needed.
|
|
|
|
//
|
|
|
|
struct IN_PROGRESS_RESULT {
|
|
|
|
char result_name[256];
|
|
|
|
int assimilate_state;
|
|
|
|
int error_mask;
|
|
|
|
int server_state;
|
|
|
|
int outcome;
|
|
|
|
void parse(MYSQL_ROW& row);
|
|
|
|
};
|
|
|
|
|
|
|
|
class DB_IN_PROGRESS_RESULT : public IN_PROGRESS_RESULT, public DB_BASE_SPECIAL {
|
|
|
|
public:
|
|
|
|
DB_IN_PROGRESS_RESULT(DB_CONN* p=0);
|
2015-07-23 17:11:08 +00:00
|
|
|
int enumerate(DB_ID_TYPE hostid, const char* result_names);
|
2007-04-05 17:02:01 +00:00
|
|
|
};
|
|
|
|
|
2004-12-05 23:52:17 +00:00
|
|
|
// Used by the scheduler to handle results reported by clients
|
|
|
|
// The read and the update of these results are combined
|
|
|
|
// into single SQL queries.
|
|
|
|
|
2004-07-06 18:30:22 +00:00
|
|
|
struct SCHED_RESULT_ITEM {
|
2004-12-05 23:52:17 +00:00
|
|
|
char queried_name[256]; // name as reported by client
|
2015-07-23 17:11:08 +00:00
|
|
|
DB_ID_TYPE id;
|
2004-07-06 18:30:22 +00:00
|
|
|
char name[256];
|
2015-07-23 17:11:08 +00:00
|
|
|
DB_ID_TYPE workunitid;
|
|
|
|
DB_ID_TYPE appid;
|
2004-07-06 18:30:22 +00:00
|
|
|
int server_state;
|
2004-07-02 22:48:33 +00:00
|
|
|
int client_state;
|
2004-07-06 18:30:22 +00:00
|
|
|
int validate_state;
|
|
|
|
int outcome;
|
2015-07-23 17:11:08 +00:00
|
|
|
DB_ID_TYPE hostid;
|
|
|
|
DB_ID_TYPE userid;
|
|
|
|
DB_ID_TYPE teamid;
|
2005-06-26 19:34:17 +00:00
|
|
|
int sent_time;
|
2004-07-06 18:30:22 +00:00
|
|
|
int received_time;
|
|
|
|
double cpu_time;
|
2008-03-31 16:19:45 +00:00
|
|
|
char xml_doc_out[BLOB_SIZE];
|
|
|
|
char stderr_out[BLOB_SIZE];
|
2004-07-06 18:30:22 +00:00
|
|
|
int app_version_num;
|
|
|
|
int exit_status;
|
2006-06-03 16:22:34 +00:00
|
|
|
int file_delete_state;
|
2009-09-03 20:26:31 +00:00
|
|
|
double elapsed_time;
|
2015-07-23 17:11:08 +00:00
|
|
|
DB_ID_TYPE app_version_id;
|
2014-04-03 02:35:59 +00:00
|
|
|
double peak_working_set_size;
|
|
|
|
double peak_swap_size;
|
|
|
|
double peak_disk_usage;
|
2004-07-02 22:48:33 +00:00
|
|
|
|
2004-07-06 18:30:22 +00:00
|
|
|
void clear();
|
|
|
|
void parse(MYSQL_ROW& row);
|
2004-07-02 22:48:33 +00:00
|
|
|
};
|
|
|
|
|
2004-07-06 18:30:22 +00:00
|
|
|
class DB_SCHED_RESULT_ITEM_SET : public DB_BASE_SPECIAL {
|
|
|
|
public:
|
2004-10-04 23:23:57 +00:00
|
|
|
DB_SCHED_RESULT_ITEM_SET(DB_CONN* p=0);
|
2004-07-06 19:04:37 +00:00
|
|
|
std::vector<SCHED_RESULT_ITEM> results;
|
2004-07-06 18:30:22 +00:00
|
|
|
|
|
|
|
int add_result(char* result_name);
|
|
|
|
|
|
|
|
int enumerate();
|
2004-12-05 23:52:17 +00:00
|
|
|
// using a single SQL query, look up all the reported results,
|
|
|
|
// (based on queried_name)
|
|
|
|
// and fill in the rest of the entries in the results vector
|
2004-07-06 18:30:22 +00:00
|
|
|
|
2004-07-27 23:29:27 +00:00
|
|
|
int lookup_result(char* result_name, SCHED_RESULT_ITEM** result);
|
2004-07-06 18:30:22 +00:00
|
|
|
|
|
|
|
int update_result(SCHED_RESULT_ITEM& result);
|
2004-07-21 23:48:56 +00:00
|
|
|
int update_workunits();
|
2004-07-02 22:48:33 +00:00
|
|
|
};
|
|
|
|
|
2010-03-05 22:55:16 +00:00
|
|
|
struct FILE_ITEM {
|
2015-07-23 17:11:08 +00:00
|
|
|
DB_ID_TYPE id;
|
2010-03-05 22:55:16 +00:00
|
|
|
char name[254];
|
|
|
|
char md5sum[34];
|
|
|
|
double size;
|
|
|
|
|
|
|
|
void clear();
|
|
|
|
};
|
|
|
|
|
|
|
|
class DB_FILE : public DB_BASE, public FILE_ITEM {
|
|
|
|
public:
|
|
|
|
DB_FILE(DB_CONN* p=0);
|
2015-08-13 21:05:53 +00:00
|
|
|
DB_ID_TYPE get_id();
|
2010-03-05 22:55:16 +00:00
|
|
|
void db_print(char*);
|
|
|
|
void db_parse(MYSQL_ROW &row);
|
|
|
|
void operator=(FILE_ITEM& f) {FILE_ITEM::operator=(f);}
|
|
|
|
};
|
|
|
|
|
|
|
|
struct FILESET_ITEM {
|
2015-07-23 17:11:08 +00:00
|
|
|
DB_ID_TYPE id;
|
2010-03-05 22:55:16 +00:00
|
|
|
char name[254];
|
|
|
|
|
|
|
|
void clear();
|
|
|
|
};
|
|
|
|
|
|
|
|
class DB_FILESET : public DB_BASE, public FILESET_ITEM {
|
|
|
|
public:
|
|
|
|
DB_FILESET(DB_CONN* p=0);
|
2015-08-13 21:05:53 +00:00
|
|
|
DB_ID_TYPE get_id();
|
2010-03-05 22:55:16 +00:00
|
|
|
void db_print(char*);
|
|
|
|
void db_parse(MYSQL_ROW &row);
|
|
|
|
void operator=(FILESET_ITEM& f) {FILESET_ITEM::operator=(f);}
|
|
|
|
|
|
|
|
// retrieve fileset instance (populate object)
|
|
|
|
int select_by_name(const char* name);
|
|
|
|
};
|
|
|
|
|
|
|
|
struct FILESET_FILE_ITEM {
|
2015-07-23 17:11:08 +00:00
|
|
|
DB_ID_TYPE fileset_id;
|
|
|
|
DB_ID_TYPE file_id;
|
2010-03-05 22:55:16 +00:00
|
|
|
|
|
|
|
void clear();
|
|
|
|
};
|
|
|
|
|
|
|
|
class DB_FILESET_FILE : public DB_BASE, public FILESET_FILE_ITEM {
|
|
|
|
public:
|
|
|
|
DB_FILESET_FILE(DB_CONN* p=0);
|
|
|
|
void db_print(char*);
|
|
|
|
void db_parse(MYSQL_ROW &row);
|
|
|
|
void operator=(FILESET_FILE_ITEM& tf) {FILESET_FILE_ITEM::operator=(tf);}
|
|
|
|
};
|
|
|
|
|
|
|
|
struct SCHED_TRIGGER_ITEM {
|
2015-07-23 17:11:08 +00:00
|
|
|
DB_ID_TYPE id;
|
|
|
|
DB_ID_TYPE fileset_id;
|
2010-03-05 22:55:16 +00:00
|
|
|
bool need_work;
|
|
|
|
bool work_available;
|
|
|
|
bool no_work_available;
|
|
|
|
bool working_set_removal;
|
|
|
|
|
|
|
|
void clear();
|
|
|
|
};
|
|
|
|
|
|
|
|
class DB_SCHED_TRIGGER : public DB_BASE, public SCHED_TRIGGER_ITEM {
|
|
|
|
public:
|
|
|
|
DB_SCHED_TRIGGER(DB_CONN* p=0);
|
2015-08-13 21:05:53 +00:00
|
|
|
DB_ID_TYPE get_id();
|
2010-03-05 22:55:16 +00:00
|
|
|
void db_print(char*);
|
|
|
|
void db_parse(MYSQL_ROW &row);
|
|
|
|
void operator=(SCHED_TRIGGER_ITEM& t) {SCHED_TRIGGER_ITEM::operator=(t);}
|
|
|
|
|
|
|
|
typedef enum {
|
|
|
|
none = 0,
|
|
|
|
state_need_work = 1,
|
|
|
|
state_work_available = 2,
|
|
|
|
state_no_work_available = 3,
|
|
|
|
state_working_set_removal = 4
|
|
|
|
} STATE;
|
|
|
|
|
|
|
|
// retrieve trigger instance (populate object)
|
|
|
|
int select_unique_by_fileset_name(const char* fileset_name);
|
|
|
|
// set single trigger state
|
|
|
|
int update_single_state(const DB_SCHED_TRIGGER::STATE state, const bool value);
|
|
|
|
};
|
|
|
|
|
|
|
|
struct FILESET_SCHED_TRIGGER_ITEM {
|
|
|
|
FILESET_ITEM fileset;
|
|
|
|
SCHED_TRIGGER_ITEM trigger;
|
|
|
|
|
|
|
|
void clear();
|
|
|
|
};
|
|
|
|
|
|
|
|
class DB_FILESET_SCHED_TRIGGER_ITEM : public DB_BASE_SPECIAL, public FILESET_SCHED_TRIGGER_ITEM {
|
|
|
|
public:
|
|
|
|
DB_FILESET_SCHED_TRIGGER_ITEM(DB_CONN* p=0);
|
|
|
|
void db_parse(MYSQL_ROW &row);
|
|
|
|
void operator=(FILESET_SCHED_TRIGGER_ITEM& fst) {FILESET_SCHED_TRIGGER_ITEM::operator=(fst);}
|
|
|
|
};
|
|
|
|
|
|
|
|
class DB_FILESET_SCHED_TRIGGER_ITEM_SET : public DB_BASE_SPECIAL {
|
|
|
|
public:
|
|
|
|
DB_FILESET_SCHED_TRIGGER_ITEM_SET(DB_CONN* p=0);
|
|
|
|
|
|
|
|
// select available triggers based on name and/or state
|
|
|
|
// -> name filter optional (set string, default NULL)
|
|
|
|
// -> pattern search optional (set use_regexp to true, default false))
|
|
|
|
// -> state filter optional (set state, default none)
|
|
|
|
// -> state_value (default true)
|
|
|
|
int select_by_name_state(
|
|
|
|
const char* fileset_name,
|
|
|
|
const bool use_regexp,
|
|
|
|
const DB_SCHED_TRIGGER::STATE state,
|
|
|
|
const bool state_value);
|
|
|
|
|
|
|
|
// check if given trigger (fileset name) is part of set and return position (1-indexed)
|
|
|
|
int contains_trigger(const char* fileset_name);
|
|
|
|
|
|
|
|
// storage vector
|
|
|
|
std::vector<DB_FILESET_SCHED_TRIGGER_ITEM> items;
|
|
|
|
};
|
|
|
|
|
2012-01-23 05:03:52 +00:00
|
|
|
struct DB_VDA_FILE : public DB_BASE, public VDA_FILE {
|
|
|
|
DB_VDA_FILE(DB_CONN* p=0);
|
2015-08-13 21:05:53 +00:00
|
|
|
DB_ID_TYPE get_id();
|
2012-01-23 05:03:52 +00:00
|
|
|
void db_print(char*);
|
|
|
|
void db_parse(MYSQL_ROW &row);
|
|
|
|
};
|
|
|
|
|
|
|
|
struct DB_VDA_CHUNK_HOST : public DB_BASE, public VDA_CHUNK_HOST {
|
|
|
|
DB_VDA_CHUNK_HOST(DB_CONN* p=0);
|
|
|
|
void db_print(char*);
|
|
|
|
void db_parse(MYSQL_ROW &row);
|
|
|
|
};
|
|
|
|
|
2014-05-19 02:19:05 +00:00
|
|
|
struct DB_BADGE : public DB_BASE, public BADGE {
|
|
|
|
DB_BADGE(DB_CONN* p=0);
|
2015-08-13 21:05:53 +00:00
|
|
|
DB_ID_TYPE get_id() {return id;};
|
2014-05-19 02:19:05 +00:00
|
|
|
void db_print(char*){};
|
|
|
|
void db_parse(MYSQL_ROW&);
|
|
|
|
};
|
|
|
|
|
|
|
|
struct DB_BADGE_USER : public DB_BASE, public BADGE_USER {
|
|
|
|
DB_BADGE_USER(DB_CONN* p=0);
|
|
|
|
void db_print(char*){};
|
|
|
|
void db_parse(MYSQL_ROW&);
|
|
|
|
};
|
|
|
|
|
|
|
|
struct DB_BADGE_TEAM : public DB_BASE, public BADGE_TEAM {
|
|
|
|
DB_BADGE_TEAM(DB_CONN* p=0);
|
|
|
|
void db_print(char*){};
|
|
|
|
void db_parse(MYSQL_ROW&);
|
|
|
|
};
|
|
|
|
|
2014-08-15 21:01:32 +00:00
|
|
|
struct DB_CREDIT_USER : public DB_BASE, public CREDIT_USER {
|
|
|
|
DB_CREDIT_USER(DB_CONN* p=0);
|
|
|
|
void db_print(char*);
|
|
|
|
void db_parse(MYSQL_ROW&);
|
|
|
|
};
|
|
|
|
|
|
|
|
struct DB_CREDIT_TEAM : public DB_BASE, public CREDIT_TEAM {
|
|
|
|
DB_CREDIT_TEAM(DB_CONN* p=0);
|
|
|
|
void db_print(char*);
|
|
|
|
void db_parse(MYSQL_ROW&);
|
|
|
|
};
|
|
|
|
|
2002-04-30 22:22:54 +00:00
|
|
|
#endif
|