diff --git a/checkin_notes b/checkin_notes index a8c82fd29c..aa4d9fe2d2 100755 --- a/checkin_notes +++ b/checkin_notes @@ -2189,3 +2189,10 @@ David Oct 15 2002 tools/ backend_lib.C create_work.C + +David Oct 18, 2002 + - make_work now adds new WUs as well as results + + sched/ + feeder.C + make_work.C diff --git a/sched/feeder.C b/sched/feeder.C index 15ffb73b70..8ee7e0294a 100644 --- a/sched/feeder.C +++ b/sched/feeder.C @@ -146,7 +146,7 @@ void feeder_loop(SCHED_SHMEM* ssp) { printf("feeder: adding result %d in slot %d\n", result.id, i); retval = db_workunit(result.workunitid, wu); if (retval) { - printf("feeder: can't read workunit %d\n", result.workunitid); + printf("feeder: can't read workunit %d: %d\n", result.workunitid, result); continue; } ssp->wu_results[i].result = result; diff --git a/sched/make_work.C b/sched/make_work.C index 157b2ed30c..378b290eb6 100644 --- a/sched/make_work.C +++ b/sched/make_work.C @@ -1,8 +1,14 @@ // make_work.C // -// make_work -wu_name name -result_template filename [ -cushion n ] +// make_work +// -wu_name name +// -result_template filename +// [ -redundancy n ] +// [ -cushion n ] // -// Create result records as needed to maintain a pool to send +// Create WU and result records as needed to maintain a pool of work. +// Makes a new WU for every "redundancy" results. +// Clones the WU of the given name. // #include @@ -19,6 +25,7 @@ #define TRIGGER_FILENAME "stop_server" int cushion = 10; +int redundancy = 10; char wu_name[256], result_template_file[256]; void check_trigger() { @@ -29,7 +36,7 @@ void check_trigger() { void make_work() { CONFIG config; - int retval, i, start_time=time(0), n; + int retval, i, start_time=time(0), n, nresults_left; char keypath[256], suffix[256]; R_RSA_PRIVATE_KEY key; WORKUNIT wu; @@ -60,6 +67,7 @@ void make_work() { exit(1); } + nresults_left = 0; while (true) { fflush(stdout); retval = db_result_count_state(RESULT_STATE_UNSENT, n); @@ -73,12 +81,21 @@ void make_work() { continue; } + if (nresults_left == 0) { + nresults_left = redundancy; + sprintf(wu.name, "wu_%d_%d", start_time, i++); + wu.id = 0; + wu.create_time = time(0); + retval = db_workunit_new(wu); + wu.id = db_insert_id(); + } sprintf(suffix, "%d_%d", start_time, i++); create_result( wu, result_template_file, suffix, key, config.upload_url, config.download_url ); printf("make_work: added a result\n"); + nresults_left--; } }