1 | <?php
|
---|
2 | /*
|
---|
3 | * runID_info.php
|
---|
4 | *
|
---|
5 | * All the linkages for a particular runID
|
---|
6 | *
|
---|
7 | */
|
---|
8 | include_once 'checkinstance.php';
|
---|
9 |
|
---|
10 | if ( ($_SESSION['userlevel'] != 2) && // data analyst can see own runID's
|
---|
11 | ($_SESSION['userlevel'] != 3) && // admin and super admin can see all
|
---|
12 | ($_SESSION['userlevel'] != 4) &&
|
---|
13 | ($_SESSION['userlevel'] != 5) )
|
---|
14 | {
|
---|
15 | header('Location: index.php');
|
---|
16 | exit();
|
---|
17 | }
|
---|
18 |
|
---|
19 | include 'config.php';
|
---|
20 | include 'db.php';
|
---|
21 | include 'lib/utility.php';
|
---|
22 | include $class_dir . 'experiment_status.php';
|
---|
23 |
|
---|
24 | // Start displaying page
|
---|
25 | $page_title = "Info by Run ID";
|
---|
26 | $css = 'css/admin.css';
|
---|
27 | include 'header.php';
|
---|
28 |
|
---|
29 | global $uses_airavata;
|
---|
30 |
|
---|
31 | ?>
|
---|
32 | <!-- Begin page content -->
|
---|
33 | <div id='content'>
|
---|
34 |
|
---|
35 | <h1 class="title">Info by Run ID</h1>
|
---|
36 | <!-- Place page content here -->
|
---|
37 |
|
---|
38 | <?php
|
---|
39 | if ( isset( $_POST['experimentID'] ) )
|
---|
40 | {
|
---|
41 | $text = experiment_select( 'experimentID', $_POST['experimentID'] );
|
---|
42 | if ( $_POST['experimentID'] != -1 ) // -1 is Please select...
|
---|
43 | $text .= runID_info( $_POST['experimentID'] );
|
---|
44 | }
|
---|
45 |
|
---|
46 | else if ( isset( $_GET['RequestID'] ) )
|
---|
47 | $text = HPCDetail( $_GET['RequestID'] );
|
---|
48 |
|
---|
49 | else
|
---|
50 | $text = experiment_select( 'experimentID' );
|
---|
51 |
|
---|
52 | echo $text;
|
---|
53 |
|
---|
54 | ?>
|
---|
55 | </div>
|
---|
56 |
|
---|
57 | <?php
|
---|
58 | include 'footer.php';
|
---|
59 | exit();
|
---|
60 |
|
---|
61 | // Function to create a dropdown for available runIDs
|
---|
62 | function experiment_select( $select_name, $current_ID = NULL )
|
---|
63 | {
|
---|
64 | $myID = $_SESSION['id'];
|
---|
65 |
|
---|
66 | $users_clause = ( $_SESSION['userlevel'] > 2 ) ? "" : "AND people.personID = $myID ";
|
---|
67 |
|
---|
68 | $query = "SELECT experimentID, runID, lname " .
|
---|
69 | "FROM experiment, projectPerson, people " .
|
---|
70 | "WHERE experiment.projectID = projectPerson.projectID " .
|
---|
71 | "AND projectPerson.personID = people.personID " .
|
---|
72 | $users_clause .
|
---|
73 | "ORDER BY lname, runID ";
|
---|
74 | $result = mysql_query( $query )
|
---|
75 | or die( "Query failed : $query<br />" . mysql_error() );
|
---|
76 |
|
---|
77 | if ( mysql_num_rows( $result ) == 0 ) return "";
|
---|
78 |
|
---|
79 | $text = "<form action='{$_SERVER['PHP_SELF']}' method='post'>\n" .
|
---|
80 | " <select name='$select_name' size='1' onchange='form.submit();'>\n" .
|
---|
81 | " <option value=-1>Please select...</option>\n";
|
---|
82 | while ( list( $experimentID, $runID, $lname ) = mysql_fetch_array( $result ) )
|
---|
83 | {
|
---|
84 | $selected = ( $current_ID == $experimentID ) ? " selected='selected'" : "";
|
---|
85 | $text .= " <option value='$experimentID'$selected>$lname: $runID</option>\n";
|
---|
86 | }
|
---|
87 |
|
---|
88 | $text .= " </select>\n" .
|
---|
89 | "</form>\n";
|
---|
90 |
|
---|
91 | return $text;
|
---|
92 | }
|
---|
93 |
|
---|
94 | // A function to retrieve information about that runID
|
---|
95 | function runID_info( $experimentID )
|
---|
96 | {
|
---|
97 | $query = "SELECT people.personID, personGUID, lname, fname, email " .
|
---|
98 | "FROM experiment, projectPerson, people " .
|
---|
99 | "WHERE experiment.experimentID = $experimentID " .
|
---|
100 | "AND experiment.projectID = projectPerson.projectID " .
|
---|
101 | "AND projectPerson.personID = people.personID ";
|
---|
102 | $result = mysql_query( $query )
|
---|
103 | or die( "Query failed : $query<br />\n" . mysql_error() );
|
---|
104 | list( $ID, $GUID, $lname, $fname, $email ) = mysql_fetch_array( $result );
|
---|
105 |
|
---|
106 | $text = <<<HTML
|
---|
107 | <table cellspacing='0' cellpadding='0' class='admin'>
|
---|
108 | <caption>Investigator Information</caption>
|
---|
109 | <tr><th>ID:</th>
|
---|
110 | <td>$ID</td></tr>
|
---|
111 |
|
---|
112 | <tr><th>GUID:</th>
|
---|
113 | <td>$GUID</td></tr>
|
---|
114 |
|
---|
115 | <tr><th>Name:</th>
|
---|
116 | <td>$fname $lname</td></tr>
|
---|
117 |
|
---|
118 | <tr><th>Email:</th>
|
---|
119 | <td>$email</td></tr>
|
---|
120 |
|
---|
121 | </table>
|
---|
122 | HTML;
|
---|
123 |
|
---|
124 | $query = "SELECT experimentGUID, coeff1, coeff2, type, runType " .
|
---|
125 | "FROM experiment, rotorCalibration " .
|
---|
126 | "WHERE experimentID = $experimentID " .
|
---|
127 | "AND experiment.rotorCalibrationID = rotorCalibration.rotorCalibrationID ";
|
---|
128 | $result = mysql_query( $query )
|
---|
129 | or die( "Query failed : $query<br />\n" . mysql_error() );
|
---|
130 | list( $GUID, $coeff1, $coeff2, $type, $runType ) = mysql_fetch_array( $result );
|
---|
131 | $text .= <<<HTML
|
---|
132 | <table cellspacing='0' cellpadding='0' class='admin'>
|
---|
133 | <caption>Run Information</caption>
|
---|
134 | <tr><th>GUID:</th>
|
---|
135 | <td>$GUID</td></tr>
|
---|
136 |
|
---|
137 | <tr><th>Rotor stretch coeff 1:</th>
|
---|
138 | <td>$coeff1</td></tr>
|
---|
139 |
|
---|
140 | <tr><th>Rotor stretch coeff 2:</th>
|
---|
141 | <td>$coeff2</td></tr>
|
---|
142 |
|
---|
143 | <tr><th>Experiment type:</th>
|
---|
144 | <td>$type</td></tr>
|
---|
145 |
|
---|
146 | <tr><th>Run Type:</th>
|
---|
147 | <td>$runType</td></tr>
|
---|
148 |
|
---|
149 | </table>
|
---|
150 | HTML;
|
---|
151 |
|
---|
152 | $query = "SELECT rawDataID, rawDataGUID, filename, solutionID " .
|
---|
153 | "FROM rawData " .
|
---|
154 | "WHERE experimentID = $experimentID " .
|
---|
155 | "ORDER BY filename ";
|
---|
156 | $result = mysql_query( $query )
|
---|
157 | or die( "Query failed : $query<br />\n" . mysql_error() );
|
---|
158 |
|
---|
159 | if ( mysql_num_rows( $result ) == 0 )
|
---|
160 | return $text;
|
---|
161 |
|
---|
162 | $rawIDs = array();
|
---|
163 | $solutionIDs = array();
|
---|
164 | $text .= <<<HTML
|
---|
165 | <table cellspacing='0' cellpadding='0' class='admin'>
|
---|
166 | <caption>Raw Data</caption>
|
---|
167 | <thead>
|
---|
168 | <tr><th>ID</th>
|
---|
169 | <th>GUID</th>
|
---|
170 | <th>Filename</th>
|
---|
171 | <th>Solution</th>
|
---|
172 | </tr>
|
---|
173 | </thead>
|
---|
174 |
|
---|
175 | <tbody>
|
---|
176 | HTML;
|
---|
177 |
|
---|
178 | while ( list( $ID, $GUID, $filename, $solutionID ) = mysql_fetch_array( $result ) )
|
---|
179 | {
|
---|
180 | $rawIDs[] = $ID;
|
---|
181 | $solutionIDs[] = $solutionID;
|
---|
182 |
|
---|
183 | $text .= <<<HTML
|
---|
184 | <tr><td>$ID</td>
|
---|
185 | <td>$GUID</td>
|
---|
186 | <td>$filename</td>
|
---|
187 | <td>$solutionID</td>
|
---|
188 | </tr>
|
---|
189 |
|
---|
190 | HTML;
|
---|
191 |
|
---|
192 | }
|
---|
193 |
|
---|
194 | $text .= "</tbody>\n\n" .
|
---|
195 | "</table>\n";
|
---|
196 |
|
---|
197 | $rawIDs_csv = implode( ", ", $rawIDs );
|
---|
198 | $query = "SELECT editedDataID, rawDataID, editGUID, filename " .
|
---|
199 | "FROM editedData " .
|
---|
200 | "WHERE rawDataID IN ( $rawIDs_csv ) " .
|
---|
201 | "ORDER BY editedDataID, filename ";
|
---|
202 | $result = mysql_query( $query )
|
---|
203 | or die( "Query failed : $query<br />\n" . mysql_error() );
|
---|
204 |
|
---|
205 | if ( mysql_num_rows( $result ) == 0 )
|
---|
206 | return $text;
|
---|
207 |
|
---|
208 | $text .= <<<HTML
|
---|
209 | <table cellspacing='0' cellpadding='0' class='admin'>
|
---|
210 | <caption>Edit Profiles</caption>
|
---|
211 | <thead>
|
---|
212 | <tr><th>ID</th>
|
---|
213 | <th>GUID</th>
|
---|
214 | <th>Filename</th>
|
---|
215 | <th>Raw ID</th>
|
---|
216 | </tr>
|
---|
217 | </thead>
|
---|
218 |
|
---|
219 | <tbody>
|
---|
220 |
|
---|
221 | HTML;
|
---|
222 |
|
---|
223 | $editIDs = array();
|
---|
224 | while ( list ( $editID, $rawID, $GUID, $filename ) = mysql_fetch_array( $result ) )
|
---|
225 | {
|
---|
226 | $editIDs[] = $editID;
|
---|
227 |
|
---|
228 | $text .= <<<HTML
|
---|
229 | <tr><td>$editID</td>
|
---|
230 | <td>$GUID</td>
|
---|
231 | <td>$filename</td>
|
---|
232 | <td>$rawID</td>
|
---|
233 | </tr>
|
---|
234 |
|
---|
235 | HTML;
|
---|
236 | }
|
---|
237 |
|
---|
238 | $text .= "</tbody>\n\n" .
|
---|
239 | "</table>\n";
|
---|
240 |
|
---|
241 | $editIDs_csv = implode( ", ", $editIDs );
|
---|
242 | $query = "SELECT model.modelID, editedDataID, modelGUID, variance, meniscus, personID " .
|
---|
243 | "FROM model LEFT JOIN modelPerson " .
|
---|
244 | "ON ( model.modelID = modelPerson.modelID ) " .
|
---|
245 | "WHERE editedDataID IN ( $editIDs_csv ) " .
|
---|
246 | "ORDER BY modelID ";
|
---|
247 | $result = mysql_query( $query )
|
---|
248 | or die( "Query failed : $query<br />\n" . mysql_error() );
|
---|
249 |
|
---|
250 | if ( mysql_num_rows( $result ) != 0 )
|
---|
251 | {
|
---|
252 | $text .= <<<HTML
|
---|
253 | <table cellspacing='0' cellpadding='0' class='admin'>
|
---|
254 | <caption>Models</caption>
|
---|
255 | <thead>
|
---|
256 | <tr><th>ID</th>
|
---|
257 | <th>GUID</th>
|
---|
258 | <th>Edit ID</th>
|
---|
259 | <th>Variance</th>
|
---|
260 | <th>Meniscus</th>
|
---|
261 | <th>Owner ID</th>
|
---|
262 | </tr>
|
---|
263 | </thead>
|
---|
264 |
|
---|
265 | <tbody>
|
---|
266 |
|
---|
267 | HTML;
|
---|
268 |
|
---|
269 | $modelIDs = array();
|
---|
270 | while ( list ( $modelID, $editID, $GUID, $variance, $meniscus, $personID ) = mysql_fetch_array( $result ) )
|
---|
271 | {
|
---|
272 | $modelIDs[] = $modelID;
|
---|
273 |
|
---|
274 | $text .= <<<HTML
|
---|
275 | <tr><td>$modelID</td>
|
---|
276 | <td>$GUID</td>
|
---|
277 | <td>$editID</td>
|
---|
278 | <td>$variance</td>
|
---|
279 | <td>$meniscus</td>
|
---|
280 | <td>$personID</td>
|
---|
281 | </tr>
|
---|
282 |
|
---|
283 | HTML;
|
---|
284 | }
|
---|
285 |
|
---|
286 | $text .= "</tbody>\n\n" .
|
---|
287 | "</table>\n";
|
---|
288 | }
|
---|
289 |
|
---|
290 | if ( count( $modelIDs ) > 0 )
|
---|
291 | {
|
---|
292 | $modelIDs_csv = implode( ", ", $modelIDs );
|
---|
293 | $query = "SELECT noiseID, noiseGUID, editedDataID, modelID, modelGUID, noiseType " .
|
---|
294 | "FROM noise " .
|
---|
295 | "WHERE modelID IN ( $modelIDs_csv ) " .
|
---|
296 | "ORDER BY noiseID ";
|
---|
297 | $result = mysql_query( $query )
|
---|
298 | or die( "Query failed : $query<br />\n" . mysql_error() );
|
---|
299 |
|
---|
300 | if ( mysql_num_rows( $result ) != 0 )
|
---|
301 | {
|
---|
302 | $text .= <<<HTML
|
---|
303 | <table cellspacing='0' cellpadding='0' class='admin'>
|
---|
304 | <caption>Noise Linked to Models</caption>
|
---|
305 | <thead>
|
---|
306 | <tr><th>ID</th>
|
---|
307 | <th>GUID</th>
|
---|
308 | <th>Edit ID</th>
|
---|
309 | <th>Model ID</th>
|
---|
310 | <th>Model GUID</th>
|
---|
311 | <th>Type</th>
|
---|
312 | </tr>
|
---|
313 | </thead>
|
---|
314 |
|
---|
315 | <tbody>
|
---|
316 |
|
---|
317 | HTML;
|
---|
318 |
|
---|
319 | while ( list ( $noiseID, $GUID, $editID, $modelID, $modelGUID, $type ) = mysql_fetch_array( $result ) )
|
---|
320 | {
|
---|
321 | $text .= <<<HTML
|
---|
322 | <tr><td>$noiseID</td>
|
---|
323 | <td>$GUID</td>
|
---|
324 | <td>$editID</td>
|
---|
325 | <td>$modelID</td>
|
---|
326 | <td>$modelGUID</td>
|
---|
327 | <td>$type</td>
|
---|
328 | </tr>
|
---|
329 |
|
---|
330 | HTML;
|
---|
331 | }
|
---|
332 |
|
---|
333 | $text .= "</tbody>\n\n" .
|
---|
334 | "</table>\n";
|
---|
335 | }
|
---|
336 | }
|
---|
337 |
|
---|
338 | $query = "SELECT noiseID, noiseGUID, editedDataID, modelID, modelGUID, noiseType " .
|
---|
339 | "FROM noise " .
|
---|
340 | "WHERE editedDataID IN ( $editIDs_csv ) " .
|
---|
341 | "ORDER BY noiseID ";
|
---|
342 | $result = mysql_query( $query )
|
---|
343 | or die( "Query failed : $query<br />\n" . mysql_error() );
|
---|
344 |
|
---|
345 | if ( mysql_num_rows( $result ) != 0 )
|
---|
346 | {
|
---|
347 | $text .= <<<HTML
|
---|
348 | <table cellspacing='0' cellpadding='0' class='admin'>
|
---|
349 | <caption>Noise Linked to Edit Profiles</caption>
|
---|
350 | <thead>
|
---|
351 | <tr><th>ID</th>
|
---|
352 | <th>GUID</th>
|
---|
353 | <th>Edit ID</th>
|
---|
354 | <th>Model ID</th>
|
---|
355 | <th>Model GUID</th>
|
---|
356 | <th>Type</th>
|
---|
357 | </tr>
|
---|
358 | </thead>
|
---|
359 |
|
---|
360 | <tbody>
|
---|
361 |
|
---|
362 | HTML;
|
---|
363 |
|
---|
364 | while ( list ( $noiseID, $GUID, $editID, $modelID, $modelGUID, $type ) = mysql_fetch_array( $result ) )
|
---|
365 | {
|
---|
366 | $text .= <<<HTML
|
---|
367 | <tr><td>$noiseID</td>
|
---|
368 | <td>$GUID</td>
|
---|
369 | <td>$editID</td>
|
---|
370 | <td>$modelID</td>
|
---|
371 | <td>$modelGUID</td>
|
---|
372 | <td>$type</td>
|
---|
373 | </tr>
|
---|
374 |
|
---|
375 | HTML;
|
---|
376 | }
|
---|
377 |
|
---|
378 | $text .= "</tbody>\n\n" .
|
---|
379 | "</table>\n";
|
---|
380 | }
|
---|
381 |
|
---|
382 | $reportIDs = array();
|
---|
383 | $query = "SELECT reportID, reportGUID, title " .
|
---|
384 | "FROM report " .
|
---|
385 | "WHERE experimentID = $experimentID " .
|
---|
386 | "ORDER BY reportID ";
|
---|
387 |
|
---|
388 | $result = mysql_query( $query )
|
---|
389 | or die( "Query failed : $query<br />\n" . mysql_error() );
|
---|
390 |
|
---|
391 | if ( mysql_num_rows( $result ) != 0 )
|
---|
392 | {
|
---|
393 | $text .= <<<HTML
|
---|
394 | <table cellspacing='0' cellpadding='0' class='admin'>
|
---|
395 | <caption>Reports Related to This Experiment</caption>
|
---|
396 | <thead>
|
---|
397 | <tr><th>ID</th>
|
---|
398 | <th>GUID</th>
|
---|
399 | <th>Title</th>
|
---|
400 | </tr>
|
---|
401 | </thead>
|
---|
402 |
|
---|
403 | <tbody>
|
---|
404 |
|
---|
405 | HTML;
|
---|
406 |
|
---|
407 | while ( list ( $reportID, $GUID, $title ) = mysql_fetch_array( $result ) )
|
---|
408 | {
|
---|
409 | $reportIDs[] = $reportID;
|
---|
410 | $text .= <<<HTML
|
---|
411 | <tr><td>$reportID</td>
|
---|
412 | <td>$GUID</td>
|
---|
413 | <td>$title</td>
|
---|
414 | </tr>
|
---|
415 |
|
---|
416 | HTML;
|
---|
417 | }
|
---|
418 |
|
---|
419 | $text .= "</tbody>\n\n" .
|
---|
420 | "</table>\n";
|
---|
421 | }
|
---|
422 |
|
---|
423 | $reportTripleIDs = array();
|
---|
424 | if ( ! empty( $reportIDs ) )
|
---|
425 | {
|
---|
426 | $reportIDs_csv = implode( ",", $reportIDs );
|
---|
427 | $query = "SELECT reportTripleID, reportTripleGUID, resultID, triple, dataDescription, reportID " .
|
---|
428 | "FROM reportTriple " .
|
---|
429 | "WHERE reportID IN ( $reportIDs_csv ) " .
|
---|
430 | "ORDER BY reportID, reportTripleID ";
|
---|
431 |
|
---|
432 | $result = mysql_query( $query )
|
---|
433 | or die( "Query failed : $query<br />\n" . mysql_error() );
|
---|
434 |
|
---|
435 | if ( mysql_num_rows( $result ) != 0 )
|
---|
436 | {
|
---|
437 | $text .= <<<HTML
|
---|
438 | <table cellspacing='0' cellpadding='0' class='admin'>
|
---|
439 | <caption>Report Triples Related to Reports</caption>
|
---|
440 | <thead>
|
---|
441 | <tr><th>ID</th>
|
---|
442 | <th>GUID</th>
|
---|
443 | <th>Result ID</th>
|
---|
444 | <th>Triple</th>
|
---|
445 | <th>Description</th>
|
---|
446 | <th>Report ID</th>
|
---|
447 | </tr>
|
---|
448 | </thead>
|
---|
449 |
|
---|
450 | <tbody>
|
---|
451 |
|
---|
452 | HTML;
|
---|
453 |
|
---|
454 | while ( list ( $reportTripleID, $GUID, $resultID, $triple, $dataDesc, $rptID )
|
---|
455 | = mysql_fetch_array( $result ) )
|
---|
456 | {
|
---|
457 | $reportTripleIDs[] = $reportTripleID;
|
---|
458 | $text .= <<<HTML
|
---|
459 | <tr><td>$reportTripleID</td>
|
---|
460 | <td>$GUID</td>
|
---|
461 | <td>$resultID</td>
|
---|
462 | <td>$triple</td>
|
---|
463 | <td>$dataDesc</td>
|
---|
464 | <td>$rptID</td>
|
---|
465 | </tr>
|
---|
466 |
|
---|
467 | HTML;
|
---|
468 | }
|
---|
469 |
|
---|
470 | $text .= "</tbody>\n\n" .
|
---|
471 | "</table>\n";
|
---|
472 | }
|
---|
473 | }
|
---|
474 |
|
---|
475 | if ( ! empty( $reportTripleIDs ) )
|
---|
476 | {
|
---|
477 | $reportTripleIDs_csv = implode( ",", $reportTripleIDs );
|
---|
478 | $query = "SELECT d.reportDocumentID, reportDocumentGUID, editedDataID, label, " .
|
---|
479 | "filename, analysis, subAnalysis, documentType, l.reportTripleID " .
|
---|
480 | "FROM documentLink l, reportDocument d " .
|
---|
481 | "WHERE reportTripleID IN ( $reportTripleIDs_csv ) " .
|
---|
482 | "AND l.reportDocumentID = d.reportDocumentID " .
|
---|
483 | "ORDER BY reportTripleID, reportDocumentID ";
|
---|
484 |
|
---|
485 | $result = mysql_query( $query )
|
---|
486 | or die( "Query failed : $query<br />\n" . mysql_error() );
|
---|
487 |
|
---|
488 | if ( mysql_num_rows( $result ) != 0 )
|
---|
489 | {
|
---|
490 | $text .= <<<HTML
|
---|
491 | <table cellspacing='0' cellpadding='0' class='admin'>
|
---|
492 | <caption>Report Documents Related to Triples</caption>
|
---|
493 | <thead>
|
---|
494 | <tr><th>ID</th>
|
---|
495 | <th>GUID</th>
|
---|
496 | <th>Edit ID</th>
|
---|
497 | <th>Label/Filename</th>
|
---|
498 | <th>Anal/Sub/DocType</th>
|
---|
499 | <th>Trip ID</th>
|
---|
500 | </tr>
|
---|
501 | </thead>
|
---|
502 |
|
---|
503 | <tbody>
|
---|
504 |
|
---|
505 | HTML;
|
---|
506 |
|
---|
507 | while ( list ( $reportDocumentID, $GUID, $editID, $label, $filename,
|
---|
508 | $analysis, $subAnal, $docType, $tripID )
|
---|
509 | = mysql_fetch_array( $result ) )
|
---|
510 | {
|
---|
511 | $text .= <<<HTML
|
---|
512 | <tr><td>$reportDocumentID</td>
|
---|
513 | <td>$GUID</td>
|
---|
514 | <td>$editID</td>
|
---|
515 | <td>$label/$filename</td>
|
---|
516 | <td>$analysis/$subAnal/$docType</td>
|
---|
517 | <td>$tripID</td>
|
---|
518 | </tr>
|
---|
519 |
|
---|
520 | HTML;
|
---|
521 | }
|
---|
522 |
|
---|
523 | $text .= "</tbody>\n\n" .
|
---|
524 | "</table>\n";
|
---|
525 | }
|
---|
526 | }
|
---|
527 |
|
---|
528 | $query = "SELECT HPCAnalysisRequestID, HPCAnalysisRequestGUID, editXMLFilename, " .
|
---|
529 | "submitTime, clusterName, method " .
|
---|
530 | "FROM HPCAnalysisRequest " .
|
---|
531 | "WHERE experimentID = $experimentID " .
|
---|
532 | "ORDER BY HPCAnalysisRequestID ";
|
---|
533 | $result = mysql_query( $query )
|
---|
534 | or die( "Query failed : $query<br />\n" . mysql_error() );
|
---|
535 |
|
---|
536 | if ( mysql_num_rows( $result ) == 0 )
|
---|
537 | return $text;
|
---|
538 |
|
---|
539 | $requestIDs = array();
|
---|
540 | $text .= <<<HTML
|
---|
541 | <table cellspacing='0' cellpadding='0' class='admin'>
|
---|
542 | <caption>HPC Requests</caption>
|
---|
543 | <thead>
|
---|
544 | <tr><th>ID</th>
|
---|
545 | <th>GUID</th>
|
---|
546 | <th>XML Filename</th>
|
---|
547 | <th>Submit</th>
|
---|
548 | <th>Cluster</th>
|
---|
549 | <th>Method</th>
|
---|
550 | </tr>
|
---|
551 | </thead>
|
---|
552 |
|
---|
553 | <tbody>
|
---|
554 | HTML;
|
---|
555 |
|
---|
556 | while ( list( $ID, $GUID, $filename, $submit, $cluster, $method ) = mysql_fetch_array( $result ) )
|
---|
557 | {
|
---|
558 | $requestIDs[] = $ID;
|
---|
559 |
|
---|
560 | $text .= <<<HTML
|
---|
561 | <tr><td><a href='{$_SERVER['PHP_SELF']}?RequestID=$ID'>$ID</a></td>
|
---|
562 | <td>$GUID</td>
|
---|
563 | <td>$filename</td>
|
---|
564 | <td>$submit</td>
|
---|
565 | <td>$cluster</td>
|
---|
566 | <td>$method</td>
|
---|
567 | </tr>
|
---|
568 |
|
---|
569 | HTML;
|
---|
570 |
|
---|
571 | }
|
---|
572 |
|
---|
573 | $text .= "</tbody>\n\n" .
|
---|
574 | "</table>\n";
|
---|
575 |
|
---|
576 | $requestIDs_csv = implode( ", ", $requestIDs );
|
---|
577 | $query = "SELECT HPCAnalysisResultID, HPCAnalysisRequestID, gfacID, queueStatus, updateTime " .
|
---|
578 | "FROM HPCAnalysisResult " .
|
---|
579 | "WHERE HPCAnalysisRequestID IN ( $requestIDs_csv ) " .
|
---|
580 | "ORDER BY HPCAnalysisResultID ";
|
---|
581 | $result = mysql_query( $query )
|
---|
582 | or die( "Query failed : $query<br />\n" . mysql_error() );
|
---|
583 |
|
---|
584 | if ( mysql_num_rows( $result ) != 0 )
|
---|
585 | {
|
---|
586 | $text .= <<<HTML
|
---|
587 | <table cellspacing='0' cellpadding='0' class='admin'>
|
---|
588 | <caption>HPC Results</caption>
|
---|
589 | <thead>
|
---|
590 | <tr><th>ID</th>
|
---|
591 | <th>Request ID</th>
|
---|
592 | <th>gfac ID</th>
|
---|
593 | <th>Status</th>
|
---|
594 | <th>Updated</th>
|
---|
595 | </tr>
|
---|
596 | </thead>
|
---|
597 |
|
---|
598 | <tbody>
|
---|
599 | HTML;
|
---|
600 |
|
---|
601 | $incomplete = array();
|
---|
602 | while ( list( $ID, $requestID, $gfacID, $status, $updated ) = mysql_fetch_array( $result ) )
|
---|
603 | {
|
---|
604 | if ( $status != 'completed' )
|
---|
605 | $incomplete[] = $gfacID;
|
---|
606 |
|
---|
607 | $text .= <<<HTML
|
---|
608 | <tr><td>$ID</td>
|
---|
609 | <td>$requestID</td>
|
---|
610 | <td>$gfacID</td>
|
---|
611 | <td>$status</td>
|
---|
612 | <td>$updated</td>
|
---|
613 | </tr>
|
---|
614 |
|
---|
615 | HTML;
|
---|
616 |
|
---|
617 | }
|
---|
618 |
|
---|
619 | $text .= "</tbody>\n\n" .
|
---|
620 | "</table>\n";
|
---|
621 |
|
---|
622 | }
|
---|
623 |
|
---|
624 | if ( empty( $incomplete ) )
|
---|
625 | return $text;
|
---|
626 |
|
---|
627 | // Now switch over to the global db
|
---|
628 | global $globaldbhost, $globaldbuser, $globaldbpasswd, $globaldbname;
|
---|
629 |
|
---|
630 | $globaldb = mysql_connect( $globaldbhost, $globaldbuser, $globaldbpasswd );
|
---|
631 |
|
---|
632 | if ( ! $globaldb )
|
---|
633 | {
|
---|
634 | $text .= "<p>Cannot open global database on $globaldbhost</p>\n";
|
---|
635 | return $text;
|
---|
636 | }
|
---|
637 |
|
---|
638 | if ( ! mysql_select_db( $globaldbname, $globaldb ) )
|
---|
639 | {
|
---|
640 | $text .= "<p>Cannot change to global database $globaldbname</p>\n";
|
---|
641 | return $text;
|
---|
642 | }
|
---|
643 |
|
---|
644 | $text .= <<<HTML
|
---|
645 | <table cellspacing='0' cellpadding='0' class='admin'>
|
---|
646 | <caption>GFAC Status</caption>
|
---|
647 | <thead>
|
---|
648 | <tr><th>gfacID</th>
|
---|
649 | <th>Cluster</th>
|
---|
650 | <th>DB</th>
|
---|
651 | <th>Status</th>
|
---|
652 | <th>Message</th>
|
---|
653 | <th>Updated</th>
|
---|
654 | </tr>
|
---|
655 | </thead>
|
---|
656 |
|
---|
657 | <tbody>
|
---|
658 | HTML;
|
---|
659 |
|
---|
660 | $in_queue = 0;
|
---|
661 | foreach ( $incomplete as $gfacID )
|
---|
662 | {
|
---|
663 |
|
---|
664 | $query = "SELECT cluster, us3_db, status, queue_msg, time " .
|
---|
665 | "FROM analysis " .
|
---|
666 | "WHERE gfacID = '$gfacID' ";
|
---|
667 | $result = mysql_query( $query )
|
---|
668 | or die( "Query failed : $query<br />\n" . mysql_error() );
|
---|
669 |
|
---|
670 | if ( mysql_num_rows( $result ) == 1 )
|
---|
671 | {
|
---|
672 | $in_queue++;
|
---|
673 | list( $cluster, $db, $status, $msg, $time ) = mysql_fetch_array( $result );
|
---|
674 | $text .= <<<HTML
|
---|
675 | <tr><td>$gfacID</td>
|
---|
676 | <td>$cluster</td>
|
---|
677 | <td>$db</td>
|
---|
678 | <td>$status</td>
|
---|
679 | <td>$msg</td>
|
---|
680 | <td>$time</td>
|
---|
681 | </tr>
|
---|
682 |
|
---|
683 | HTML;
|
---|
684 | }
|
---|
685 | }
|
---|
686 |
|
---|
687 | if ( $in_queue == 0 )
|
---|
688 | $text .= "<tr><td colspan='6'>No local jobs currently in the queue</td></tr>\n";
|
---|
689 |
|
---|
690 | $text .= "</tbody>\n\n" .
|
---|
691 | "</table>\n";
|
---|
692 |
|
---|
693 | mysql_close( $globaldb );
|
---|
694 |
|
---|
695 | return $text;
|
---|
696 | }
|
---|
697 |
|
---|
698 | function HPCDetail( $requestID )
|
---|
699 | {
|
---|
700 | $query = "SELECT * FROM HPCAnalysisRequest WHERE HPCAnalysisRequestID=$requestID";
|
---|
701 | $result = mysql_query( $query )
|
---|
702 | or die( "Query failed : $query<br />\n" . mysql_error());
|
---|
703 | $row = mysql_fetch_assoc( $result );
|
---|
704 | $row['requestXMLFile'] = '<pre>' . htmlentities( $row['requestXMLFile'] ) . '</pre>';
|
---|
705 |
|
---|
706 | // Save for later
|
---|
707 | $requestGUID = $row['HPCAnalysisRequestGUID'];
|
---|
708 | $cluster = $row['clusterName'];
|
---|
709 | #var_dump($cluster);
|
---|
710 | $text = <<<HTML
|
---|
711 | <table cellspacing='0' cellpadding='0' class='admin'>
|
---|
712 | <caption>HPC Request Detail</caption>
|
---|
713 |
|
---|
714 | HTML;
|
---|
715 |
|
---|
716 | foreach ($row as $key => $value)
|
---|
717 | {
|
---|
718 | $text .= " <tr><th>$key</th><td>$value</td></tr>\n";
|
---|
719 | }
|
---|
720 |
|
---|
721 | $text .= "</table>\n";
|
---|
722 |
|
---|
723 | $query = "SELECT * FROM HPCAnalysisResult WHERE HPCAnalysisRequestID=$requestID";
|
---|
724 | $result = mysql_query( $query )
|
---|
725 | or die( "Query failed : $query<br />\n" . mysql_error());
|
---|
726 | $row = mysql_fetch_assoc( $result );
|
---|
727 | $row['jobfile'] = '<pre>' . htmlentities( $row['jobfile'] ) . '</pre>';
|
---|
728 |
|
---|
729 | // Get GFAC job status
|
---|
730 | global $uses_airavata;
|
---|
731 |
|
---|
732 | if ( $uses_airavata === true )
|
---|
733 | {
|
---|
734 | $row['gfacStatus'] = nl2br( getExperimentStatus( $row['gfacID'] ) );
|
---|
735 | }
|
---|
736 | else
|
---|
737 | {
|
---|
738 | $row['gfacStatus'] = nl2br( getJobstatus( $row['gfacID'] ) );
|
---|
739 | }
|
---|
740 |
|
---|
741 | // Get queue messages from disk directory, if it still exists
|
---|
742 | global $submit_dir;
|
---|
743 | global $dbname;
|
---|
744 |
|
---|
745 | $msg_filename = "$submit_dir$requestGUID/$dbname-$requestID-messages.txt";
|
---|
746 | $queue_msgs = false;
|
---|
747 | if ( file_exists( $msg_filename ) )
|
---|
748 | {
|
---|
749 | $queue_msgs = file_get_contents( $msg_filename );
|
---|
750 | $len_msgs = strlen( $queue_msgs );
|
---|
751 | $queue_msgs = '<pre>' . $queue_msgs . '</pre>';
|
---|
752 | }
|
---|
753 |
|
---|
754 | // Get resulting model and noise information
|
---|
755 | if ( ! empty( $resultID ) )
|
---|
756 | {
|
---|
757 | $resultID = $row['HPCAnalysisResultID'];
|
---|
758 | $models = array();
|
---|
759 | $noise = array();
|
---|
760 | $query = "SELECT resultID FROM HPCAnalysisResultData " .
|
---|
761 | "WHERE HPCAnalysisResultID = $resultID " .
|
---|
762 | "AND HPCAnalysisResultType = 'model' ";
|
---|
763 | $result = mysql_query( $query )
|
---|
764 | or die( "Query failed : $query<br />\n" . mysql_error());
|
---|
765 | $models = mysql_fetch_row( $result ); // An array with all of them
|
---|
766 | if ( $models !== false )
|
---|
767 | $row['modelIDs'] = implode( ", ", $models );
|
---|
768 |
|
---|
769 | $query = "SELECT resultID FROM HPCAnalysisResultData " .
|
---|
770 | "WHERE HPCAnalysisResultID = $resultID " .
|
---|
771 | "AND HPCAnalysisResultType = 'noise' ";
|
---|
772 | $result = mysql_query( $query )
|
---|
773 | or die( "Query failed : $query<br />\n" . mysql_error());
|
---|
774 | $noise = mysql_fetch_row( $result ); // An array with all of them
|
---|
775 | if ( $noise !== false )
|
---|
776 | $row['noiseIDs'] = implode( ", ", $noise );
|
---|
777 | }
|
---|
778 |
|
---|
779 | $text .= <<<HTML
|
---|
780 | <a name='runDetail'></a>
|
---|
781 | <table cellspacing='0' cellpadding='0' class='admin'>
|
---|
782 | <caption>HPC Result Detail</caption>
|
---|
783 |
|
---|
784 | HTML;
|
---|
785 |
|
---|
786 | foreach ($row as $key => $value)
|
---|
787 | {
|
---|
788 | $text .= " <tr><th>$key</th><td>$value</td></tr>\n";
|
---|
789 | }
|
---|
790 |
|
---|
791 | if ( $queue_msgs !== false )
|
---|
792 | {
|
---|
793 | $linkmsg = "<a href='{$_SERVER[ 'PHP_SELF' ]}?RequestID=$requestID&msgs=t#runDetail'>Length Messages</a>";
|
---|
794 |
|
---|
795 | $text .= " <tr><th>$linkmsg</th><td>$len_msgs</td></tr>\n";
|
---|
796 | if ( isset( $_GET[ 'msgs' ] ) )
|
---|
797 | $text .= " <tr><th>Queue Messages</th><td>$queue_msgs</td></tr>\n";
|
---|
798 | }
|
---|
799 |
|
---|
800 | $text .= "</table>\n";
|
---|
801 |
|
---|
802 | return $text;
|
---|
803 | }
|
---|
804 |
|
---|
805 | ?>
|
---|