diff --git a/checkin_notes b/checkin_notes index 81c5908e43..4c16d44f4a 100644 --- a/checkin_notes +++ b/checkin_notes @@ -3969,3 +3969,34 @@ David 1 Jun 2010 sched_send.cpp sched_types.cpp,h sched_version.cpp + +David 1 Jun 2010 + - back end: change "daily result quota" mechanism. + Old: config.xml specifies an initial daily quota (say, 100). + Each host_app_version starts out with this quota. + On the return of a SUCCESS result, + the quota is doubled, up to the initial value. + On the return of an error result, or a timeout, + the quota is decremented down to 1. + Problem: + Doesn't accommodate hosts that can do more than 100 jobs/day. + New: similar, but + - on validation of a job, daily quota is incremented. + - on invalidation of a job, daily quota is decremented. + - on return of an error result, or a timeout, + daily quota is min'd with initial quota, then decremented. + Notes: + - This allows a host to have an unboundedly large quota + as long as it continues to return more valid + than invalid results. + - Even with this change, hosts that return SUCCESS but + invalid results will continue to get the initial daily quota. + It would be desirable to reduce their quota to 1. + + db/ + boinc_db.cpp + sched/ + sched_result.cpp + sched_send.cpp + transitioner.cpp + validator.cpp diff --git a/db/boinc_db.cpp b/db/boinc_db.cpp index 3c8619178f..24bcb217a4 100644 --- a/db/boinc_db.cpp +++ b/db/boinc_db.cpp @@ -1111,6 +1111,7 @@ int DB_HOST_APP_VERSION::update_validator(DB_HOST_APP_VERSION& orig) { && turnaround.q == orig.turnaround.q && turnaround.var == orig.turnaround.var && consecutive_valid == orig.consecutive_valid + && max_jobs_per_day == orig.max_jobs_per_day ) { return 0; } @@ -1125,7 +1126,8 @@ int DB_HOST_APP_VERSION::update_validator(DB_HOST_APP_VERSION& orig) { "turnaround_avg=%.15e, " "turnaround_q=%.15e, " "turnaround_var=%.15e, " - "consecutive_valid=%d ", + "consecutive_valid=%d, " + "max_jobs_per_day=%d ", pfc.n, pfc.avg, et.n, @@ -1136,7 +1138,8 @@ int DB_HOST_APP_VERSION::update_validator(DB_HOST_APP_VERSION& orig) { turnaround.avg, turnaround.q, turnaround.var, - consecutive_valid + consecutive_valid, + max_jobs_per_day ); sprintf(clause, "host_id=%d and app_version_id=%d ", diff --git a/sched/sched_result.cpp b/sched/sched_result.cpp index 37907ffe32..073c5406fb 100644 --- a/sched/sched_result.cpp +++ b/sched/sched_result.cpp @@ -29,6 +29,8 @@ #include "sched_result.h" +// got a SUCCESS result. Doesn't mean it's valid! +// static inline void got_good_result(SCHED_RESULT_ITEM& sri) { int gavid = generalized_app_version_id(sri.app_version_id, sri.appid); DB_HOST_APP_VERSION* havp = gavid_to_havp(gavid); @@ -40,9 +42,11 @@ static inline void got_good_result(SCHED_RESULT_ITEM& sri) { } return; } - havp->max_jobs_per_day *= 2; - if (havp->max_jobs_per_day > config.daily_result_quota) { - havp->max_jobs_per_day = config.daily_result_quota; + if (havp->max_jobs_per_day < config.daily_result_quota) { + havp->max_jobs_per_day *= 2; + if (havp->max_jobs_per_day > config.daily_result_quota) { + havp->max_jobs_per_day = config.daily_result_quota; + } } } @@ -58,17 +62,14 @@ static inline void got_bad_result(SCHED_RESULT_ITEM& sri) { return; } - // if job was aborted (possibly by client scheduler) don't penalize - // - if (sri.client_state != RESULT_ABORTED) { - havp->max_jobs_per_day -= 1; - if (havp->max_jobs_per_day < 1) { - havp->max_jobs_per_day = 1; - } + if (havp->max_jobs_per_day > config.daily_result_quota) { + havp->max_jobs_per_day = config.daily_result_quota; + } + havp->max_jobs_per_day -= 1; + if (havp->max_jobs_per_day < 1) { + havp->max_jobs_per_day = 1; } - // but clear consecutive valid regardless - // havp->consecutive_valid = 0; } diff --git a/sched/sched_send.cpp b/sched/sched_send.cpp index f9c4b21d13..5fc60b373d 100644 --- a/sched/sched_send.cpp +++ b/sched/sched_send.cpp @@ -390,7 +390,7 @@ static void set_trust(DB_HOST_APP_VERSION& hav) { static void update_quota(DB_HOST_APP_VERSION& hav) { if (config.daily_result_quota) { - if (hav.max_jobs_per_day == 0 || hav.max_jobs_per_day > config.daily_result_quota) { + if (hav.max_jobs_per_day == 0) { hav.max_jobs_per_day = config.daily_result_quota; if (config.debug_send) { log_messages.printf(MSG_NORMAL, diff --git a/sched/transitioner.cpp b/sched/transitioner.cpp index 1cb15e344b..1d7431a0c2 100644 --- a/sched/transitioner.cpp +++ b/sched/transitioner.cpp @@ -98,7 +98,10 @@ static int result_timed_out( (double)wu_item.delay_bound, HAV_AVG_THRESH, HAV_AVG_WEIGHT, HAV_AVG_LIMIT ); - if (hav.max_jobs_per_day == 0 || hav.max_jobs_per_day > config.daily_result_quota) { + if (hav.max_jobs_per_day == 0) { + hav.max_jobs_per_day = config.daily_result_quota; + } + if (hav.max_jobs_per_day > config.daily_result_quota) { hav.max_jobs_per_day = config.daily_result_quota; } hav.max_jobs_per_day -= 1; diff --git a/sched/validator.cpp b/sched/validator.cpp index 7d5da49168..e6fcb72e53 100644 --- a/sched/validator.cpp +++ b/sched/validator.cpp @@ -99,6 +99,10 @@ int is_valid(DB_HOST& host, RESULT& result, WORKUNIT& wu, DB_HOST_APP_VERSION& h double turnaround = result.received_time - result.sent_time; compute_avg_turnaround(host, turnaround); + // increment daily quota + // + hav.max_jobs_per_day++; + // increment consecutive_valid, but only if unreplicated // if (!is_unreplicated(wu)) { @@ -131,6 +135,9 @@ int is_valid(DB_HOST& host, RESULT& result, WORKUNIT& wu, DB_HOST_APP_VERSION& h static inline void is_invalid(DB_HOST_APP_VERSION& hav) { hav.consecutive_valid = 0; + if (hav.max_jobs_per_day > config.daily_result_quota) { + hav.max_jobs_per_day--; + } } // handle a workunit which has new results