- added "census", a program that counts up how much RAC

there is for each HR class, and writes it to a file.
    This will be used soon for HR support in the feeder.
- split the HR code into hr.C,h (stuff used by both census and scheduler)
    and sched_hr.C (stuff used only by the scheduler)
- database: change DB_CREDITED_JOB to treat workunitid
    as a double (which it is) rather than a long.
    BTW, long == int.
- fixed lots of compile warnings in the server code

db/
    boinc_db.C,h
lib/
    boinc_cmd.C
    miofile.C
    util.C
sched/
    Makefile.am
    census.C (new)
    feeder.C
    file_deleter.C
    file_upload_handler.C
    handle_request.C
    hr.C,h (new)
    main.C
    sample_assimilator.C
    sample_work_generator.C
    sched_array.C
    sched_hr.C,h
    sched_send.C
    server_types.C
    transitioner.C
    validator.C

svn path=/trunk/boinc/; revision=12970
This commit is contained in:
David Anderson 2007-06-20 22:34:06 +00:00
parent 6ad51e0452
commit f5d94818dd
24 changed files with 482 additions and 249 deletions

View File

@ -6443,3 +6443,38 @@ David 20 June 2007
sched/
feeder.C
David 20 June 2007
- added "census", a program that counts up how much RAC
there is for each HR class, and writes it to a file.
This will be used soon for HR support in the feeder.
- split the HR code into hr.C,h (stuff used by both census and scheduler)
and sched_hr.C (stuff used only by the scheduler)
- database: change DB_CREDITED_JOB to treat workunitid
as a double (which it is) rather than a long.
BTW, long == int.
- fixed lots of compile warnings in the server code
db/
boinc_db.C,h
lib/
boinc_cmd.C
miofile.C
util.C
sched/
Makefile.am
census.C (new)
feeder.C
file_deleter.C
file_upload_handler.C
handle_request.C
hr.C,h (new)
main.C
sample_assimilator.C
sample_work_generator.C
sched_array.C
sched_hr.C,h
sched_send.C
server_types.C
transitioner.C
validator.C

View File

@ -691,7 +691,7 @@ void DB_WORKUNIT::db_parse(MYSQL_ROW &r) {
void DB_CREDITED_JOB::db_print(char* buf){
sprintf(buf,
"userid=%d, workunitid=%d",
"userid=%d, workunitid=%f",
userid, workunitid
);
}
@ -700,7 +700,7 @@ void DB_CREDITED_JOB::db_parse(MYSQL_ROW &r) {
int i=0;
clear();
userid = atoi(r[i++]);
workunitid = atoi(r[i++]);
workunitid = atof(r[i++]);
};
void DB_RESULT::db_print(char* buf){

View File

@ -376,7 +376,7 @@ struct WORKUNIT {
struct CREDITED_JOB {
int userid;
long workunitid;
double workunitid;
// the following not used in the DB
void clear();

View File

@ -404,11 +404,11 @@ int main(int argc, char** argv) {
if (amrr.error_num != ERR_IN_PROGRESS) break;
boinc_sleep(1);
} else {
unsigned int i, n = amrr.messages.size();
unsigned int j, n = amrr.messages.size();
if (n) {
printf("Messages from account manager:\n");
for (i=0; i<n; i++) {
printf("%s\n", amrr.messages[i].c_str());
for (j=0; j<n; j++) {
printf("%s\n", amrr.messages[j].c_str());
}
}
break;
@ -512,11 +512,11 @@ int main(int argc, char** argv) {
} else if (!strcmp(cmd, "--set_debts")) {
vector<PROJECT>projects;
while (i < argc) {
PROJECT p;
p.master_url = string(next_arg(argc, argv, i));
p.short_term_debt = atoi(next_arg(argc, argv, i));
p.long_term_debt = atoi(next_arg(argc, argv, i));
projects.push_back(p);
PROJECT proj;
proj.master_url = string(next_arg(argc, argv, i));
proj.short_term_debt = atoi(next_arg(argc, argv, i));
proj.long_term_debt = atoi(next_arg(argc, argv, i));
projects.push_back(proj);
}
retval = rpc.set_debts(projects);
} else if (!strcmp(cmd, "--quit")) {

View File

@ -78,16 +78,16 @@ int MIOFILE::printf(const char* format, ...) {
return retval;
}
char* MIOFILE::fgets(char* dst, int len) {
char* MIOFILE::fgets(char* dst, int dst_len) {
if (f) {
return ::fgets(dst, len, f);
return ::fgets(dst, dst_len, f);
}
const char* q = strchr(buf, '\n');
if (!q) return 0;
q++;
int n = (int)(q - buf);
if (n > len-1) n = len-1;
if (n > dst_len-1) n = dst_len-1;
memcpy(dst, buf, n);
dst[n] = 0;

View File

@ -454,7 +454,7 @@ int run_program(
}
#else
int run_program(
const char* dir, const char* file, int argc, char** argv, double nsecs, int& id
const char* dir, const char* file, int , char** argv, double nsecs, int& id
) {
int retval;
int pid = fork();

View File

@ -2,27 +2,28 @@
include $(top_srcdir)/Makefile.incl
noinst_PROGRAMS = \
cgi \
db_dump \
db_purge \
delete_file \
feeder \
file_deleter \
file_upload_handler \
get_file \
make_work \
message_handler \
request_file_list \
noinst_PROGRAMS = \
census \
cgi \
db_dump \
db_purge \
delete_file \
feeder \
file_deleter \
file_upload_handler \
get_file \
make_work \
message_handler \
request_file_list \
sample_assimilator \
sample_dummy_assimilator \
sample_bitwise_validator \
sample_trivial_validator \
sample_dummy_assimilator \
sample_bitwise_validator \
sample_trivial_validator \
sample_work_generator \
send_file \
show_shmem \
transitioner \
update_stats \
send_file \
show_shmem \
transitioner \
update_stats \
wu_check
lib_LIBRARIES = libsched.a
@ -37,33 +38,34 @@ LDADD = -L. -lsched $(MYSQL_LIBS) $(BOINC_LIB) $(PTHREAD_LIBS)
LIB_SCHED = libsched.a
libsched_a_SOURCES = \
sched_shmem.C \
sched_util.C \
sched_config.C \
sched_msgs.C \
../db/boinc_db.C \
../db/db_base.C \
../lib/msg_log.C \
../tools/process_result_template.C \
libsched_a_SOURCES = \
sched_shmem.C \
sched_util.C \
sched_config.C \
sched_msgs.C \
../db/boinc_db.C \
../db/db_base.C \
../lib/msg_log.C \
../tools/process_result_template.C \
../tools/backend_lib.C
EXTRA_DIST = \
assimilate_handler.h \
fcgiapp.h \
fcgi_stdio.h \
handle_request.h \
main.h \
sched_locality.h \
sched_send.h \
sched_shmem.h \
server_types.h \
EXTRA_DIST = \
assimilate_handler.h \
fcgiapp.h \
fcgi_stdio.h \
handle_request.h \
main.h \
sched_locality.h \
sched_send.h \
sched_shmem.h \
server_types.h \
start
cgi_SOURCES = \
edf_sim.C \
handle_request.C \
hr.C \
main.C \
sched_array.C \
sched_hr.C \
@ -74,16 +76,19 @@ cgi_SOURCES = \
server_types.C \
../lib/synch.C
census_SOURCES = \
census.C \
hr.C
## install header-files with prefix-subdir BOINC/ to avoid name-conflicts
includedir = ${prefix}/include/BOINC/
## install only headers that are meant for exporting the API !!
include_HEADERS = \
sched_config.h \
sched_msgs.h \
sched_util.h \
../tools/backend_lib.h \
include_HEADERS = \
sched_config.h \
sched_msgs.h \
sched_util.h \
../tools/backend_lib.h \
validate_util.h
@ -160,46 +165,46 @@ delete_file_SOURCES = delete_file.C
delete_file_DEPENDENCIES = $(LIBRSA) $(LIB_SCHED)
delete_file_LDADD = $(LDADD) $(RSA_LIBS)
fcgi_SOURCES = \
handle_request.C \
main.C \
sched_send.C \
sched_resend.C \
sched_array.C \
sched_hr.C \
server_types.C \
sched_shmem.C \
sched_util.C \
sched_config.C \
sched_msgs.C \
sched_locality.C \
sched_timezone.C \
fcgi_SOURCES = \
handle_request.C \
main.C \
sched_send.C \
sched_resend.C \
sched_array.C \
sched_hr.C \
server_types.C \
sched_shmem.C \
sched_util.C \
sched_config.C \
sched_msgs.C \
sched_locality.C \
sched_timezone.C \
edf_sim.C \
../db/boinc_db.C \
../db/db_base.C \
../lib/base64.C \
../lib/crypt.C \
../lib/filesys.C \
../lib/md5.c \
../lib/md5_file.C \
../lib/miofile.C \
../lib/msg_log.C \
../lib/parse.C \
../lib/shmem.C \
../lib/synch.C \
../lib/util.C \
../tools/process_result_template.C \
../db/boinc_db.C \
../db/db_base.C \
../lib/base64.C \
../lib/crypt.C \
../lib/filesys.C \
../lib/md5.c \
../lib/md5_file.C \
../lib/miofile.C \
../lib/msg_log.C \
../lib/parse.C \
../lib/shmem.C \
../lib/synch.C \
../lib/util.C \
../tools/process_result_template.C \
../tools/backend_lib.C
fcgi_DEPENDENCIES = $(LIBRSA) $(LIB_SCHED)
fcgi_CPPFLAGS = -include fcgi_stdio.h -D_USING_FCGI_ $(AM_CPPFLAGS)
fcgi_LDADD = $(LDADD) $(RSA_LIBS) -lfcgi $(MYSQL_LIBS)
fcgi_file_upload_handler_SOURCES = \
file_upload_handler.C \
sched_config.C \
../lib/miofile.C \
../lib/parse.C \
fcgi_file_upload_handler_SOURCES = \
file_upload_handler.C \
sched_config.C \
../lib/miofile.C \
../lib/parse.C \
../lib/crypt.C
fcgi_file_upload_handler_DEPENDENCIES = $(LIBRSA) $(LIB_SCHED)
fcgi_file_upload_handler_CPPFLAGS = -include fcgi_stdio.h -D_USING_FCGI_ $(AM_CPPFLAGS)

57
sched/census.C Normal file
View File

@ -0,0 +1,57 @@
// Berkeley Open Infrastructure for Network Computing
// http://boinc.berkeley.edu
// Copyright (C) 2007 University of California
//
// This 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 2.1 of the License, or (at your option) any later version.
//
// This software is distributed in the hope that it will be useful,
// 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.
//
// To view the GNU Lesser General Public License visit
// http://www.gnu.org/copyleft/lesser.html
// or write to the Free Software Foundation, Inc.,
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// Census - create a file saying (for each HR type)
// how much RAC each HR class is getting.
// This info is used the feeder to decide how many shared-memory slots
// to devote to each HR class.
#include <stdio.h>
#include "boinc_db.h"
#include "str_util.h"
#include "sched_config.h"
#include "sched_util.h"
#include "sched_msgs.h"
#include "hr.h"
int main() {
HR_INFO hri;
int retval;
SCHED_CONFIG config;
check_stop_daemons();
retval = config.parse_file("..");
if (retval) {
log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL,
"Can't parse ../config.xml: %s\n", boincerror(retval)
);
exit(1);
}
retval = boinc_db.open(
config.db_name, config.db_host, config.db_user, config.db_passwd
);
if (retval) {
log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL, "Can't open DB\n");
exit(1);
}
boinc_db.set_isolation_level(READ_UNCOMMITTED);
hri.scan_db();
hri.write_file("foobar");
}

View File

@ -280,7 +280,6 @@ static bool scan_work_array(vector<DB_WORK_ITEM> &work_items) {
bool found;
int enum_phase[napps];
int app_index;
int enum_size;
int nadditions=0, ncollisions=0;
for (i=0; i<napps; i++) {
@ -374,7 +373,12 @@ static bool scan_work_array(vector<DB_WORK_ITEM> &work_items) {
log_messages.printf(SCHED_MSG_LOG::MSG_DEBUG,
"%d results already in array\n", ncollisions
);
return false;
}
if (nadditions == 0) {
return false;
}
return true;
}
void feeder_loop() {

View File

@ -541,7 +541,7 @@ void do_antique_pass() {
int main(int argc, char** argv) {
int retval;
bool one_pass = false, retry_error = false, delete_antiques = false;
bool one_pass = false;
int i;
check_stop_daemons();

View File

@ -218,7 +218,7 @@ int copy_socket_to_file(FILE* in, char* path, double offset, double nbytes) {
ssize_t ret = write(fd, buf+n-to_write, to_write);
if (ret < 0) {
close(fd);
char* errmsg;
const char* errmsg;
if (errno == ENOSPC) {
errmsg = "No space left on server";
} else {
@ -590,7 +590,9 @@ int main() {
int retval;
R_RSA_PUBLIC_KEY key;
char log_path[256];
#ifdef _USING_FCGI_
unsigned int counter=0;
#endif
elapsed_wallclock_time();
installer();

View File

@ -490,7 +490,7 @@ static int update_host_record(HOST& initial_host, HOST& xhost, USER& user) {
// should be aborted outright, or aborted if not started yet
//
int send_result_abort(
SCHEDULER_REQUEST& sreq, SCHEDULER_REPLY& reply, SCHED_SHMEM& ss
SCHEDULER_REQUEST& sreq, SCHEDULER_REPLY& reply, SCHED_SHMEM&
) {
int aborts_sent = 0;
int retval = 0;

225
sched/hr.C Normal file
View File

@ -0,0 +1,225 @@
// Berkeley Open Infrastructure for Network Computing
// http://boinc.berkeley.edu
// Copyright (C) 2007 University of California
//
// This 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 2.1 of the License, or (at your option) any later version.
//
// This software is distributed in the hope that it will be useful,
// 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.
//
// To view the GNU Lesser General Public License visit
// http://www.gnu.org/copyleft/lesser.html
// or write to the Free Software Foundation, Inc.,
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#include "error_numbers.h"
#include "str_util.h"
#include "hr.h"
const int nocpu = 1;
const int Intel = 2;
const int AMD = 3;
const int Macintosh = 4;
const int AMDAthlon = 5;
const int AMDDuron = 6;
const int AMDSempron = 7;
const int AMDOpteron = 8;
const int AMDAthlon64 = 9;
const int AMDAthlonXP = 10;
const int IntelXeon = 11;
const int IntelCeleron = 12;
const int IntelPentium = 13;
const int IntelPentiumII = 14;
const int IntelPentiumIII = 15;
const int IntelPentium4 = 16;
const int IntelPentiumD = 17;
const int IntelPentiumM = 18;
const int AMDAthlonMP = 19;
const int AMDTurion = 20;
const int IntelCore2 = 21;
const int noos = 128;
const int Linux = 256;
const int Windows = 384;
const int Darwin = 512;
const int freebsd = 640;
inline int os(HOST& host){
if (strcasestr(host.os_name, "Linux")) return Linux;
else if (strcasestr(host.os_name, "Windows")) return Windows;
else if (strcasestr(host.os_name, "Darwin")) return Darwin;
else if (strcasestr(host.os_name, "FreeBSD")) return freebsd;
else return noos;
};
inline int cpu_coarse(HOST& host){
if (strcasestr(host.p_vendor, "Intel")) return Intel;
if (strcasestr(host.p_vendor, "AMD")) return AMD;
if (strcasestr(host.p_vendor, "Macintosh")) return Macintosh;
return nocpu;
}
inline int cpu_fine(HOST& host){
if (strcasestr(host.p_vendor, "Intel")) {
if (strcasestr(host.p_model, "Xeon")) return IntelXeon;
if (strcasestr(host.p_model, "Celeron")) {
if (strcasestr(host.p_model, " M ")) return IntelPentiumM;
if (strcasestr(host.p_model, " D ")) return IntelPentiumD;
if (strcasestr(host.p_model, "III")) return IntelPentiumIII;
return IntelCeleron;
}
if (strcasestr(host.p_model, "Core")) return IntelCore2;
if (strcasestr(host.p_model, "Pentium")) {
if (strcasestr(host.p_model, "III")) return IntelPentiumIII;
if (strcasestr(host.p_model, "II")) return IntelPentiumII;
if (strcasestr(host.p_model, " 4 ")) return IntelPentium4;
if (strcasestr(host.p_model, " D ")) return IntelPentiumD;
if (strcasestr(host.p_model, " M ")) return IntelPentiumM;
return IntelPentium;
}
if (strcasestr(host.p_model, "x86")) {
if (strcasestr(host.p_model, "Family 6 Model 6")) return IntelCeleron;
if (strcasestr(host.p_model, "Family 6 Model 9")) return IntelPentiumM;
if (strcasestr(host.p_model, "Family 6 Model 10")) return IntelXeon;
if (strcasestr(host.p_model, "Family 5 Model 1")) return IntelPentium;
if (strcasestr(host.p_model, "Family 5 Model 2")) return IntelPentium;
if (strcasestr(host.p_model, "Family 6 Model 1")) return IntelPentium;
if (strcasestr(host.p_model, "Family 15 Model 1")) return IntelPentium4;
if (strcasestr(host.p_model, "Family 15 Model 2")) return IntelPentium4;
if (strcasestr(host.p_model, "Family 6 Model 7")) return IntelPentiumIII;
if (strcasestr(host.p_model, "Family 6 Model 8" )) return IntelPentiumIII;
if (strcasestr(host.p_model, "Family 6 Model 11")) return IntelPentiumIII;
if (strcasestr(host.p_model, "Family 6 Model 3")) return IntelPentiumII;
if (strcasestr(host.p_model, "Family 6 Model 5")) return IntelPentiumII;
}
return Intel;
}
if (strcasestr(host.p_vendor, "AMD")) {
if (strcasestr(host.p_model, "Duron")) return AMDDuron;
if (strcasestr(host.p_model, "Opteron")) return AMDOpteron;
if (strcasestr(host.p_model, "Sempron")) return AMDSempron;
if (strcasestr(host.p_model, "Turion")) return AMDTurion;
if (strcasestr(host.p_model, "Athlon")) {
if (strcasestr(host.p_model, "XP")) return AMDAthlonXP;
if (strcasestr(host.p_model, "MP")) return AMDAthlonMP;
if (strcasestr(host.p_model, "64")) return AMDAthlon64;
return AMDAthlon;
}
return AMD;
}
if (strcasestr(host.p_vendor, "Macintosh")) return Macintosh;
return nocpu;
};
// call this ONLY if hr_unknown_platform_type() returns false
int hr_class(HOST& host, int hr_type) {
switch (hr_type) {
case 1:
return os(host) + cpu_fine(host);
case 2:
switch (os(host)) {
case Windows:
case Linux:
return os(host);
case Darwin:
return os(host) + cpu_coarse(host);
}
}
return 0;
}
bool hr_unknown_platform_type(HOST& host, int hr_type) {
switch (hr_type) {
case 1:
if (os(host) == noos) return true;
if (cpu_fine(host) == nocpu) return true;
return false;
case 2:
switch (os(host)) {
case Windows:
case Linux:
return false;
case Darwin:
switch(cpu_coarse(host)) {
case Intel:
case Macintosh:
return false;
}
return true;
}
return true;
}
return false;
}
void HR_INFO::write_file(const char* filename) {
int i, j;
FILE* f = fopen(filename, "w");
for (i=1; i<HR_NTYPES; i++) {
fprintf(f, "--------- %s ----------\n", hr_names[i]);
for (j=0; j<hr_nclasses[i]; j++) {
fprintf(f, "%d %f\n", j, rac_per_class[i][j]);
}
}
fclose(f);
}
void HR_INFO::read_file(const char* filename) {
char buf[256];
FILE* f = fopen(filename, "r");
int i, j, jj;
double x;
for (i=1; i<HR_NTYPES; i++) {
fgets(buf, sizeof(buf), f);
for (j=0; j<hr_nclasses[i]; j++) {
int n = fscanf(f, "%d %lf", &jj, &x);
if (n!=2 || j!=jj) {
fprintf(stderr, "huh?? %d != %d\n", j, jj);
exit(1);
}
rac_per_class[i][j] = x;
}
}
fclose(f);
}
void HR_INFO::scan_db() {
DB_HOST host;
int retval;
int i;
for (i=1; i<HR_NTYPES; i++) {
rac_per_class[i] = (double*) calloc(hr_nclasses[i], sizeof(double));
}
while (1) {
retval = host.enumerate("where expavg_credit>1");
if (retval) break;
printf("host %d: %s | %s | %s\n", host.id, host.os_name, host.p_vendor, host.p_model);
for (i=1; i<HR_NTYPES; i++) {
if (hr_unknown_platform_type(host, i)) {
printf("type %d: unknown\n", i);
continue;
}
int hrc = hr_class(host, i);
printf("type %d: class %d\n", i, hrc);
if (!hrc) continue;
rac_per_class[i][hrc] += host.expavg_credit;
}
}
if (retval != ERR_DB_NOT_FOUND) {
fprintf(stderr, "host enum: %d", retval);
exit(1);
}
}
const char* hr_names[HR_NTYPES] = {"", "fine", "coarse"};
int hr_nclasses[HR_NTYPES] = {0, 768, 768};

34
sched/hr.h Normal file
View File

@ -0,0 +1,34 @@
// Berkeley Open Infrastructure for Network Computing
// http://boinc.berkeley.edu
// Copyright (C) 2007 University of California
//
// This 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 2.1 of the License, or (at your option) any later version.
//
// This software is distributed in the hope that it will be useful,
// 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.
//
// To view the GNU Lesser General Public License visit
// http://www.gnu.org/copyleft/lesser.html
// or write to the Free Software Foundation, Inc.,
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#include "boinc_db.h"
#define HR_NTYPES 3
struct HR_INFO {
double *rac_per_class[HR_NTYPES];
void write_file(const char*);
void read_file(const char*);
void scan_db();
};
extern int hr_class(HOST&, int hr_type);
extern bool hr_unknown_platform_type(HOST&, int hr_type);
extern const char* hr_names[];
extern int hr_nclasses[];

View File

@ -238,7 +238,6 @@ int main(int argc, char** argv) {
FILE* fin, *fout;
int i, retval;
char req_path[256], reply_path[256], path[256];
SCHED_SHMEM* ssp=0;
unsigned int counter=0;
char* code_sign_key;
int length=-1;

View File

@ -40,6 +40,7 @@ int write_error(char* p) {
f = fopen("../sample_results/errors", "a");
if (!f) return ERR_FOPEN;
}
fprintf(f, "%s", p);
fflush(f);
return 0;
}
@ -58,7 +59,7 @@ int assimilate_handler(
vector<string> output_file_paths;
char copy_path[256];
get_output_file_paths(canonical_result, output_file_paths);
int n = output_file_paths.size();
unsigned int n = output_file_paths.size();
for (i=0; i<n; i++) {
string path = output_file_paths[i];
if (n==1) {

View File

@ -54,7 +54,7 @@ SCHED_CONFIG config;
//
int make_job() {
DB_WORKUNIT wu;
char name[256], path[256], buf[256];
char name[256], path[256];
const char* infiles[1];
int retval;

View File

@ -212,7 +212,7 @@ void scan_work_array(
}
}
if (hr_type(*app)) {
if (app_hr_type(*app)) {
if (already_sent_to_different_platform_careful(
sreq, reply.wreq, wu_result.workunit, *app
)) {

View File

@ -30,6 +30,7 @@
#include "sched_config.h"
#include "sched_msgs.h"
#include "main.h"
#include "hr.h"
#include "sched_hr.h"
@ -39,146 +40,12 @@
#define FCGI_ToFILE(x) (x)
#endif
const int nocpu = 1;
const int Intel = 2;
const int AMD = 3;
const int Macintosh = 4;
const int AMDAthlon = 5;
const int AMDDuron = 6;
const int AMDSempron = 7;
const int AMDOpteron = 8;
const int AMDAthlon64 = 9;
const int AMDAthlonXP = 10;
const int IntelXeon = 11;
const int IntelCeleron = 12;
const int IntelPentium = 13;
const int IntelPentiumII = 14;
const int IntelPentiumIII = 15;
const int IntelPentium4 = 16;
const int IntelPentiumD = 17;
const int IntelPentiumM = 18;
const int AMDAthlonMP = 19;
const int AMDTurion = 20;
const int IntelCore2 = 21;
const int noos = 128;
const int Linux = 256;
const int Windows = 384;
const int Darwin = 512;
const int freebsd = 640;
inline int os(HOST& host){
if (strcasestr(host.os_name, "Linux")) return Linux;
else if (strcasestr(host.os_name, "Windows")) return Windows;
else if (strcasestr(host.os_name, "Darwin")) return Darwin;
else if (strcasestr(host.os_name, "FreeBSD")) return freebsd;
else return noos;
};
inline int cpu_coarse(HOST& host){
if (strcasestr(host.p_vendor, "Intel")) return Intel;
if (strcasestr(host.p_vendor, "AMD")) return AMD;
if (strcasestr(host.p_vendor, "Macintosh")) return Macintosh;
return nocpu;
}
inline int cpu_fine(HOST& host){
if (strcasestr(host.p_vendor, "Intel")) {
if (strcasestr(host.p_model, "Xeon")) return IntelXeon;
if (strcasestr(host.p_model, "Celeron")) {
if (strcasestr(host.p_model, " M ")) return IntelPentiumM;
if (strcasestr(host.p_model, " D ")) return IntelPentiumD;
if (strcasestr(host.p_model, "III")) return IntelPentiumIII;
return IntelCeleron;
}
if (strcasestr(host.p_model, "Core")) return IntelCore2;
if (strcasestr(host.p_model, "Pentium")) {
if (strcasestr(host.p_model, "III")) return IntelPentiumIII;
if (strcasestr(host.p_model, "II")) return IntelPentiumII;
if (strcasestr(host.p_model, " 4 ")) return IntelPentium4;
if (strcasestr(host.p_model, " D ")) return IntelPentiumD;
if (strcasestr(host.p_model, " M ")) return IntelPentiumM;
return IntelPentium;
}
if (strcasestr(host.p_model, "x86")) {
if (strcasestr(host.p_model, "Family 6 Model 6")) return IntelCeleron;
if (strcasestr(host.p_model, "Family 6 Model 9")) return IntelPentiumM;
if (strcasestr(host.p_model, "Family 6 Model 10")) return IntelXeon;
if (strcasestr(host.p_model, "Family 5 Model 1")) return IntelPentium;
if (strcasestr(host.p_model, "Family 5 Model 2")) return IntelPentium;
if (strcasestr(host.p_model, "Family 6 Model 1")) return IntelPentium;
if (strcasestr(host.p_model, "Family 15 Model 1")) return IntelPentium4;
if (strcasestr(host.p_model, "Family 15 Model 2")) return IntelPentium4;
if (strcasestr(host.p_model, "Family 6 Model 7")) return IntelPentiumIII;
if (strcasestr(host.p_model, "Family 6 Model 8" )) return IntelPentiumIII;
if (strcasestr(host.p_model, "Family 6 Model 11")) return IntelPentiumIII;
if (strcasestr(host.p_model, "Family 6 Model 3")) return IntelPentiumII;
if (strcasestr(host.p_model, "Family 6 Model 5")) return IntelPentiumII;
}
return Intel;
}
if (strcasestr(host.p_vendor, "AMD")) {
if (strcasestr(host.p_model, "Duron")) return AMDDuron;
if (strcasestr(host.p_model, "Opteron")) return AMDOpteron;
if (strcasestr(host.p_model, "Sempron")) return AMDSempron;
if (strcasestr(host.p_model, "Turion")) return AMDTurion;
if (strcasestr(host.p_model, "Athlon")) {
if (strcasestr(host.p_model, "XP")) return AMDAthlonXP;
if (strcasestr(host.p_model, "MP")) return AMDAthlonMP;
if (strcasestr(host.p_model, "64")) return AMDAthlon64;
return AMDAthlon;
}
return AMD;
}
if (strcasestr(host.p_vendor, "Macintosh")) return Macintosh;
return nocpu;
};
int hr_class(HOST& host, APP& app) {
switch (hr_type(app)) {
case 1:
return os(host) + cpu_fine(host);
case 2:
switch (os(host)) {
case Windows:
case Linux:
return os(host);
case Darwin:
return os(host) + cpu_coarse(host);
}
}
}
static bool hr_unknown_platform_app(HOST& host, APP& app) {
switch (hr_type(app)) {
case 1:
if (os(host) == noos) return true;
if (cpu_fine(host) == nocpu) return true;
return false;
case 2:
switch (os(host)) {
case Windows:
case Linux:
case Darwin:
switch(cpu_coarse(host)) {
case Intel:
case Macintosh:
return false;
}
return true;
}
return true;
}
return false;
}
// return true if HR rules out sending any work to this host
//
bool hr_unknown_platform(HOST& host) {
for (int i=0; i<ssp->napps; i++) {
APP& app = ssp->apps[i];
if (!hr_unknown_platform_app(host, app)) return false;
if (!hr_unknown_platform_type(host, app_hr_type(app))) return false;
}
return true;
}
@ -188,7 +55,7 @@ bool hr_unknown_platform(HOST& host) {
bool already_sent_to_different_platform_quick(
SCHEDULER_REQUEST& sreq, WORKUNIT& wu, APP& app
) {
if (wu.hr_class && (hr_class(sreq.host, app) != wu.hr_class)) {
if (wu.hr_class && (hr_class(sreq.host, app_hr_type(app)) != wu.hr_class)) {
return true;
}
return false;
@ -223,7 +90,7 @@ bool already_sent_to_different_platform_careful(
return true;
}
wreq.hr_reject_temp = false;
int host_hr_class = hr_class(sreq.host, app);
int host_hr_class = hr_class(sreq.host, app_hr_type(app));
if (wu_hr_class) {
if (host_hr_class != wu_hr_class) {
wreq.hr_reject_temp = true;

View File

@ -27,12 +27,10 @@ extern bool already_sent_to_different_platform_careful(
extern bool hr_unknown_platform(HOST&);
extern int hr_class(HOST&, APP&);
// return the HR type to use for this app;
// app-specific HR type overrides global HR type
//
inline int hr_type(APP& app) {
inline int app_hr_type(APP& app) {
if (app.homogeneous_redundancy) {
return app.homogeneous_redundancy;
}

View File

@ -44,6 +44,7 @@ using namespace std;
#include "sched_array.h"
#include "sched_msgs.h"
#include "sched_hr.h"
#include "hr.h"
#include "sched_locality.h"
#include "sched_timezone.h"
@ -306,7 +307,7 @@ static int get_host_info(SCHEDULER_REPLY& reply) {
// If they have, then only send work for the allowed applications
//
static inline int check_app_filter(
WORKUNIT& wu, SCHEDULER_REQUEST& request, SCHEDULER_REPLY& reply
WORKUNIT& wu, SCHEDULER_REQUEST& , SCHEDULER_REPLY& reply
) {
unsigned int i;
@ -379,7 +380,7 @@ static inline int check_memory(
}
static inline int check_disk(
WORKUNIT& wu, SCHEDULER_REQUEST& request, SCHEDULER_REPLY& reply
WORKUNIT& wu, SCHEDULER_REQUEST& , SCHEDULER_REPLY& reply
) {
if (wu.rsc_disk_bound > reply.wreq.disk_available) {
reply.wreq.insufficient_disk = true;
@ -435,7 +436,7 @@ int wu_is_infeasible(
log_messages.printf(
SCHED_MSG_LOG::MSG_DEBUG,
"[HOST#%d] [WU#%d %s] failed quick HR check: WU is class %d, host is class %d\n",
reply.host.id, wu.id, wu.name, wu.hr_class, hr_class(request.host, *app)
reply.host.id, wu.id, wu.name, wu.hr_class, hr_class(request.host, app_hr_type(*app))
);
return INFEASIBLE_HR;
}
@ -577,7 +578,7 @@ bool app_core_compatible(WORK_REQ& wreq, APP_VERSION& av) {
// Add the app and app_version to the reply also.
//
int add_wu_to_reply(
WORKUNIT& wu, SCHEDULER_REPLY& reply, PLATFORM_LIST& platforms,
WORKUNIT& wu, SCHEDULER_REPLY& reply, PLATFORM_LIST& ,
APP* app, APP_VERSION* avp
) {
int retval;

View File

@ -444,7 +444,7 @@ SCHEDULER_REPLY::~SCHEDULER_REPLY() {
}
int SCHEDULER_REPLY::write(FILE* fout) {
unsigned int i, j;
unsigned int i;
char buf[LARGE_BLOB_SIZE];
// Note: at one point we had

View File

@ -493,7 +493,12 @@ int handle_wu(
}
}
} else if ( wu_item.assimilate_state == ASSIMILATE_DONE ) {
log_messages.printf(SCHED_MSG_LOG::MSG_DEBUG, "[WU#%d %s] not checking for items to be ready for delete because the deferred delete time has not expired. That will occur in %d seconds\n", wu_item.id, wu_item.name, most_recently_returned + config.delete_delay_hours*60*60-now);
log_messages.printf(SCHED_MSG_LOG::MSG_DEBUG,
"[WU#%d %s] not checking for items to be ready for delete because the deferred delete time has not expired. That will occur in %d seconds\n",
wu_item.id,
wu_item.name,
most_recently_returned + config.delete_delay_hours*60*60-(int)now
);
}
// compute next transition time = minimum timeout of in-progress results

View File

@ -215,14 +215,14 @@ int is_valid(RESULT& result, WORKUNIT& wu) {
if (retval) {
log_messages.printf(
SCHED_MSG_LOG::MSG_CRITICAL,
"[RESULT#%d] Warning: credited_job insert failed (userid: %d workunit: %d err: %d)\n",
result.id, user.id, long(wu.opaque), retval
"[RESULT#%d] Warning: credited_job insert failed (userid: %d workunit: %f err: %d)\n",
result.id, user.id, wu.opaque, retval
);
} else {
log_messages.printf(
SCHED_MSG_LOG::MSG_DEBUG,
"[RESULT#%d %s] added credited_job record [WU#%d OPAQUE#%d USER#%d]\n",
result.id, result.name, wu.id, long(wu.opaque), user.id
"[RESULT#%d %s] added credited_job record [WU#%d OPAQUE#%f USER#%d]\n",
result.id, result.name, wu.id, wu.opaque, user.id
);
}
}