diff --git a/checkin_notes b/checkin_notes
index c1345c3a37..3204daf39c 100755
--- a/checkin_notes
+++ b/checkin_notes
@@ -2768,3 +2768,38 @@ David Dec 19 2002
win/
wingui.cpp,h
+David Dec 23 2002
+ - Made stripcharts work with BOINC test framework
+ The script "test_loop.php" now generates a data file of
+ CPU load that can be graphed using stripchart.
+ TODO: add other data sources
+ - added "country" field to team
+ - expanded team description from 256 chars to blob
+ - turned off debug output from file upload handler, scheduler
+ - removed "time" args from various Project member functions
+ in test.inc. Use sleep().
+
+ db/
+ db.h
+ db_mysql.C
+ schema.sql
+ html_user/
+ db.inc
+ team_create_form.php
+ sched/
+ file_upload_handler.C
+ handle_request.C
+ result_retry.C
+ stripchart/
+ stripchart.cgi
+ stripchart.cnf
+ samples/
+ datafiles
+ test/
+ test.inc
+ test_download_backoff.php
+ test_loop.php
+ test_masterurl_failure.php
+ test_sched_failure.php
+
+
diff --git a/db/db.h b/db/db.h
index 34a7c3bc72..0420baa52b 100644
--- a/db/db.h
+++ b/db/db.h
@@ -112,15 +112,13 @@ struct USER {
int teamid; // if user is part of a team
};
-#define TEAM_TYPE_COMPANY_SMALL 1
-#define TEAM_TYPE_COMPANY_MEDIUM 2
-#define TEAM_TYPE_COMPANY_LARGE 3
-#define TEAM_TYPE_CLUB 4
-#define TEAM_TYPE_PRIMARY 5
-#define TEAM_TYPE_SECONDARY 6
-#define TEAM_TYPE_UNIVERSITY 7
-#define TEAM_TYPE_JUNIOR_COLLEGE 8
-#define TEAM_TYPE_GOVERNMENT 9
+#define TEAM_TYPE_CLUB 1
+#define TEAM_TYPE_COMPANY 2
+#define TEAM_TYPE_PRIMARY 3
+#define TEAM_TYPE_SECONDARY 4
+#define TEAM_TYPE_JUNIOR_COLLEGE 5
+#define TEAM_TYPE_UNIVERSITY 6
+#define TEAM_TYPE_GOVERNMENT 7
struct TEAM {
int id;
@@ -130,8 +128,9 @@ struct TEAM {
char url[256];
int type; // Team type (see above)
char name_html[256];
- char description[256];
+ char description[MAX_BLOB_SIZE];
int nusers;
+ char country[256];
};
struct HOST {
diff --git a/db/db_mysql.C b/db/db_mysql.C
index 3d49b7434e..d70a9f0cdf 100644
--- a/db/db_mysql.C
+++ b/db/db_mysql.C
@@ -146,7 +146,8 @@ void struct_to_str(void* vp, char* q, int type) {
sprintf(q,
"id=%d, userid=%d, name='%s', "
"name_lc='%s', url='%s', "
- "type=%d, name_html='%s', description='%s', nusers=%d",
+ "type=%d, name_html='%s', description='%s', nusers=%d, "
+ "country='%s'",
tp->id,
tp->userid,
tp->name,
@@ -155,7 +156,8 @@ void struct_to_str(void* vp, char* q, int type) {
tp->type,
tp->name_html,
tp->description,
- tp->nusers
+ tp->nusers,
+ tp->country
);
break;
case TYPE_HOST:
@@ -326,6 +328,7 @@ void row_to_struct(MYSQL_ROW& r, void* vp, int type) {
strcpy2(tp->name_html, r[i++]);
strcpy2(tp->description, r[i++]);
tp->nusers = atoi(r[i++]);
+ strcpy2(tp->country, r[i++]);
break;
case TYPE_HOST:
hp = (HOST*)vp;
diff --git a/db/schema.sql b/db/schema.sql
index 615e7e3a6a..8f21198e35 100644
--- a/db/schema.sql
+++ b/db/schema.sql
@@ -61,8 +61,9 @@ create table team (
url varchar(254),
type integer not null,
name_html varchar(254),
- description varchar(254),
+ description blob,
nusers integer not null,
+ country varchar(254),
total_credit double not null, /* temp */
expavg_credit double not null, /* temp */
primary key (id)
diff --git a/html/user/db.inc b/html/user/db.inc
index ab5ecda9b6..84d873147f 100644
--- a/html/user/db.inc
+++ b/html/user/db.inc
@@ -3,8 +3,6 @@
// database-related functions.
// Presentation code (HTML) shouldn't be here
-// TODO: add support for host, user, password
-
function db_init() {
$retval = mysql_pconnect();
if (!$retval) {
diff --git a/html/user/team_create_form.php b/html/user/team_create_form.php
index bc5880b44b..82e1e8ad47 100644
--- a/html/user/team_create_form.php
+++ b/html/user/team_create_form.php
@@ -27,7 +27,8 @@ You'll become the founding member of the team.
Team name (text version)
- This name will be printed as-is and is the name
+ This name will be printed as text.
+It's the name
you should use when searching for your Team.
@@ -52,26 +53,31 @@ If you don't know HTML, just leave this box blank.
Type of team:
-Club
+ Club
-Small Company (< 50 employees)
+ Company
-Medium Company (50-1000 employees)
+ Primary School
-Large Company (> 1000 employees)
+ Secondary School
-Primary School
+ Junior College
-Secondary School
+ University or Department
-Junior College
-
-University or Department
-
-Government Agency
-
+ Government Agency
+
+
Country
+
+
+
diff --git a/sched/file_upload_handler.C b/sched/file_upload_handler.C
index 762e2ed215..ada51a5874 100644
--- a/sched/file_upload_handler.C
+++ b/sched/file_upload_handler.C
@@ -34,7 +34,7 @@
CONFIG config;
-#define DEBUG
+//#define DEBUG
#define MAX_FILES 32
diff --git a/sched/handle_request.C b/sched/handle_request.C
index 40ec87a065..928c12fcc6 100644
--- a/sched/handle_request.C
+++ b/sched/handle_request.C
@@ -425,10 +425,12 @@ int send_work(
);
if (retval) continue;
+#if 0
fprintf(stderr,
"BOINC scheduler: sending result name %s, id %d\n",
result.name, result.id
);
+#endif
// copy the result so we don't overwrite its XML fields
//
diff --git a/sched/result_retry.C b/sched/result_retry.C
index c4044b3a9b..a472433deb 100644
--- a/sched/result_retry.C
+++ b/sched/result_retry.C
@@ -257,7 +257,7 @@ update_wu:
return did_something;
}
-void main_loop() {
+void main_loop(bool one_pass) {
APP app;
bool did_something;
int retval;
@@ -277,6 +277,7 @@ void main_loop() {
while (1) {
did_something = do_pass(app);
+ if (one_pass) break;
if (!did_something) sleep(1);
check_trigger();
}
@@ -284,7 +285,7 @@ void main_loop() {
int main(int argc, char** argv) {
int i, retval;
- bool asynch = false;
+ bool asynch = false, one_pass=false;
char path[256];
retval = config.parse_file();
@@ -310,6 +311,8 @@ int main(int argc, char** argv) {
max_done = atoi(argv[++i]);
} else if (!strcmp(argv[i], "-asynch")) {
asynch = true;
+ } else if (!strcmp(argv[i], "-one_pass")) {
+ one_pass = true;
} else if (!strcmp(argv[i], "-nredundancy")) {
nredundancy = atoi(argv[++i]);;
}
@@ -319,5 +322,5 @@ int main(int argc, char** argv) {
exit(0);
}
}
- main_loop();
+ main_loop(one_pass);
}
diff --git a/stripchart/samples/datafiles b/stripchart/samples/datafiles
index 565b9ccc88..e1d4e29dc6 100644
--- a/stripchart/samples/datafiles
+++ b/stripchart/samples/datafiles
@@ -1,5 +1,5 @@
# This is the list of data sources for stripchart, in the colon-delimited format:
-# full path to data file:title for the graph:column number in the data file:flags to stripchart
+# path to data file:title for the graph:column number in the data file:flags to stripchart
#
# examples:
# /disks/matt/data_files/connections:connection drops:3
@@ -8,4 +8,4 @@
# To put in a horizontal rule for ease of selection, use the line:
# x:----------------------------------:x
#
-/disks/matt/data_files/get_load:machine load:3
+get_load_out:machine load:3
diff --git a/stripchart/stripchart.cgi b/stripchart/stripchart.cgi
index 7a570eaafc..03a6190c68 100755
--- a/stripchart/stripchart.cgi
+++ b/stripchart/stripchart.cgi
@@ -124,7 +124,7 @@ sub to_unix_time {
if ($query->param("flags") ne "") {
$flags = $query->param("flags");
$outfile = "/tmp/tempout$$" . "." . rand(100000);
- print "Content-type: image/gif\n\n";
+ print "Pragma: nocache\nCache-Control: no-cache\nContent-type: image/gif\n\n";
`$stripchartexe $flags > $outfile`;
open (OUTFILE,"$outfile");
while ($dummy=read(OUTFILE,$buffer,1024)) { print $buffer }
diff --git a/stripchart/stripchart.cnf b/stripchart/stripchart.cnf
index 1213ad86a0..cb606b3cd8 100644
--- a/stripchart/stripchart.cnf
+++ b/stripchart/stripchart.cnf
@@ -5,9 +5,10 @@ use Time::Local;
# What version is this?
$majorversion = 2; $minorversion = 1;
-# Where is gnuplot located?
+# Directory where gnuplot is
# $gnuplot = "/usr/local/gnuplot-3.7";
-$gnuplot = "/disks/asimov/a/users/hiramc/local/src/gnuplot-3.7";
+#$gnuplot = "/disks/asimov/a/users/hiramc/local/src/gnuplot-3.7";
+$gnuplot = "/usr/local/bin"
# Temporary files
$suffix = rand(10000);
@@ -29,9 +30,9 @@ $plotheight = 180;
@monthabbs = ("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec");
# Where are these unix commands located?
-$tailexe = "/usr/ucb/tail";
-$catexe = "/usr/bin/cat";
-$grepexe = "/usr/bin/grep";
+$tailexe = "tail";
+$catexe = "cat";
+$grepexe = "grep";
# How many seconds in a day?
$daysecs = 86400;
@@ -51,11 +52,11 @@ $defaultflags = "-s";
# Where is the list of datafiles for stripchart.cgi?
# Note: there is a sample copy in the samples directory:
-$datafilelist = "/disks/jill/a/inet_services/www/share/cgi-bin/lib/datafiles";
+$datafilelist = "datafiles";
# Where is the list of user-definied cgi queries?
# Note: this file gets created by the cgi - must put it somewhere that the cgi user can write to
-$queryfilelist = "/disks/jill/a/inet_services/www/share/cgi-bin/lib/querylist";
+$queryfilelist = "querylist";
# What time is it right now?
$rightnow = time;
diff --git a/test/test.inc b/test/test.inc
index 97addcd589..58c1e8aa71 100644
--- a/test/test.inc
+++ b/test/test.inc
@@ -105,6 +105,7 @@ class Project {
var $user_name;
var $master_url;
var $resource_share;
+ var $source_dir;
function Project() {
$this->name = "test";
@@ -116,6 +117,7 @@ class Project {
$this->generate_keys = false;
$this->shmem_key = get_env_var("BOINC_SHMEM_KEY");
$this->resource_share = 1;
+ $this->source_dir = get_env_var("BOINC_SRC_DIR");
}
function add_user($user) {
@@ -137,8 +139,8 @@ class Project {
// Set up the database and directory structures for a project
//
function Install($scheduler_file = null) {
+ $source_dir = $this->source_dir;
$base_dir = get_env_var("BOINC_PROJECTS_DIR");
- $source_dir = get_env_var("BOINC_SRC_DIR");
$cgi_url = get_env_var("BOINC_CGI_URL")."/".$this->name;
$this->download_url = get_env_var("BOINC_HTML_URL")."/".$this->name."/download";
//link download1...downloadn to download. Get this from reading the reading how many s in the template. For uploads
@@ -242,7 +244,6 @@ class Project {
}
PassThru("cp $source_dir/sched/cgi $this->project_dir/cgi/");
- // would have to be able to add more of these, copy several to cgi dir
PassThru("cp $source_dir/sched/file_upload_handler $this->project_dir/cgi/");
PassThru("cp $source_dir/sched/make_work $this->project_dir/cgi/");
PassThru("cp $source_dir/sched/feeder $this->project_dir/cgi/");
@@ -250,7 +251,6 @@ class Project {
PassThru("cp $source_dir/sched/validate_test $this->project_dir/cgi/");
PassThru("cp $source_dir/sched/file_deleter $this->project_dir/cgi/");
PassThru("cp $source_dir/sched/assimilator $this->project_dir/cgi/");
- PassThru("cp $source_dir/html_ops/stripchart.cgi $this->project_dir/cgi/");
$f = fopen("$this->project_dir/cgi/config.xml", "w");
fputs($f, "\n");
fputs($f, " $this->db_name\n");
@@ -299,115 +299,69 @@ class Project {
echo "The admin URL for project $this->name is $admin_url\n";
}
- // moves the masterindex file to temp after $time seconds (if not null).
+ // moves the masterindex file to temp
// This is used to test exponential backoff on the client side.
//
- function delete_masterindex($time=null) {
- if($time != null) {
- echo "\nsleeping for $time seconds";
- PassThru("sleep $time");
- }
+ function delete_masterindex() {
PassThru("mv $this->project_dir/html_user/index.php $this->project_dir/html_user/temp");
}
- // moves temp back to the masterindex after $time seconds(if not null).
+ // moves temp back to the masterindex
// This is used to test exponential backoff on the client side.
//
- function reestablish_masterindex($time=null) {
- if($time != null) {
- echo "\nsleeping for $time seconds";
- PassThru("sleep $time");
- }
+ function reestablish_masterindex() {
PassThru("mv $this->project_dir/html_user/temp $this->project_dir/html_user/index.php");
}
- // delete the cgi file for this project after $time if not null.
+ // delete the cgi file for this project
// This is used to test exponential backoff on the client side.
//
- function delete_scheduler($time=null,$cgi_num = null) {
- if($time != null) {
- echo "\nsleeping for $time seconds";
- PassThru("sleep $time");
- }
+ function delete_scheduler($cgi_num = null) {
PassThru("rm $this->project_dir/cgi/cgi$cgi_num");
}
// copies the cgi file back into the cgi directory.
// This is used to test exponential backoff on the client side.
//
- function reinstall_scheduler($time=null,$cgi_num=null) {
- $source_dir = get_env_var("BOINC_SRC_DIR");
- if($time != null) {
- echo "\nsleeping for $time seconds";
- PassThru("sleep $time");
- }
- PassThru("cp $source_dir/sched/cgi $this->project_dir/cgi/cgi$cgi_num");
+ function reinstall_scheduler($cgi_num=null) {
+ PassThru("cp $this->source_dir/sched/cgi $this->project_dir/cgi/cgi$cgi_num");
}
// moves the download directory to temp.
- // This is used to test exponential backoff on the client side.
+ // This is used to test exponential backoff
//
- function delete_downloaddir($time = null,$download_dir_num = null) {
- if($time != null) {
- echo "\nsleeping for $time seconds";
- PassThru("sleep $time");
- }
+ function delete_downloaddir($download_dir_num = null) {
PassThru("mv $this->project_dir/download$download_dir_num $this->project_dir/download_moved$download_dir_num");
}
// reinstalls the download directory.
- // This is used to test exponential backoff on the client side.
+ // This is used to test exponential backoff
//
- function reinstall_downloaddir($time = null ,$download_dir_num = null) {
- if($time != null) {
- echo "\nsleeping for $time seconds";
- PassThru("sleep $time");
- }
+ function reinstall_downloaddir($download_dir_num = null) {
PassThru("mv $this->project_dir/download_moved$download_dir_num $this->project_dir/download$download_dir_num");
}
- function remove_file_upload_handler($time = null,$handler_num = null) {
- if($time != null) {
- echo "\nsleeping for $time seconds";
- PassThru("sleep $time");
- }
+ function remove_file_upload_handler($handler_num = null) {
PassThru("rm $this->project_dir/cgi/file_upload_handler$handler_num");
}
- function reinstall_file_upload_handler($time = null,$handler_num = null) {
- $source_dir = get_env_var("BOINC_SRC_DIR");
- if($time != null) {
- echo "\nsleeping for $time seconds";
- PassThru("sleep $time");
- }
- PassThru("cp $source_dir/sched/file_upload_handler $this->project_dir/cgi/file_upload_handler$handler_num");
+ function reinstall_file_upload_handler($handler_num = null) {
+ PassThru("cp $this->source_dir/sched/file_upload_handler $this->project_dir/cgi/file_upload_handler$handler_num");
}
- // blocks until a file_upload_handler is running in the system,
- // kills it and returns
- //
- function kill_file_upload_handler() {
- while(true) {
- $pid = exec("pgrep -n file_up");
- if($pid != null) break;
- }
- PassThru("kill -9 $pid");
- }
-
function start_feeder(){
PassThru("cd $this->project_dir/cgi; ./feeder -asynch > feeder_out");
}
function result_retry($app, $nerror = 5, $ndet = 5, $nredundancy = 5){
- PassThru("cd $this->project_dir/cgi; ./result_retry -app $app->name -nerror $nerror -ndet $ndet -nredundancy $nredundancy > result_retry_out");
+ PassThru("cd $this->project_dir/cgi; ./result_retry -app $app->name -nerror $nerror -ndet $ndet -nredundancy $nredundancy > result_retry_out");
}
function start_result_retry($app, $nerror = 5,$ndet = 5, $nredundancy = 5){
- PassThru("cd $this->project_dir/cgi; ./result_retry -app $app->name -nerror $nerror -ndet $ndet -nredundancy $nredundancy -asynch > result_retry_out");
+ PassThru("cd $this->project_dir/cgi; ./result_retry -app $app->name -nerror $nerror -ndet $ndet -nredundancy $nredundancy -asynch > result_retry_out");
}
-
function start_make_work($work){
$result_template_path = realpath($work->result_template);
@@ -446,6 +400,19 @@ class Project {
PassThru("cd $this->project_dir/cgi; ./assimilator -one_pass -app $app->name > assimilator_out");
}
+ // start collecting data for stripcharts
+ //
+ function start_stripchart() {
+ $source_dir = $this->source_dir;
+ PassThru("cp $source_dir/stripchart/stripchart.cgi $this->project_dir/cgi/");
+ PassThru("cp $source_dir/stripchart/stripchart $this->project_dir/cgi/");
+ PassThru("cp $source_dir/stripchart/stripchart.cnf $this->project_dir/cgi/");
+ PassThru("cp $source_dir/stripchart/samples/datafiles $this->project_dir/cgi/");
+ PassThru("cp $source_dir/stripchart/samples/get_load $this->project_dir/cgi/");
+ PassThru("cp $source_dir/stripchart/samples/get_load_loop $this->project_dir/cgi/");
+ PassThru("cd $this->project_dir/cgi; get_load_loop > get_load_out &");
+ }
+
// this should stop the feeder and any other daemons
//
function stop() {
@@ -671,7 +638,9 @@ class Work {
PassThru("cp $x $project->project_dir/download");
}
-if (false) { // doesn't belong here; needs comment
+ // simulate multiple data servers by making symbolic links
+ // to the download directory
+ //
$f = fopen($this->wu_template,"r");
while(true) {
$temp = fgets($f,1000);
@@ -686,6 +655,9 @@ if (false) { // doesn't belong here; needs comment
}
}
+ // simulate multiple data servers by making copies of
+ // the file upload handler
+ //
fclose($f);
$source_dir = get_env_var("BOINC_SRC_DIR");
$append = null;
@@ -706,8 +678,7 @@ if (false) { // doesn't belong here; needs comment
}
}
fclose($f);
-}
-
+
$cmd = "create_work -db_name $project->db_name -download_dir $project->project_dir/download -upload_url $project->upload_url -download_url $project->download_url -keyfile $project->key_dir/upload_private -appname $app->name -rsc_iops $this->rcs_iops -rsc_fpops $this->rsc_fpops -rsc_disk $this->rsc_disk -wu_template $this->wu_template -result_template $this->result_template -redundancy $this->redundancy -wu_name $this->wu_template -delay_bound $this->delay_bound";
for ($i=0; $iinput_files); $i++) {
diff --git a/test/test_download_backoff.php b/test/test_download_backoff.php
index bbef36e889..36ebf53c4c 100644
--- a/test/test_download_backoff.php
+++ b/test/test_download_backoff.php
@@ -41,11 +41,12 @@
//delete the download_dir immediately
$project->delete_downloaddir();
$pid = $host->run_asynch("-exit_when_idle");
- //reinstall download_dir after 100 seconds
- $project->reinstall_downloaddir(100,null);
+ echo "sleeping 100 secs\n";
+ sleep(100);
+ $project->reinstall_downloaddir(null);
$status = 0;
//wait until the host has stopped running
- pcntl_waitpid($pid,$status,0);
+ pcntl_waitpid($pid, $status, 0);
$project->stop();
$result->state = RESULT_STATE_DONE;
diff --git a/test/test_loop.php b/test/test_loop.php
index 647076da09..969ad57cce 100644
--- a/test/test_loop.php
+++ b/test/test_loop.php
@@ -33,6 +33,7 @@
$project->start_feeder();
$project->start_make_work($work);
$project->start_validate($app, 3);
+ $project->start_stripchart();
$host->run("");
//$project->stop();
diff --git a/test/test_masterurl_failure.php b/test/test_masterurl_failure.php
index 9790a8d443..6d0aa1f482 100644
--- a/test/test_masterurl_failure.php
+++ b/test/test_masterurl_failure.php
@@ -38,9 +38,11 @@
$work->install($project);
$project->start_feeder();
- $project->delete_masterindex(null);
+ $project->delete_masterindex();
$pid = $host->run_asynch("-exit_when_idle");
- $project->reestablish_masterindex(100);
+ echo "sleeping for 100 seconds\n";
+ sleep(100);
+ $project->reestablish_masterindex();
$status = 0;
pcntl_waitpid($pid,$status,0);
$project->stop();
diff --git a/test/test_sched_failure.php b/test/test_sched_failure.php
index 8f223d65e5..d7403c989a 100644
--- a/test/test_sched_failure.php
+++ b/test/test_sched_failure.php
@@ -38,11 +38,11 @@
$work->install($project);
$project->start_feeder();
- //delete the scheduler immediately
$project->delete_scheduler();
$pid = $host->run_asynch("-exit_when_idle");
- //reinstall scheduler after 500 seconds
- $project->reinstall_scheduler(100);
+ echo "sleeping for 100 seconds\n";
+ sleep(100);
+ $project->reinstall_scheduler();
$status = 0;
//wait until the host has stopped running
pcntl_waitpid($pid,$status,0);
diff --git a/test/test_upload_backoff.php b/test/test_upload_backoff.php
index 226af64317..4ec08aa8d5 100644
--- a/test/test_upload_backoff.php
+++ b/test/test_upload_backoff.php
@@ -38,15 +38,15 @@
$work->install($project);
$project->start_feeder();
- //delete the download_dir immediately
$project->remove_file_upload_handler();
$pid = $host->run_asynch("-exit_when_idle");
- //reinstall download_dir after 100 seconds
- $project->reinstall_file_upload_handler(20,null);
+ echo "sleeping 20 secs\n";
+ sleep(20);
+ $project->reinstall_file_upload_handler(null);
$status = 0;
//wait until the host has stopped running
- pcntl_waitpid($pid,$status,0);
+ pcntl_waitpid($pid, $status,0);
$project->stop();
$result->state = RESULT_STATE_DONE;