- job submission: show batch priority in web page;

add priority stuff to example job submission script
This commit is contained in:
David Anderson 2013-01-09 16:23:19 -08:00 committed by Oliver Bock
parent 06014d6652
commit 8b25f8ccdc
3 changed files with 54 additions and 28 deletions

View File

@ -66,7 +66,16 @@ function show_in_progress($batches, $limit, $user, $app) {
show_all_link($batches, BATCH_STATE_IN_PROGRESS, $limit, $user, $app);
}
start_table();
table_header("name", "ID", "user", "app", "# jobs", "progress", "submitted");
table_header(
"Name",
"ID",
"User",
"App",
"# jobs",
"Progress",
"Submitted",
"Logical end time<br><span class=note>Determines priority</span>"
);
}
$pct_done = (int)($batch->fraction_done*100);
table_row(
@ -76,7 +85,8 @@ function show_in_progress($batches, $limit, $user, $app) {
$batch->app_name,
$batch->njobs,
"$pct_done%",
local_time_str($batch->create_time)
local_time_str($batch->create_time),
local_time_str($batch->logical_end_time)
);
}
if ($first) {
@ -300,6 +310,7 @@ function handle_query_batch($user) {
row2("state", batch_state_string($batch->state));
row2("# jobs", $batch->njobs);
row2("# error jobs", $batch->nerror_jobs);
row2("logical end time", time_str($batch->logical_end_time));
row2("progress", sprintf("%.0f%%", $batch->fraction_done*100));
if ($batch->completion_time) {
row2("completed", local_time_str($batch->completion_time));

View File

@ -138,8 +138,8 @@ function stage_files(&$jobs, $template) {
}
}
function submit_job($job, $template, $app, $batch_id, $i) {
$cmd = "cd ../..; ./bin/create_work --appname $app->name --batch $batch_id --rsc_fpops_est $job->rsc_fpops_est";
function submit_job($job, $template, $app, $batch_id, $i, $priority) {
$cmd = "cd ../..; ./bin/create_work --appname $app->name --batch $batch_id --rsc_fpops_est $job->rsc_fpops_est --priority $priority";
if ($job->command_line) {
$cmd .= " --command_line \"$job->command_line\"";
}
@ -180,15 +180,28 @@ function submit_batch($r) {
$njobs = count($jobs);
$now = time();
$batch_name = (string)($r->batch->batch_name);
// - compute batch FLOP count
// - run adjust_user_priorities to increment user_submit.logical_start_time
// - use that for batch logical end time and job priority
//
$total_flops = 0;
foreach($jobs as $job) {
$total_flops += $job->rsc_fpops_est;
// 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;
$batch_id = BoincBatch::insert(
"(user_id, create_time, njobs, name, app_id) values ($user->id, $now, $njobs, '$batch_name', $app->id)"
"(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.")"
);
$i = 0;
foreach($jobs as $job) {
submit_job($job, $template, $app, $batch_id, $i++);
submit_job($job, $template, $app, $batch_id, $i++, $let);
}
$batch = BoincBatch::lookup_id($batch_id);
$batch->update("state=".BATCH_STATE_IN_PROGRESS);
echo "<batch_id>$batch_id</batch_id>\n";
}

View File

@ -43,30 +43,32 @@ void usage() {
"\n"
"Options:\n"
" --appname name\n"
" [ --wu_name name ] default: generate a name based on app name\n"
" [ --wu_template filename ] default: appname_in\n"
" [ --result_template filename ] default: appname_out\n"
" [ --config_dir path ]\n"
" [ --command_line \"X\" ]\n"
" [ --batch n ]\n"
" [ --rsc_fpops_est n ]\n"
" [ --rsc_fpops_bound n ]\n"
" [ --rsc_memory_bound n ]\n"
" [ --rsc_disk_bound n ]\n"
" [ --delay_bound x ]\n"
" [ --min_quorum x ]\n"
" [ --target_nresults x ]\n"
" [ --max_error_results x ]\n"
" [ --max_total_results x ]\n"
" [ --max_success_results x ]\n"
" [ --additional_xml x ]\n"
" [ --batch n ]\n"
" [ --broadcast ]\n"
" [ --broadcast_user ID ]\n"
" [ --broadcast_team ID ]\n"
" [ --command_line \"X\" ]\n"
" [ --config_dir path ]\n"
" [ -d n ]\n"
" [ --delay_bound x ]\n"
" [ --max_error_results n ]\n"
" [ --max_success_results n ]\n"
" [ --max_total_results n ]\n"
" [ --min_quorum n ]\n"
" [ --priority n ]\n"
" [ --result_template filename ] default: appname_out\n"
" [ --rsc_disk_bound x ]\n"
" [ --rsc_fpops_est x ]\n"
" [ --rsc_fpops_bound x ]\n"
" [ --rsc_memory_bound x ]\n"
" [ --target_host ID ]\n"
" [ --target_user ID ]\n"
" [ --target_nresults n ]\n"
" [ --target_team ID ]\n"
" [ --wu_id N ] ID of existing workunit record (used by boinc_submit)\n"
" [ --target_user ID ]\n"
" [ --wu_id ID ] ID of existing workunit record (used by boinc_submit)\n"
" [ --wu_name name ] default: generate a name based on app name\n"
" [ --wu_template filename ] default: appname_in\n"
);
exit(1);
}
@ -127,6 +129,8 @@ int main(int argc, const char** argv) {
while (i < argc) {
if (arg(argv, i, "appname")) {
strcpy(app.name, argv[++i]);
} else if (arg(argv, i, "batch")) {
wu.batch = atoi(argv[++i]);
} else if (arg(argv, i, "d")) {
int dl = atoi(argv[++i]);
log_messages.set_debug_level(dl);
@ -138,8 +142,6 @@ int main(int argc, const char** argv) {
strcpy(wu_template_file, argv[++i]);
} else if (arg(argv, i, "result_template")) {
strcpy(result_template_file, argv[++i]);
} else if (arg(argv, i, "batch")) {
wu.batch = atoi(argv[++i]);
} else if (arg(argv, i, "config_dir")) {
config_dir = argv[++i];
} else if (arg(argv, i, "batch")) {