From a64cad881c5702092d0356624de1d3f189f3ddd0 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Thu, 8 Jan 2004 00:09:26 +0000 Subject: [PATCH] *** empty log message *** svn path=/trunk/boinc/; revision=2854 --- checkin_notes | 25 ++++++++++++ html/user/host.inc | 7 ++-- html/user/host_edit_action.php | 72 ++++++++++++++++++++-------------- html/user/host_edit_form.php | 42 +++++++++++++++----- html/user/repair.php | 2 +- html/user/result.php | 6 ++- html/user/results.php | 8 ++-- html/user/show_host_detail.php | 2 +- html/user/user.inc | 6 --- html/user/workunit.php | 4 +- sched/handle_request.C | 5 +++ 11 files changed, 121 insertions(+), 58 deletions(-) diff --git a/checkin_notes b/checkin_notes index 7e3df442b8..33f1b74fbf 100755 --- a/checkin_notes +++ b/checkin_notes @@ -8959,3 +8959,28 @@ David 6 Jan 2004 forum/ repair.php (new) user_posts.php + +David 7 Jan 2004 + - don't show #results in 1-line host summary (too slow) + - totally redid "host merge" mechanism. + - show all hosts that are compatible with this one + (not just older ones) + - show checkboxes with "select all" button + so you can easily merge large #s of hosts + - merge logic merges into newest host + - let anyone look at any result and any host + (may want to change this later, + but for now it helps with debuggin) + + html_user/ + host.inc + host_edit_action.php + host_edit_form.php + repair.php + result.php + results.php + show_host_detail.php + user.inc + workunit.php + sched/ + handle_request.C diff --git a/html/user/host.inc b/html/user/host.inc index 75c51a17b5..9191a2cbbf 100644 --- a/html/user/host.inc +++ b/html/user/host.inc @@ -125,7 +125,6 @@ function host_table_start($title, $private, $show_owner) { Total credit CPU type Operating system - Results "; } @@ -172,9 +171,9 @@ function show_host_row($host, $i, $private, $show_owner) { $host->os_name, $host->os_version ); - $nresults = host_nresults($host); - echo "id>$nresults"; - echo "\n"; + //$nresults = host_nresults($host); + //echo "id>$nresults"; + echo "\n"; } // return true iff it's possible that the hosts are actually diff --git a/html/user/host_edit_action.php b/html/user/host_edit_action.php index da55f60651..0f9e5db242 100644 --- a/html/user/host_edit_action.php +++ b/html/user/host_edit_action.php @@ -4,59 +4,73 @@ require_once("host.inc"); function fail($msg) { - page_head("Host merge failed"); - echo $msg; + echo "Error: $msg"; page_tail(); exit(); } - db_init(); - $user = get_logged_in_user(); +function get_host($hostid, $user) { + $host = lookup_host($hostid); + if (!$host || $host->userid != $user->id) { + fail("No such host"); + } + return $host; +} - $hostid = $_GET["hostid"]; - $targetid = $_GET["targetid"]; - - if ($hostid == $targetid) { +function merge_hosts($old_host, $new_host) { + if ($old_host->id == $new_host->id) { fail("same host"); } - - $result = mysql_query("select * from host where id=$hostid"); - $old_host = mysql_fetch_object($result); - mysql_free_result($result); - if (!$old_host || $old_host->userid != $user->id) { - fail("Host not found"); - } - - $result = mysql_query("select * from host where id=$targetid"); - $new_host = mysql_fetch_object($result); - mysql_free_result($result); - if (!$new_host || $new_host->userid != $user->id) { - fail("Host not found"); - } - if (!hosts_compatible($old_host, $new_host)) { fail("Can't merge hosts - they're incompatible"); } + echo "
Merging $old_host->id into $new_host->id\n"; + // update the database: // - add credit from old to new host // - change results to refer to new host // - delete old host - $t = $old_host->total_credit + $new_host->total_credit; - $a = $old_host->expavg_credit + $new_host->expavg_credit; - $result = mysql_query("update host set total_credit=$t, expavg_credit=$a where id=$new_host->id"); + $result = mysql_query("update host set total_credit=$t where id=$new_host->id"); if (!result) { fail("Couldn't update credit of new host"); } - $result = mysql_query("update result set hostid=$targetid where hostid=$hostid"); + $result = mysql_query("update result set hostid=$new_host->id where hostid=$old_host->id"); if (!$result) { fail("Couldn't update results"); } - $result = mysql_query("delete from host where id=$hostid"); + $result = mysql_query("delete from host where id=$old_host->id"); if (!$result) { fail("Couldn't delete host"); } - Header("Location: show_host_detail.php?hostid=$targetid"); +} + + db_init(); + $user = get_logged_in_user(); + + page_head("Host merge"); + + $nhosts = $_GET["nhosts"]; + $hostid = $_GET["id_0"]; + $latest_host = get_host($hostid, $user); + for ($i=1; $i<$nhosts; $i++) { + $var = "id_$i"; + $hostid = $_GET[$var]; + if (!$hostid) continue; + $host = get_host($hostid, $user); + if ($host->create_time > $latest_host->create_time) { + merge_hosts($latest_host, $host); + $latest_host = $host; + } else { + merge_hosts($host, $latest_host); + } + } + echo " +

Return to list of your computers + "; + page_tail(); + + //Header("Location: show_host_detail.php?hostid=$latest_host->id"); ?> diff --git a/html/user/host_edit_form.php b/html/user/host_edit_form.php index 44c3a830e6..6e6a80072e 100644 --- a/html/user/host_edit_form.php +++ b/html/user/host_edit_form.php @@ -20,27 +20,49 @@ if (!$host || $host->userid != $user->id) { $t = time_str($host->create_time); echo " - Sometimes BOINC assigns separate identities to the same host. + Sometimes BOINC assigns separate identities to the same computer by mistake. You can correct this by merging old identities with the newest one. -

- + + +

+ Check the computers that are the same as $host->domain_name (created $t):

- Merge $host->domain_name (created $t) with - id> $host2->domain_name (created $t)\n"; + $nhosts++; + if ($nhosts==500) break; +} +mysql_free_result($result); +echo " +
+ +

Select all +

Unselect all + +

"; diff --git a/html/user/repair.php b/html/user/repair.php index 63bec8378e..bcaa2d73c4 100644 --- a/html/user/repair.php +++ b/html/user/repair.php @@ -16,7 +16,7 @@ function wu_over($wu) { } function fix_validate_state() { - for ($i=0; $i<825637; $i++) { + for ($i=458983; $i<825637; $i++) { $result = mysql_query("select * from workunit where id=$i"); $wu = mysql_fetch_object($result); if ($wu) { diff --git a/html/user/result.php b/html/user/result.php index 08373cec9c..065ea0671b 100644 --- a/html/user/result.php +++ b/html/user/result.php @@ -12,10 +12,14 @@ $r = mysql_query("select * from result where id=$resultid"); $result = mysql_fetch_object($r); mysql_free_result($r); - if (!$result || $result->userid != $user->id) { + if (!$result) { echo "No such result"; exit(); } + //if ($result->userid != $user->id) { + // echo "No access"; + // exit(); + //} show_result($result); page_tail(); ?> diff --git a/html/user/results.php b/html/user/results.php index c680a0e5ae..3258056f74 100644 --- a/html/user/results.php +++ b/html/user/results.php @@ -17,10 +17,10 @@ if ($hostid) { $host = lookup_host($hostid); - if (!$host || $host->userid != $user->id) { - echo "No access"; - exit(); - } + // if (!$host || $host->userid != $user->id) { + // echo "No access"; + // exit(); + // } $type = "host"; $clause = "hostid=$hostid"; } else { diff --git a/html/user/show_host_detail.php b/html/user/show_host_detail.php index 5f8f600a6b..55732e8476 100644 --- a/html/user/show_host_detail.php +++ b/html/user/show_host_detail.php @@ -14,7 +14,7 @@ } $private = false; $user = get_logged_in_user(); - if ($user || $user->id == $host->userid) { + if ($user && $user->id == $host->userid) { $private = true; } diff --git a/html/user/user.inc b/html/user/user.inc index f2837adcc3..1ca84cd105 100644 --- a/html/user/user.inc +++ b/html/user/user.inc @@ -74,8 +74,6 @@ function show_user_profile_private($user) { // show summary of dynamic and static info (public) function show_user_summary_public($user) { - $result = mysql_query("SELECT * FROM profile WHERE userid = $user->id"); - row1("Account data for $user->name"); row2(PROJECT." member since", time_str($user->create_time)); row2("Country", $user->country); @@ -85,10 +83,6 @@ function show_user_summary_public($user) { row2("Total credit", format_credit($user->total_credit)); row2("Recent average credit", format_credit($user->expavg_credit)); - if (mysql_num_rows($result) != 0) { - row2("Profile", "id>View"); - } - if ($user->teamid) { $result = mysql_query("select * from team where id = $user->teamid"); $team = mysql_fetch_object($result); diff --git a/html/user/workunit.php b/html/user/workunit.php index c155ffd384..dffa16ab78 100644 --- a/html/user/workunit.php +++ b/html/user/workunit.php @@ -24,10 +24,10 @@ echo "\n"; echo "

Results:\n"; - result_table_start(false, true, false); + result_table_start(false, true, true); $result = mysql_query("select * from result where workunitid=$wuid"); while ($res = mysql_fetch_object($result)) { - show_result_row($res, false, true, false); + show_result_row($res, false, true, true); } mysql_free_result($result); echo "\n"; diff --git a/sched/handle_request.C b/sched/handle_request.C index e961d0711f..63ff63898f 100644 --- a/sched/handle_request.C +++ b/sched/handle_request.C @@ -329,6 +329,11 @@ int authenticate_user(SCHEDULER_REQUEST& sreq, SCHEDULER_REPLY& reply) { // Make a new host record. if (sreq.rpc_seqno < reply.host.rpc_seqno) { sreq.hostid = 0; + log_messages.printf( + SchedMessages::NORMAL, + "[HOST#%d] [USER#%d] RPC seqno %d less than expected %d; creating new host\n", + reply.host.id, user.id, sreq.rpc_seqno, reply.host.rpc_seqno + ); goto new_host; } reply.host.rpc_seqno = sreq.rpc_seqno;