*** empty log message ***

svn path=/trunk/boinc/; revision=5151
This commit is contained in:
David Anderson 2005-01-20 18:50:49 +00:00
parent 64d37b3955
commit b7a7cd825f
14 changed files with 87 additions and 7 deletions

View File

@ -22993,3 +22993,36 @@ Bruce 20 Jan 2005
client/
Makefile.am
David 20 Jan 2005
- Added cross-project IDs for hosts.
This lets statistics sites show work per host, summed over projects.
Implementation:
Hosts generate their own "internal" CPIDs,
using an MD5 of time/domain/IP/disk_free.
This should be unique across that user's hosts.
It's stored in the HOST_INFO structure and sent to server.
The server hashes the internal CPID with the user's email address
and stores the resulting "external" CPID in the host table.
It is included by db_dump in <host> elements.
PROJECT NOTE: if you use this server code you will need
to apply update_1_20_2005() from html/ops/db_update.php to existing DBs
client/
client_stats.h
hostinfo_unix.C
win/
hostinfo_win.cpp
db/
boinc_db.C,h
schema.sql
html/ops/
db_update.php
lib/
hostinfo.C,h
sched/
db_dump.C
handle_request.C
server_types.C
start

View File

@ -183,6 +183,7 @@ public:
private:
int parse_account_files();
int parse_preferences_for_user_files();
// --------------- cs_apps.C:
public:
bool must_schedule_cpus;
@ -318,6 +319,7 @@ public:
void check_all();
#if 0
// ------------------ cs_data.C:
// mechanisms for managing data saved on host
//
@ -344,6 +346,8 @@ private:
double offender(PROJECT*);
double proj_potentially_free(PROJECT*);
FILE_INFO* get_priority_or_lru(PROJECT*, int);
#endif
};
extern CLIENT_STATE gstate;

View File

@ -463,6 +463,9 @@ int HOST_INFO::get_host_info() {
#error Need to specify a method to obtain OS name/version
#endif
if (!strlen(host_cpid)) {
generate_host_cpid();
}
return 0;
}

View File

@ -361,6 +361,10 @@ int HOST_INFO::get_host_info() {
}
RegCloseKey(hKey);
if (!strlen(host_cpid)) {
generate_host_cpid();
}
return 0;
}

View File

@ -338,6 +338,7 @@ void DB_HOST::db_print(char* buf){
ESCAPE(domain_name);
ESCAPE(serialnum);
ESCAPE(last_ip_addr);
ESCAPE(host_cpid);
ESCAPE(p_vendor);
ESCAPE(p_model);
ESCAPE(os_name);
@ -358,7 +359,8 @@ void DB_HOST::db_print(char* buf){
"n_bwup=%.15e, n_bwdown=%.15e, "
"credit_per_cpu_sec=%.15e, "
"venue='%s', nresults_today=%d, "
"avg_turnaround=%f",
"avg_turnaround=%f, "
"host_cpid='%s' ",
create_time, userid,
rpc_seqno, rpc_time,
total_credit, expavg_credit, expavg_time,
@ -374,7 +376,8 @@ void DB_HOST::db_print(char* buf){
n_bwup, n_bwdown,
credit_per_cpu_sec,
venue, nresults_today,
avg_turnaround
avg_turnaround,
host_cpid
);
UNESCAPE(domain_name);
UNESCAPE(serialnum);
@ -383,6 +386,7 @@ void DB_HOST::db_print(char* buf){
UNESCAPE(p_model);
UNESCAPE(os_name);
UNESCAPE(os_version);
UNESCAPE(host_cpid);
}
void DB_HOST::db_parse(MYSQL_ROW &r) {
@ -426,6 +430,7 @@ void DB_HOST::db_parse(MYSQL_ROW &r) {
strcpy2(venue, r[i++]);
nresults_today = atoi(r[i++]);
avg_turnaround = atof(r[i++]);
strcpy2(host_cpid, r[i++]);
}
void DB_WORKUNIT::db_print(char* buf){

View File

@ -261,6 +261,7 @@ struct HOST {
char venue[256]; // home/work/school
int nresults_today; // results sent since midnight
double avg_turnaround; // recent average result turnaround time
char host_cpid[256]; // host cross-project ID
int parse(FILE*);
int parse_time_stats(FILE*);

View File

@ -167,6 +167,7 @@ create table host (
venue varchar(254) not null,
nresults_today integer not null,
avg_turnaround double not null,
host_cpid varchar(254),
primary key (id)
) type=InnoDB;

View File

@ -233,6 +233,10 @@ function update_1_19_2005() {
);
}
function update_1_20_2005() {
mysql_query("alter table host add host_cpid varchar(254)";
}
//update_10_25_2004();
?>

View File

@ -32,6 +32,7 @@
#include "util.h"
#include "parse.h"
#include "md5_file.h"
#include "error_numbers.h"
#include "hostinfo.h"
@ -43,6 +44,7 @@ void HOST_INFO::clear_host_info() {
strcpy(domain_name, "");
strcpy(serialnum, "");
strcpy(ip_addr, "");
strcpy(host_cpid, "");
p_ncpus = 0;
strcpy(p_vendor, "");
@ -77,6 +79,7 @@ int HOST_INFO::parse(MIOFILE& in) {
else if (parse_int(buf, "<timezone>", timezone)) continue;
else if (parse_str(buf, "<domain_name>", domain_name, sizeof(domain_name))) continue;
else if (parse_str(buf, "<ip_addr>", ip_addr, sizeof(ip_addr))) continue;
else if (parse_str(buf, "<host_cpid>", host_cpid, sizeof(host_cpid))) continue;
else if (parse_int(buf, "<p_ncpus>", p_ncpus)) continue;
else if (parse_str(buf, "<p_vendor>", p_vendor, sizeof(p_vendor))) continue;
else if (parse_str(buf, "<p_model>", p_model, sizeof(p_model))) continue;
@ -117,6 +120,7 @@ int HOST_INFO::write(MIOFILE& out) {
" <timezone>%d</timezone>\n"
" <domain_name>%s</domain_name>\n"
" <ip_addr>%s</ip_addr>\n"
" <host_cpid>%s</host_cpid>\n"
" <p_ncpus>%d</p_ncpus>\n"
" <p_vendor>%s</p_vendor>\n"
" <p_model>%s</p_model>\n"
@ -138,6 +142,7 @@ int HOST_INFO::write(MIOFILE& out) {
timezone,
domain_name,
ip_addr,
host_cpid,
p_ncpus,
p_vendor,
p_model,
@ -206,4 +211,14 @@ int HOST_INFO::write_cpu_benchmarks(FILE* out) {
return 0;
}
// make a host cross-project ID.
// Should be unique across hosts with very high probability
//
void HOST_INFO::generate_host_cpid() {
char buf[1024];
sprintf(buf, "%f%s%s%f", dtime(), domain_name, ip_addr, d_free);
md5_block((const unsigned char*) buf, strlen(buf), host_cpid);
}
const char *BOINC_RCSID_edf7e5c147 = "$Id$";

View File

@ -35,6 +35,7 @@ struct HOST_INFO {
char domain_name[256];
char serialnum[256];
char ip_addr[256];
char host_cpid[64];
int p_ncpus;
char p_vendor[256];
@ -66,6 +67,7 @@ struct HOST_INFO {
bool users_idle(bool check_all_logins, double idle_time_to_run);
int get_host_info();
void clear_host_info();
void generate_host_cpid();
};
#ifdef _WIN32

View File

@ -341,7 +341,8 @@ void write_host(HOST& host, FILE* f, bool detail) {
" <d_free>%f</d_free>\n"
" <n_bwup>%f</n_bwup>\n"
" <n_bwdown>%f</n_bwdown>\n"
" <avg_turnaround>%f</avg_turnaround>\n",
" <avg_turnaround>%f</avg_turnaround>\n"
" <host_cpid>%s</host_cpid>\n",
host.create_time,
host.rpc_time,
host.timezone,
@ -356,7 +357,8 @@ void write_host(HOST& host, FILE* f, bool detail) {
host.d_free,
host.n_bwup,
host.n_bwdown,
host.avg_turnaround
host.avg_turnaround,
host.host_cpid
);
}
fprintf(f,

View File

@ -256,11 +256,16 @@ static int modify_host_struct(SCHEDULER_REQUEST& sreq, HOST& host) {
return 0;
}
static int update_host_record(HOST& xhost) {
static int update_host_record(HOST& xhost, USER& user) {
DB_HOST host;
int retval;
char buf[1024];
host = xhost;
if (strlen(host.host_cpid)) {
sprintf(buf, "%s%s", host.host_cpid, user.email_addr);
md5_block((const unsigned char*)buf, strlen(buf), host.host_cpid);
}
retval = host.update();
if (retval) {
log_messages.printf(SCHED_MSG_LOG::CRITICAL, "host.update() failed: %d\n", retval);
@ -865,7 +870,7 @@ void process_request(
handle_msgs_to_host(sreq, reply);
}
update_host_record(reply.host);
update_host_record(reply.host, reply.user);
leave:
if (!have_no_work) {

View File

@ -476,6 +476,7 @@ int HOST::parse(FILE* fin) {
else if (parse_str(buf, "<domain_name>", domain_name, sizeof(domain_name))) continue;
else if (parse_str(buf, "<serialnum>", serialnum, sizeof(serialnum))) continue;
else if (parse_str(buf, "<ip_addr>", last_ip_addr, sizeof(last_ip_addr))) continue;
else if (parse_str(buf, "<host_cpid>", host_cpid, sizeof(host_cpid))) continue;
else if (parse_int(buf, "<p_ncpus>", p_ncpus)) continue;
else if (parse_str(buf, "<p_vendor>", p_vendor, sizeof(p_vendor))) continue;
else if (parse_str(buf, "<p_model>", p_model, sizeof(p_model))) continue;

View File

@ -670,7 +670,7 @@ for opt,v in opts:
command = command_enable_start
elif opt == '-c' or opt == '--cron':
command = command_cron_start
elif opt == '-c' or opt == '--cron-task':
elif opt == '--cron-task':
command = command_tasks_start
elif opt == '-d' or opt == '--disable' or opt == '--stop' or opt == '-k' or opt == '--kill':
command = command_disable_stop