mirror of https://github.com/BOINC/boinc.git
validator: add --wu_id N option for debugging single WU
This commit is contained in:
parent
226aac88c5
commit
5ad43a6509
|
@ -1750,15 +1750,27 @@ int DB_VALIDATOR_ITEM_SET::enumerate(
|
|||
) {
|
||||
int retval;
|
||||
char query[MAX_QUERY_LEN], mod_clause[256];
|
||||
char main_clause[256];
|
||||
MYSQL_ROW row;
|
||||
VALIDATOR_ITEM new_item;
|
||||
|
||||
if (!cursor.active) {
|
||||
sprintf(main_clause,
|
||||
" and wu.appid = %d and wu.need_validate > 0 ", appid
|
||||
);
|
||||
if (wu_id_modulus) {
|
||||
sprintf(mod_clause,
|
||||
" and wu.id %% %d = %d ",
|
||||
wu_id_modulus, wu_id_remainder
|
||||
);
|
||||
// terrible kludge: if rem >= mod, treat it as a WU ID
|
||||
// This is to support the --wu_id debugging feature
|
||||
//
|
||||
if (wu_id_remainder < wu_id_modulus) {
|
||||
sprintf(mod_clause,
|
||||
" and wu.id %% %d = %d ",
|
||||
wu_id_modulus, wu_id_remainder
|
||||
);
|
||||
} else {
|
||||
sprintf(mod_clause, " and wu.id = %u ", wu_id_remainder);
|
||||
strcpy(main_clause, "");
|
||||
}
|
||||
} else {
|
||||
strcpy(mod_clause, "");
|
||||
}
|
||||
|
@ -1812,10 +1824,10 @@ int DB_VALIDATOR_ITEM_SET::enumerate(
|
|||
" res.runtime_outlier "
|
||||
"FROM "
|
||||
" workunit AS wu, result AS res where wu.id = res.workunitid "
|
||||
" and wu.appid = %d and wu.need_validate > 0 %s "
|
||||
" %s %s "
|
||||
"LIMIT "
|
||||
" %d ",
|
||||
appid, mod_clause, nresult_limit
|
||||
main_clause, mod_clause, nresult_limit
|
||||
);
|
||||
|
||||
retval = db->do_query(query);
|
||||
|
|
|
@ -44,6 +44,7 @@
|
|||
// [--credit_from_runtime X] grant credit based on runtime,
|
||||
// assuming single-CPU app.
|
||||
// X is the max runtime.
|
||||
// [--wu_id n] Validate WU n (debugging)
|
||||
|
||||
#include "config.h"
|
||||
#include <unistd.h>
|
||||
|
@ -104,6 +105,7 @@ bool credit_from_runtime = false;
|
|||
double max_runtime = 0;
|
||||
bool no_credit = false;
|
||||
bool dry_run = false;
|
||||
int wu_id = 0;
|
||||
int g_argc;
|
||||
char **g_argv;
|
||||
|
||||
|
@ -700,6 +702,11 @@ bool do_validate_scan() {
|
|||
// loop over entries that need to be checked
|
||||
//
|
||||
while (1) {
|
||||
if (wu_id) {
|
||||
// kludge to tell enumerate to return a given WU
|
||||
wu_id_modulus = 1;
|
||||
wu_id_remainder = wu_id;
|
||||
}
|
||||
retval = validator.enumerate(
|
||||
app.id, SELECT_LIMIT, wu_id_modulus, wu_id_remainder,
|
||||
wu_id_min, wu_id_max, items
|
||||
|
@ -716,6 +723,7 @@ bool do_validate_scan() {
|
|||
retval = handle_wu(validator, items);
|
||||
if (!retval) found = true;
|
||||
if (++i == one_pass_N_WU) break;
|
||||
if (wu_id) break;
|
||||
}
|
||||
return found;
|
||||
}
|
||||
|
@ -780,6 +788,7 @@ int main(int argc, char** argv) {
|
|||
" --credit_from_runtime X Grant credit based on runtime (max X seconds)and estimated FLOPS\n"
|
||||
" --no_credit Don't grant credit\n"
|
||||
" --sleep_interval n Set sleep-interval to n\n"
|
||||
" --wu_id n Process WU with given ID\n"
|
||||
" -d n, --debug_level n Set log verbosity level, 1-4\n"
|
||||
" -h | --help Show this\n"
|
||||
" -v | --version Show version information\n";
|
||||
|
@ -830,6 +839,9 @@ int main(int argc, char** argv) {
|
|||
max_runtime = atof(argv[++i]);
|
||||
} else if (is_arg(argv[i], "no_credit")) {
|
||||
no_credit = true;
|
||||
} else if (is_arg(argv[i], "wu_id")) {
|
||||
wu_id = atoi(argv[++i]);
|
||||
one_pass = true;
|
||||
} else {
|
||||
//log_messages.printf(MSG_CRITICAL, "unrecognized arg: %s\n", argv[i]);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue