- 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.

svn path=/trunk/boinc/; revision=21675
This commit is contained in:
David Anderson 2010-06-02 00:11:01 +00:00
parent cf7fb29227
commit 89fab4ece5
6 changed files with 61 additions and 16 deletions

View File

@ -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

View File

@ -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 ",

View File

@ -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,10 +42,12 @@ static inline void got_good_result(SCHED_RESULT_ITEM& sri) {
}
return;
}
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;
}
}
}
static inline void got_bad_result(SCHED_RESULT_ITEM& sri) {
@ -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) {
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;
}

View File

@ -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,

View File

@ -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;

View File

@ -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