- show_shmem: show more stuff, and improve display

- job prioritization tweaks
This commit is contained in:
David Anderson 2013-01-11 13:39:13 -08:00 committed by Oliver Bock
parent 9bef2edbf0
commit 657c0f9730
3 changed files with 56 additions and 20 deletions

View File

@ -191,9 +191,12 @@ function submit_batch($r) {
// TODO: if rsc_fpops_est not defined here, get it from template
}
$cmd = "cd ../../bin; ./adjust_user_priority --user $user->id --flops $total_flops --app $app->name";
system($cmd);
$us = BoincUserSubmit::lookup_userid($user->id);
$let = $us->logical_start_time;
$x = system($cmd);
if (!is_numeric($x) || (double)$x == 0) {
echo <error>adjust_user_priority returned $x</error>\n";
exit;
}
$let = (double)$x;
$batch_id = BoincBatch::insert(
"(user_id, create_time, njobs, name, app_id, logical_end_time, state) values ($user->id, $now, $njobs, '$batch_name', $app->id, $let, ".BATCH_STATE_IN_PROGRESS.")"

View File

@ -15,11 +15,13 @@
// You should have received a copy of the GNU Lesser General Public License
// along with BOINC. If not, see <http://www.gnu.org/licenses/>.
// adjust_user_priority [--print] --user userid --flops flop_count --app app_name
// adjust_user_priority [--no_update] --user userid --flops flop_count --app app_name
//
// adjust user priority (i.e. logical start time)
// to reflect a certain amount of computing
// --print: don't update DB; write LST increment to stdout
// and write the new value to stdout
//
// --no_update: don't update DB
#include <stdio.h>
#include <stdlib.h>
@ -29,7 +31,7 @@
void usage(const char* msg="") {
fprintf(stderr,
"%susage: adjust_user_priority [--print] --user userid --flops flop_count --app app_name\n",
"%susage: adjust_user_priority [--no_update] --user userid --flops flop_count --app app_name\n",
msg
);
exit(1);
@ -37,14 +39,14 @@ void usage(const char* msg="") {
int main(int argc, char** argv) {
char buf[256];
bool print = false;
bool no_update = false;
int userid=0;
char* app_name = NULL;
double flop_count = 0;
for (int i=1; i<argc; i++) {
if (!strcmp(argv[i], "--print")) {
print = true;
if (!strcmp(argv[i], "--no_update")) {
no_update = true;
} else if (!strcmp(argv[i], "--user")) {
userid = atoi(argv[++i]);
} else if (!strcmp(argv[i], "--app")) {
@ -120,19 +122,19 @@ int main(int argc, char** argv) {
us, flop_count, total_quota, project_flops
);
if (print) {
printf("%f\n", delta);
} else {
double x = us.logical_start_time;
if (x < dtime()) x = dtime();
x += delta;
double x = us.logical_start_time;
if (x < dtime()) x = dtime();
x += delta;
if (!no_update) {
char set_clause[256], where_clause[256];
sprintf(set_clause, "logical_start_time=%f", x);
sprintf(where_clause, "user_id=%d", us.user_id);
retval = us.update_fields_noid(set_clause, where_clause);
if (retval) {
fprintf(stderr, "adjust_user_priority() failed: %d\n", retval);
fprintf(stderr, "update_fields_noid() failed: %d\n", retval);
exit(1);
}
}
printf("%f\n", x);
}

View File

@ -322,13 +322,44 @@ void SCHED_SHMEM::show(FILE* f) {
fprintf(f, "ready: %d\n", ready);
fprintf(f, "max_wu_results: %d\n", max_wu_results);
for (int i=0; i<max_wu_results; i++) {
if (i%24 == 0) {
fprintf(f,
"%4s %12s %10s %10s %10s %8s %10s %8s %12s %12s %9s\n",
"slot",
"app",
"WU ID",
"result ID",
"batch",
"HR class",
"priority",
"in shmem",
"size (stdev)",
"need reliable",
"inf count"
);
}
WU_RESULT& wu_result = wu_results[i];
APP* app;
const char* appname;
int delta_t;
switch(wu_result.state) {
case WR_STATE_PRESENT:
fprintf(f, "%4d: ap %d ic %d wu %d rs %u hr %d nr %d\n",
i, wu_result.workunit.appid, wu_result.infeasible_count,
wu_result.workunit.id, wu_result.resultid,
wu_result.workunit.hr_class, wu_result.need_reliable
app = lookup_app(wu_result.workunit.appid);
appname = app?app->name:"missing";
delta_t = dtime() - wu_result.time_added_to_shared_memory;
fprintf(f,
"%4d %12.12s %10d %10d %10d %8d %10d %7ds %12f %12s %9d\n",
i,
appname,
wu_result.workunit.id,
wu_result.resultid,
wu_result.workunit.batch,
wu_result.workunit.hr_class,
wu_result.res_priority,
delta_t,
wu_result.fpops_size,
wu_result.need_reliable?"yes":"no",
wu_result.infeasible_count
);
break;
case WR_STATE_EMPTY: