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