diff --git a/TODO b/TODO index 6ecb9d4067..b274949154 100644 --- a/TODO +++ b/TODO @@ -43,9 +43,10 @@ HIGH-PRIORITY (must be done to support SETI@home) returns a file with list of scheduler address and email address of "problems" contact -- implement and test hi/lo water mark scheme - - core client must estimate how much work it has left, - based on %done (if available) and time estimates +- complete client side and test hi/lo water mark scheme + - initialize rsc_fpops and rsc_iops in client WORKUNIT + - ensure server sends correct number of work units + - check client requests correct number of seconds of work - measure hardware parameters: CPU speed, #CPUs, memory, disk - define CPU benchmarks diff --git a/checkin_notes b/checkin_notes index 6cad78b2ce..19e6bb28ae 100755 --- a/checkin_notes +++ b/checkin_notes @@ -329,6 +329,13 @@ Eric Heien June 03, 2002 parse.h (removed, uses lib version now) Makefile.in +Michael Gary June 04, 2002 + - Added server side water level functionality, now sends as many work units + as necessary to fill the time requested. + + sched/ + handle_request.C + Eric Heien June 06, 2002 - Changes and additions made to begin porting to Windows. - This code will compile on Windows, but is not quite fully functional. @@ -352,3 +359,23 @@ Eric Heien June 06, 2002 md5.c parse.C +Michael Gary June 06, 2002 + - Added client side water level functionality. + - Added rsc_fpops and rsc_iops to the client WORKUNIT struct, bun not yet + functional since not initialized. + - Test scripts to check water level functionality, including minima and + maxima. Test scripts are based on test_prefs.php. + + client/ + client_state.h + cs_scheduler.C + client_types.h + test/ + max_water_prefs.xml + min_water_prefs.xml + normal_water_prefs.xml + test_max_water_prefs.php + test_min_water_prefs.php + test_normal_water_prefs.php + + diff --git a/client/client_state.h b/client/client_state.h index b272a1ca6b..a5ffa710d3 100644 --- a/client/client_state.h +++ b/client/client_state.h @@ -90,6 +90,8 @@ private: bool garbage_collect(); int make_scheduler_request(PROJECT*, int); void handle_scheduler_reply(PROJECT*); + double estimate_duration(WORKUNIT*); + double current_water_days(); // the following could be eliminated by using map instead of vector // diff --git a/client/client_types.h b/client/client_types.h index e64cf54856..113257e501 100644 --- a/client/client_types.h +++ b/client/client_types.h @@ -130,6 +130,8 @@ struct WORKUNIT { APP* app; APP_VERSION* avp; int ref_cnt; + double rsc_fpops; //needs to be initialized + double rsc_iops; //needs to be initialized int parse(FILE*); int write(FILE*); diff --git a/client/cs_scheduler.C b/client/cs_scheduler.C index 0661da4a31..3e30ce68f4 100644 --- a/client/cs_scheduler.C +++ b/client/cs_scheduler.C @@ -33,16 +33,30 @@ // quantities like avg CPU time decay by a factor of e every week #define EXP_DECAY_RATE (1./(3600*24*7)) -// TODO: implement hi/lo water mark scheme +//estimates amount of time a workunit will take to complete // -bool CLIENT_STATE::need_work() { - unsigned int i; +double CLIENT_STATE::estimate_duration(WORKUNIT* wup) { + return wup->rsc_fpops/host_info.p_fpops + wup->rsc_iops/host_info.p_iops; +} +//estimates the number of days of work remaining +// +double CLIENT_STATE::current_water_days() { + unsigned int i; + double seconds_remaining=0; for (i=0; iis_compute_done) return false; + if (rp->is_compute_done) continue; + if (rp->cpu_time > 0) + seconds_remaining += (estimate_duration(rp->wup) - rp->cpu_time); + else + seconds_remaining += estimate_duration(rp->wup); } - return true; + return (seconds_remaining * 86400); +} + +bool CLIENT_STATE::need_work() { + return (current_water_days() <= prefs.low_water_days); } void CLIENT_STATE::update_avg_cpu(PROJECT* p) { @@ -142,6 +156,7 @@ int CLIENT_STATE::make_scheduler_request(PROJECT* p, int work_req) { // manage the task of maintaining a supply of work. // +// todo: determine how to calculate current_water_level bool CLIENT_STATE::get_work() { PROJECT* p; int retval; @@ -158,7 +173,8 @@ bool CLIENT_STATE::get_work() { } return false; } - retval = make_scheduler_request(p, 1000); + retval = make_scheduler_request(p, + (int)(prefs.high_water_days - current_water_days())*86400); scheduler_op.init_post( p->scheduler_url, SCHED_OP_REQUEST_FILE, SCHED_OP_RESULT_FILE );