server: store and display gpu_active_frac

- gpu_active_frac is the fraction of time GPU use is allowed
  while the client is running.
  Previously the client reported it but we weren't storing it in the DB.
  We may need it in the future for batch scheduling logic.
- fix a crashing bug in scheduler
- client: minor message tweak
This commit is contained in:
David Anderson 2014-03-06 13:23:52 -08:00
parent 5693eae24b
commit df1d8e2bde
8 changed files with 31 additions and 13 deletions

View File

@ -229,7 +229,7 @@ void RSC_WORK_FETCH::set_request(PROJECT* p) {
if (log_flags.work_fetch_debug) {
msg_printf(p, MSG_INFO,
"[work_fetch] set_request() for %s: ninst %d nused_total %f nidle_now %f fetch share %f req_inst %f req_secs %f",
"[work_fetch] set_request() for %s: ninst %d nused_total %.2f nidle_now %.2f fetch share %.2f req_inst %.2f req_secs %.2f",
rsc_name_long(rsc_type), ninstances, w.nused_total, nidle_now,
w.fetchable_share, req_instances, req_secs
);

View File

@ -491,14 +491,16 @@ void DB_HOST::db_print(char* buf){
"avg_turnaround=%.15e, "
"host_cpid='%s', external_ip_addr='%s', max_results_day=%d, "
"error_rate=%.15e, "
"product_name='%s' ",
"product_name='%s', "
"gpu_active_frac=%.15e ",
create_time, userid,
rpc_seqno, rpc_time,
total_credit, expavg_credit, expavg_time,
timezone, domain_name, serialnum,
last_ip_addr, nsame_ip_addr,
on_frac, connected_frac, active_frac,
cpu_efficiency, duration_correction_factor,
on_frac, connected_frac,
active_frac, cpu_efficiency,
duration_correction_factor,
p_ncpus, p_vendor, p_model,
p_fpops, p_iops, p_membw,
os_name, os_version,
@ -511,7 +513,8 @@ void DB_HOST::db_print(char* buf){
avg_turnaround,
host_cpid, external_ip_addr, _max_results_day,
_error_rate,
product_name
product_name,
gpu_active_frac
);
UNESCAPE(domain_name);
UNESCAPE(serialnum);
@ -572,6 +575,7 @@ void DB_HOST::db_parse(MYSQL_ROW &r) {
_max_results_day = atoi(r[i++]);
_error_rate = atof(r[i++]);
strcpy2(product_name, r[i++]);
gpu_active_frac = atof(r[i++]);
}
int DB_HOST::update_diff_validator(HOST& h) {
@ -793,6 +797,10 @@ int DB_HOST::update_diff_sched(HOST& h) {
unescape_string(product_name, sizeof(product_name));
strcat(updates, buf);
}
if (gpu_active_frac != h.gpu_active_frac) {
sprintf(buf, " gpu_active_frac=%.15e,", gpu_active_frac);
strcat(updates, buf);
}
int n = strlen(updates);
if (n == 0) return 0;

View File

@ -337,6 +337,7 @@ struct HOST {
// that fail validation
// DEPRECATED
char product_name[256];
double gpu_active_frac;
// the following items are passed in scheduler requests,
// and used in the scheduler,
@ -349,7 +350,6 @@ struct HOST {
OPENCL_CPU_PROP opencl_cpu_prop[MAX_OPENCL_CPU_PLATFORMS];
// stuff from time_stats
double gpu_active_frac;
double cpu_and_network_available_frac;
double client_start_time;
double previous_uptime;

View File

@ -186,6 +186,7 @@ create table host (
max_results_day integer not null,
error_rate double not null default 0,
product_name varchar(254) not null,
gpu_active_frac double not null,
primary key (id)
) engine=InnoDB;

View File

@ -182,11 +182,12 @@ function show_host($host, $user, $ipprivate) {
if ($user) {
row2(tra("Number of times client has contacted server"), $host->rpc_seqno);
row2(tra("Last time contacted server"), sched_log_link($host->rpc_time));
row2(tra("% of time BOINC is running"), 100*$host->on_frac." %");
row2(tra("% of time BOINC is running"), number_format(100*$host->on_frac, 2)."%");
if ($host->connected_frac > 0) {
row2(tra("While BOINC running, % of time host has an Internet connection"), 100*$host->connected_frac." %");
row2(tra("While BOINC running, % of time host has an Internet connection"), number_format(100*$host->connected_frac, 2)."%");
}
row2(tra("While BOINC running, % of time work is allowed"), 100*$host->active_frac." %");
row2(tra("While BOINC running, % of time work is allowed"), number_format(100*$host->active_frac, 2)."%");
row2(tra("While BOINC running, % of time GPU work is allowed"), number_format(100*$host->gpu_active_frac, 2)."%");
if ($host->cpu_efficiency) {
row2(tra("Average CPU efficiency"), $host->cpu_efficiency);
}

View File

@ -909,6 +909,12 @@ function update_1_13_2014() {
);
}
function update_3_6_2014() {
do_query(
"alter table host add gpu_active_frac double not null"
);
}
// Updates are done automatically if you use "upgrade".
//
// If you need to do updates manually,
@ -947,6 +953,7 @@ $db_updates = array (
array(27004, "update_9_17_2013"),
array(27005, "update_12_22_2013"),
array(27006, "update_1_13_2014"),
array(27007, "update_3_6_2014"),
);
?>

View File

@ -252,8 +252,9 @@ int procinfo_setup(PROC_MAP& pm) {
strlcpy(p.command, ps.comm, sizeof(p.command));
p.is_boinc_app = (p.id == pid || strcasestr(p.command, "boinc"));
p.is_low_priority = (ps.priority == 39);
// Linux seems to add 20 here,
// but this isn't documented anywhere
// Internally Linux stores the process priority as nice + 20
// as -ve values are error codes. Thus this generally gives
// a process priority range of 39..0
pm.insert(std::pair<int, PROCINFO>(p.id, p));
#endif
}

View File

@ -1344,7 +1344,7 @@ void GLOBAL_PREFS::defaults() {
void GUI_URLS::init() {
text = 0;
read_file_malloc(config.project_path("gui_urls.xml"), text);
text = lf_terminate(text);
if (text) text = lf_terminate(text);
}
void GUI_URLS::get_gui_urls(USER& user, HOST& host, TEAM& team, char* buf, int len) {
@ -1386,7 +1386,7 @@ void GUI_URLS::get_gui_urls(USER& user, HOST& host, TEAM& team, char* buf, int l
void PROJECT_FILES::init() {
text = 0;
read_file_malloc(config.project_path("project_files.xml"), text);
text = lf_terminate(text);
if (text) text = lf_terminate(text);
}
void get_weak_auth(USER& user, char* buf) {