Ticket #977: result.inc.diff
File result.inc.diff, 12.9 KB (added by , 14 years ago) |
---|
-
inc/result.inc
22 22 function app_version_string($id) { 23 23 global $apps, $app_versions; 24 24 if ($id == 0) return ""; 25 if ($id == -1) return "Anonymous platform";25 if ($id == -1) return tra("Anonymous platform"); 26 26 if (array_key_exists($id, $app_versions)) { 27 27 $av = $app_versions[$id]; 28 28 $app = $apps[$av->appid]; 29 29 } else { 30 30 $av = BoincAppVersion::lookup("id=$id"); 31 31 if (!$av) { 32 return "Not in DB";32 return tra("Not in DB"); 33 33 } 34 34 $app_versions[$id] = $av; 35 35 $app = BoincApp::lookup_id($av->appid); … … 67 67 switch ($result->validate_state) { 68 68 case 0: 69 69 case 4: 70 return "pending";70 return tra("pending"); 71 71 } 72 72 return $string_to_show; 73 73 default: … … 89 89 define("NSTATES", 6); 90 90 91 91 $state_name = array( 92 "All",93 "In progress",94 "Pending",95 "Valid",96 "Invalid",97 "Error",92 tra("All"), 93 tra("In progress"), 94 tra("Pending"), 95 tra("Valid"), 96 tra("Invalid"), 97 tra("Error"), 98 98 ); 99 99 100 100 $state_clause = array( … … 108 108 109 109 function state_string($result) { 110 110 switch ($result->server_state) { 111 case 1: return "Inactive";112 case 2: return "Unsent";113 case 4: return "In progress";111 case 1: return tra("Inactive"); 112 case 2: return tra("Unsent"); 113 case 4: return tra("In progress"); 114 114 case 5: 115 115 switch ($result->outcome) { 116 116 case 1: 117 117 switch ($result->validate_state) { 118 case 0: return "Completed, waiting for validation";119 case 1: return "Completed and validated";120 case 2: return "Completed, marked as invalid";121 case 3: return "Completed, can't validate";122 case 4: return "Completed, validation inconclusive";123 case 5: return "Completed, too late to validate";118 case 0: return tra("Completed, waiting for validation"); 119 case 1: return tra("Completed and validated"); 120 case 2: return tra("Completed, marked as invalid"); 121 case 3: return tra("Completed, can't validate"); 122 case 4: return tra("Completed, validation inconclusive"); 123 case 5: return tra("Completed, too late to validate"); 124 124 } 125 return "Completed";126 case 2: return "Couldn't send";125 return tra("Completed"); 126 case 2: return tra("Couldn't send"); 127 127 case 3: 128 128 if ($result->exit_status == -221) { 129 return "Cancelled by server";129 return tra("Cancelled by server"); 130 130 } 131 131 switch($result->client_state) { 132 case 1: return "Error while downloading";133 case 2: return "Error while computing";134 case 3: return "Error while computing";135 case 4: return "Error while uploading";136 case 6: return "Aborted by user";132 case 1: return tra("Error while downloading"); 133 case 2: 134 case 3: return tra("Error while computing"); 135 case 4: return tra("Error while uploading"); 136 case 6: return tra("Aborted by user"); 137 137 } 138 return "Error";139 case 4: return "Timed out - no response";140 case 5: return "Didn't need";141 case 6: return "Validate error";142 case 7: return "Client detached";138 return tra("Error"); 139 case 4: return tra("Timed out - no response"); 140 case 5: return tra("Didn't need"); 141 case 6: return tra("Validate error"); 142 case 7: return tra("Client detached"); 143 143 } 144 144 } 145 return "Unknown";145 return tra("Unknown"); 146 146 } 147 147 148 148 function result_server_state_string($result) { 149 149 switch($result->server_state) { 150 case 1: return "Inactive";151 case 2: return "Unsent";152 case 4: return "In progress";153 case 5: return "Over";150 case 1: return tra("Inactive"); 151 case 2: return tra("Unsent"); 152 case 4: return tra("In progress"); 153 case 5: return tra("Over"); 154 154 } 155 return "Unknown";155 return tra("Unknown"); 156 156 } 157 157 158 158 function result_outcome_string($result) { 159 159 switch($result->outcome) { 160 160 case 0: return "---"; 161 case 1: return "Success";162 case 2: return "Couldn't send";161 case 1: return tra("Success"); 162 case 2: return tra("Couldn't send"); 163 163 case 3: 164 164 if ($result->exit_status <> -221) { 165 return "Client error";165 return tra("Client error"); 166 166 } 167 return "Redundant result";168 case 4: return "No reply";169 case 5: return "Didn't need";170 case 6: return "Validate error";171 case 7: return "Client detached";167 return tra("Redundant result"); 168 case 4: return tra("No reply"); 169 case 5: return tra("Didn't need"); 170 case 6: return tra("Validate error"); 171 case 7: return tra("Client detached"); 172 172 } 173 return "Unknown";173 return tra("Unknown"); 174 174 } 175 175 176 176 function result_client_state_string($result) { 177 177 switch($result->client_state) { 178 case 0: return "New";179 case 1: return "Downloading";180 case 2: return "Computing";181 case 3: return "Compute error";182 case 4: return "Uploading";183 case 5: return "Done";178 case 0: return tra("New"); 179 case 1: return tra("Downloading"); 180 case 2: return tra("Computing"); 181 case 3: return tra("Compute error"); 182 case 4: return tra("Uploading"); 183 case 5: return tra("Done"); 184 184 case 6: 185 185 if ($result->exit_status == -221) { 186 return "Cancelled by server";186 return tra("Cancelled by server"); 187 187 } 188 return "Aborted by user";188 return tra("Aborted by user"); 189 189 } 190 190 } 191 191 192 192 function validate_state_str($result) { 193 193 switch($result->validate_state) { 194 case 0: return "Initial";195 case 1: return "Valid";194 case 0: return tra("Initial"); 195 case 1: return tra("Valid"); 196 196 case 2: 197 197 if ($result->exit_status <> -221) { 198 return "Invalid";198 return tra("Invalid"); 199 199 } 200 return "Not necessary";201 case 3: return "Workunit error - check skipped";202 case 4: return "Checked, but no consensus yet";203 case 5: return "Task was reported too late to validate";200 return tra("Not necessary"); 201 case 3: return tra("Workunit error - check skipped"); 202 case 4: return tra("Checked, but no consensus yet"); 203 case 5: return tra("Task was reported too late to validate"); 204 204 } 205 return "Unknown";205 return tra("Unknown"); 206 206 } 207 207 208 208 function wu_error_mask_str($s) { 209 209 $x = ""; 210 210 if ($s & 1) { 211 $x = $x." Couldn't send result ";211 $x = $x." ".tra("Couldn't send result"); 212 212 $s -= 1; 213 213 } 214 214 if ($s & 2) { 215 $x = $x." Too many error results ";215 $x = $x." ".tra("Too many errors (may have bug)"); 216 216 $s -= 2; 217 217 } 218 218 if ($s & 4) { 219 $x = $x." Too many success results ";219 $x = $x." ".tra("Too many results (may be nondeterministic)"); 220 220 $s -= 4; 221 221 } 222 222 if ($s & 8) { 223 $x = $x." Too many total results ";223 $x = $x." ".tra("Too many total results"); 224 224 $s -= 8; 225 225 } 226 226 if ($s & 16) { 227 $x = $x." Cancelled ";227 $x = $x." ".tra("WU cancelled"); 228 228 $s -= 16; 229 229 } 230 230 if ($s) { 231 $x = $x." Unrecognized Error: $s ";231 $x = $x." ".tra("Unrecognized Error: %1", $s); 232 232 } 233 if (!strlen($x)) { 234 $x="<br>"; 233 if (strlen($x)) { 234 $x="<font color=\"#ff3333\">".$x."</font>"; 235 } else { 236 $x=""; 235 237 } 236 238 return $x; 237 239 } … … 252 254 $i2 = clone $info; 253 255 $i2->show_names = 0; 254 256 $url = result_page_url($i2); 255 echo "<th> Task name<br><span class=\"smalltext\">click for details<br><a href=$url>Show IDs</a></span></th>\n";257 echo "<th>".tra("Task name")."<br><span class=\"smalltext\">".tra("click for details")."<br><a href=$url>".tra("Show IDs")."</a></span></th>\n"; 256 258 } else { 257 259 $i2 = clone $info; 258 260 $i2->show_names = 1; 259 261 $url = result_page_url($i2); 260 echo "<th>Task ID<br><span class=\"smalltext\"> click for details<br><a href=$url>Show names</a></span></th>\n";262 echo "<th>Task ID<br><span class=\"smalltext\">".tra("click for details")."<br><a href=$url>".tra("Show names")."</a></span></th>\n"; 261 263 } 262 264 } else { 263 echo "<th> Task ID<br><span class=\"smalltext\">click for details</span></th>\n";265 echo "<th>".tra("Task ID")."<br><span class=\"smalltext\">".tra("click for details")."</span></th>\n"; 264 266 } 265 267 if ($show_wu_link) { 266 echo "<th> Work unit ID<br><span class=\"smalltext\">click for details</span></th>\n";268 echo "<th>".tra("Work unit ID")."<br><span class=\"smalltext\">".tra("click for details")."</span></th>\n"; 267 269 } 268 270 if ($show_host_link) { 269 echo "<th> Computer</th>\n";271 echo "<th>".tra("Computer")."</th>\n"; 270 272 } 271 273 echo " 272 <th>Sent</th> 273 <th>Time reported 274 <br>or deadline 275 <br><span class=\"smalltext\"><a href=\"explain_state.php?field=result_time\">explain</a></span> 274 <th>".tra("Sent")."</th> 275 <th>".tra("Time reported<br />or deadline")." 276 <br><span class=\"smalltext\"><a href=\"explain_state.php?field=result_time\">".tra("explain")."</a></span> 276 277 </th> 277 <th> Status</th>278 <th> Run time<br>(sec)</th>279 <th> CPU time<br>(sec)</th>280 <th> Claimed credit</th>281 <th> Granted credit</th>282 <th> Application</th>278 <th>".tra("Status")."</th> 279 <th>".tra("Run time<br />(sec)")."</th> 280 <th>".tra("CPU time<br />(sec)")."</th> 281 <th>".tra("Claimed credit")."</th> 282 <th>".tra("Granted credit")."</th> 283 <th>".tra("Application")."</th> 283 284 </tr> 284 285 "; 285 286 } … … 371 372 372 373 function show_result($result) { 373 374 start_table(); 374 row2( "Name", $result->name);375 row2( "Workunit", "<a href=\"workunit.php?wuid=$result->workunitid\">$result->workunitid</a>");376 row2( "Created", time_str($result->create_time));377 row2( "Sent", time_str($result->sent_time));378 row2( "Received", time_str($result->received_time));379 row2( "Server state", result_server_state_string($result));380 row2( "Outcome", result_outcome_string($result));381 row2( "Client state", result_client_state_string($result));382 row2( "Exit status", exit_status_string($result));383 row2( "Computer ID", host_link($result->hostid));384 row2( "Report deadline", time_str($result->report_deadline));385 row2( "Run time", $result->elapsed_time);386 row2( "CPU time", $result->cpu_time);387 row2( "stderr out", "<pre>".htmlspecialchars($result->stderr_out)."</pre>");388 row2( "Validate state", validate_state_str($result));389 row2( "Claimed credit", $result->claimed_credit);390 row2( "Granted credit", $result->granted_credit);391 row2( "application version", app_version_string($result->app_version_id));375 row2(tra("Name"), $result->name); 376 row2(tra("Workunit"), "<a href=\"workunit.php?wuid=$result->workunitid\">$result->workunitid</a>"); 377 row2(tra("Created"), time_str($result->create_time)); 378 row2(tra("Sent"), time_str($result->sent_time)); 379 row2(tra("Received"), time_str($result->received_time)); 380 row2(tra("Server state"), result_server_state_string($result)); 381 row2(tra("Outcome"), result_outcome_string($result)); 382 row2(tra("Client state"), result_client_state_string($result)); 383 row2(tra("Exit status"), exit_status_string($result)); 384 row2(tra("Computer ID"), host_link($result->hostid)); 385 row2(tra("Report deadline"), time_str($result->report_deadline)); 386 row2(tra("Run time"), $result->elapsed_time); 387 row2(tra("CPU time"), $result->cpu_time); 388 row2(tra("stderr out"), "<pre>".htmlspecialchars($result->stderr_out)."</pre>"); 389 row2(tra("Validate state"), validate_state_str($result)); 390 row2(tra("Claimed credit"), $result->claimed_credit); 391 row2(tra("Granted credit"), $result->granted_credit); 392 row2(tra("application version"), app_version_string($result->app_version_id)); 392 393 end_table(); 393 394 } 394 395 … … 402 403 $i2 = clone $info; 403 404 $i2->offset = $info->offset - $info->results_per_page; 404 405 $url = result_page_url($i2); 405 echo "<a href=$url> Previous".$info->results_per_page."</a>";406 echo "<a href=$url>".tra("Previous")." ".$info->results_per_page."</a>"; 406 407 } 407 408 if ($show_prev && $show_next) { 408 409 echo " | "; … … 411 412 $i2 = clone $info; 412 413 $i2->offset = $info->offset + $info->results_per_page; 413 414 $url = result_page_url($i2); 414 echo "<a href=$url> Next".$info->results_per_page."</a>";415 echo "<a href=$url>".tra("Next")." ".$info->results_per_page."</a>"; 415 416 } 416 417 echo "<br>Show: "; 417 418 for ($i=0; $i<NSTATES; $i++) {