From a6cf172fb0bacad6a070b49ca63013c3a9258762 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Wed, 16 Jul 2008 04:25:11 +0000 Subject: [PATCH] - scheduler: fix logic to not send plan-class apps to clients that don't know about plan class svn path=/trunk/boinc/; revision=15609 --- checkin_notes | 7 ++ html/inc/bossa_example3.inc | 123 ++++++++++++++++++++++++++++++++++++ sched/sched_send.C | 3 +- 3 files changed, 132 insertions(+), 1 deletion(-) create mode 100644 html/inc/bossa_example3.inc diff --git a/checkin_notes b/checkin_notes index 282d4c01c4..293ba3c700 100644 --- a/checkin_notes +++ b/checkin_notes @@ -5802,3 +5802,10 @@ David 15 July 2008 sched/ sched_send.C + +David 15 July 2008 + - scheduler: fix logic to not send plan-class apps to clients + that don't know about plan class + + sched/ + sched_send.C diff --git a/html/inc/bossa_example3.inc b/html/inc/bossa_example3.inc new file mode 100644 index 0000000000..eba4816751 --- /dev/null +++ b/html/inc/bossa_example3.inc @@ -0,0 +1,123 @@ +get_info($job); + $path = $info->path; + echo " +

Find the Ellipse!

+
+ Click on the center of the ellipse. + If you don't see one, click here: + +

+ id> + +
+ "; +} + +function job_issued($job, $inst, $user) { + $insts = $job->get_instances(); + if (count($insts) > 1) { + $job->set_priority(0); + } +} + +function job_finished($job, $inst) { + $response = null; + if (get_str('submit', true)) { + $response->have_ellipse = 0; + } else { + $response->have_ellipse = 1; + $response->cx = get_int('pic_x'); + $response->cy = get_int('pic_y'); + } + $inst->update_info($response); + + // see if job is done + // + $insts = $job->get_finished_instances(); + $n = count($insts); + echo "got $n finished jobs\n"; + if ($n >= 10) { + $job->update_state(BOSSA_JOB_INCONCLUSIVE); + return; + } + + $results = null; + foreach ($insts as $inst) { + $x = $inst->get_info(); + $results[] = $x; + } + for ($i=0; $i<$n-1; $i++) { + $r1 = $results[$i]; + for ($j=$i+1; $j<$n; $j++) { + $r2 = $results[$j]; + if (compatible($r1, $r2)) { + $job->update_state(BOSSA_JOB_DONE); + return; + } + echo "$i and $j are not compat\n"; + } + } +} + +// two results are compatible if neither found an ellipse, +// or they both did and centers are within 20 pixels +// +function compatible($r1, $r2) { + if ($r1->have_ellipse) { + if ($r2->have_ellipse) { + $dx = ($r1->cx - $r2->cx); + $dy = ($r1->cy - $r2->cy); + $dsq = $dx*$dx + $dy*$dy; + return ($dsq < 400); + } else return false; + } else { + return !$r2->have_ellipse; + } +} + +function job_timed_out($job, $inst, $user) { + $job->set_priority(1); +} + +function show_job_summary($job) { + $info = $job->get_info(); + echo "path>View image"; +} + +function show_instance_summary($inst) { + $info = $inst->get_info(); + if ($info->have_ellipse) { + echo "($info->cx, $info->cy)"; + } else { + echo "---"; + } +} + +function show_user_summary($user) { +} diff --git a/sched/sched_send.C b/sched/sched_send.C index 37be99b418..852156cb77 100644 --- a/sched/sched_send.C +++ b/sched/sched_send.C @@ -174,7 +174,8 @@ BEST_APP_VERSION* get_app_version( reply.wreq.outdated_core = true; continue; } - if (strlen(av.plan_class) && sreq.client_cap_plan_class) { + if (strlen(av.plan_class)) { + if (!sreq.client_cap_plan_class) continue; if (!app_plan(sreq, av.plan_class, host_usage)) { continue; }