Info by Run ID
2 ) ? "" : "AND people.personID = $myID ";
$query = "SELECT experimentID, runID, lname " .
"FROM experiment, projectPerson, people " .
"WHERE experiment.projectID = projectPerson.projectID " .
"AND projectPerson.personID = people.personID " .
$users_clause .
"ORDER BY lname, runID ";
$result = mysqli_query( $link, $query )
or die( "Query failed : $query
" . mysqli_error($link) );
if ( mysqli_num_rows( $result ) == 0 ) return "";
$text = "\n";
return $text;
}
// A function to retrieve information about that runID
function runID_info( $experimentID )
{
global $link;
$query = "SELECT people.personID, personGUID, lname, fname, email " .
"FROM experiment, projectPerson, people " .
"WHERE experiment.experimentID = $experimentID " .
"AND experiment.projectID = projectPerson.projectID " .
"AND projectPerson.personID = people.personID ";
$result = mysqli_query( $link, $query )
or die( "Query failed : $query
\n" . mysqli_error($link) );
list( $ID, $GUID, $lname, $fname, $email ) = mysqli_fetch_array( $result );
$text = <<
Investigator Information
ID: |
$ID |
GUID: |
$GUID |
Name: |
$fname $lname |
Email: |
$email |
HTML;
$query = "SELECT experimentGUID, coeff1, coeff2, type, runType " .
"FROM experiment, rotorCalibration " .
"WHERE experimentID = $experimentID " .
"AND experiment.rotorCalibrationID = rotorCalibration.rotorCalibrationID ";
$result = mysqli_query( $link, $query )
or die( "Query failed : $query
\n" . mysqli_error($link) );
list( $GUID, $coeff1, $coeff2, $type, $runType ) = mysqli_fetch_array( $result );
$text .= <<
Run Information
GUID: |
$GUID |
Rotor stretch coeff 1: |
$coeff1 |
Rotor stretch coeff 2: |
$coeff2 |
Experiment type: |
$type |
Run Type: |
$runType |
HTML;
$query = "SELECT rawDataID, rawDataGUID, filename, solutionID " .
"FROM rawData " .
"WHERE experimentID = $experimentID " .
"ORDER BY filename ";
$result = mysqli_query( $link, $query )
or die( "Query failed : $query
\n" . mysqli_error($link) );
if ( mysqli_num_rows( $result ) == 0 )
return $text;
$rawIDs = array();
$solutionIDs = array();
$text .= <<
Raw Data
ID |
GUID |
Filename |
Solution |
HTML;
while ( list( $ID, $GUID, $filename, $solutionID ) = mysqli_fetch_array( $result ) )
{
$rawIDs[] = $ID;
$solutionIDs[] = $solutionID;
$text .= <<$ID |
$GUID |
$filename |
$solutionID |
HTML;
}
$text .= "\n\n" .
"\n";
$rawIDs_csv = implode( ", ", $rawIDs );
$query = "SELECT editedDataID, rawDataID, editGUID, filename " .
"FROM editedData " .
"WHERE rawDataID IN ( $rawIDs_csv ) " .
"ORDER BY editedDataID, filename ";
$result = mysqli_query( $link, $query )
or die( "Query failed : $query
\n" . mysqli_error($link) );
if ( mysqli_num_rows( $result ) == 0 )
return $text;
$text .= <<
Edit Profiles
ID |
GUID |
Filename |
Raw ID |
HTML;
$editIDs = array();
while ( list ( $editID, $rawID, $GUID, $filename ) = mysqli_fetch_array( $result ) )
{
$editIDs[] = $editID;
$text .= <<$editID |
$GUID |
$filename |
$rawID |
HTML;
}
$text .= "\n\n" .
"\n";
$editIDs_csv = implode( ", ", $editIDs );
$query = "SELECT model.modelID, editedDataID, modelGUID, variance, meniscus, personID " .
"FROM model LEFT JOIN modelPerson " .
"ON ( model.modelID = modelPerson.modelID ) " .
"WHERE editedDataID IN ( $editIDs_csv ) " .
"ORDER BY modelID ";
$result = mysqli_query( $link, $query )
or die( "Query failed : $query
\n" . mysqli_error($link) );
if ( mysqli_num_rows( $result ) != 0 )
{
$text .= <<
Models
ID |
GUID |
Edit ID |
Variance |
Meniscus |
Owner ID |
HTML;
$modelIDs = array();
while ( list ( $modelID, $editID, $GUID, $variance, $meniscus, $personID ) = mysqli_fetch_array( $result ) )
{
$modelIDs[] = $modelID;
$text .= <<$modelID |
$GUID |
$editID |
$variance |
$meniscus |
$personID |
HTML;
}
$text .= "\n\n" .
"\n";
}
if ( count( $modelIDs ) > 0 )
{
$modelIDs_csv = implode( ", ", $modelIDs );
$query = "SELECT noiseID, noiseGUID, editedDataID, modelID, modelGUID, noiseType " .
"FROM noise " .
"WHERE modelID IN ( $modelIDs_csv ) " .
"ORDER BY noiseID ";
$result = mysqli_query( $link, $query )
or die( "Query failed : $query
\n" . mysqli_error($link) );
if ( mysqli_num_rows( $result ) != 0 )
{
$text .= <<
Noise Linked to Models
ID |
GUID |
Edit ID |
Model ID |
Model GUID |
Type |
HTML;
while ( list ( $noiseID, $GUID, $editID, $modelID, $modelGUID, $type ) = mysqli_fetch_array( $result ) )
{
$text .= <<$noiseID |
$GUID |
$editID |
$modelID |
$modelGUID |
$type |
HTML;
}
$text .= "\n\n" .
"\n";
}
}
$query = "SELECT noiseID, noiseGUID, editedDataID, modelID, modelGUID, noiseType " .
"FROM noise " .
"WHERE editedDataID IN ( $editIDs_csv ) " .
"ORDER BY noiseID ";
$result = mysqli_query( $link, $query )
or die( "Query failed : $query
\n" . mysqli_error($link) );
if ( mysqli_num_rows( $result ) != 0 )
{
$text .= <<
Noise Linked to Edit Profiles
ID |
GUID |
Edit ID |
Model ID |
Model GUID |
Type |
HTML;
while ( list ( $noiseID, $GUID, $editID, $modelID, $modelGUID, $type ) = mysqli_fetch_array( $result ) )
{
$text .= <<$noiseID |
$GUID |
$editID |
$modelID |
$modelGUID |
$type |
HTML;
}
$text .= "\n\n" .
"\n";
}
$reportIDs = array();
$query = "SELECT reportID, reportGUID, title " .
"FROM report " .
"WHERE experimentID = $experimentID " .
"ORDER BY reportID ";
$result = mysqli_query( $link, $query )
or die( "Query failed : $query
\n" . mysqli_error($link) );
if ( mysqli_num_rows( $result ) != 0 )
{
$text .= <<
Reports Related to This Experiment
ID |
GUID |
Title |
HTML;
while ( list ( $reportID, $GUID, $title ) = mysqli_fetch_array( $result ) )
{
$reportIDs[] = $reportID;
$text .= <<$reportID |
$GUID |
$title |
HTML;
}
$text .= "\n\n" .
"\n";
}
$reportTripleIDs = array();
if ( ! empty( $reportIDs ) )
{
$reportIDs_csv = implode( ",", $reportIDs );
$query = "SELECT reportTripleID, reportTripleGUID, resultID, triple, dataDescription, reportID " .
"FROM reportTriple " .
"WHERE reportID IN ( $reportIDs_csv ) " .
"ORDER BY reportID, reportTripleID ";
$result = mysqli_query( $link, $query )
or die( "Query failed : $query
\n" . mysqli_error($link) );
if ( mysqli_num_rows( $result ) != 0 )
{
$text .= <<
Report Triples Related to Reports
ID |
GUID |
Result ID |
Triple |
Description |
Report ID |
HTML;
while ( list ( $reportTripleID, $GUID, $resultID, $triple, $dataDesc, $rptID )
= mysqli_fetch_array( $result ) )
{
$reportTripleIDs[] = $reportTripleID;
$text .= <<$reportTripleID |
$GUID |
$resultID |
$triple |
$dataDesc |
$rptID |
HTML;
}
$text .= "\n\n" .
"\n";
}
}
if ( ! empty( $reportTripleIDs ) )
{
$reportTripleIDs_csv = implode( ",", $reportTripleIDs );
$query = "SELECT d.reportDocumentID, reportDocumentGUID, editedDataID, label, " .
"filename, analysis, subAnalysis, documentType, l.reportTripleID " .
"FROM documentLink l, reportDocument d " .
"WHERE reportTripleID IN ( $reportTripleIDs_csv ) " .
"AND l.reportDocumentID = d.reportDocumentID " .
"ORDER BY reportTripleID, reportDocumentID ";
$result = mysqli_query( $link, $query )
or die( "Query failed : $query
\n" . mysqli_error($link) );
if ( mysqli_num_rows( $result ) != 0 )
{
$text .= <<
Report Documents Related to Triples
ID |
GUID |
Edit ID |
Label/Filename |
Anal/Sub/DocType |
Trip ID |
HTML;
while ( list ( $reportDocumentID, $GUID, $editID, $label, $filename,
$analysis, $subAnal, $docType, $tripID )
= mysqli_fetch_array( $result ) )
{
$text .= <<$reportDocumentID |
$GUID |
$editID |
$label/$filename |
$analysis/$subAnal/$docType |
$tripID |
HTML;
}
$text .= "\n\n" .
"\n";
}
}
$query = "SELECT HPCAnalysisRequestID, HPCAnalysisRequestGUID, editXMLFilename, " .
"submitTime, clusterName, method " .
"FROM HPCAnalysisRequest " .
"WHERE experimentID = $experimentID " .
"ORDER BY HPCAnalysisRequestID ";
$result = mysqli_query( $link, $query )
or die( "Query failed : $query
\n" . mysqli_error($link) );
if ( mysqli_num_rows( $result ) == 0 )
return $text;
$requestIDs = array();
$text .= <<
HPC Requests
ID |
GUID |
XML Filename |
Submit |
Cluster |
Method |
HTML;
while ( list( $ID, $GUID, $filename, $submit, $cluster, $method ) = mysqli_fetch_array( $result ) )
{
$requestIDs[] = $ID;
$text .= <<$ID |
$GUID |
$filename |
$submit |
$cluster |
$method |
HTML;
}
$text .= "\n\n" .
"\n";
$requestIDs_csv = implode( ", ", $requestIDs );
$query = "SELECT HPCAnalysisResultID, HPCAnalysisRequestID, gfacID, queueStatus, updateTime " .
"FROM HPCAnalysisResult " .
"WHERE HPCAnalysisRequestID IN ( $requestIDs_csv ) " .
"ORDER BY HPCAnalysisResultID ";
$result = mysqli_query( $link, $query )
or die( "Query failed : $query
\n" . mysqli_error($link) );
if ( mysqli_num_rows( $result ) != 0 )
{
$text .= <<
HPC Results
ID |
Request ID |
gfac ID |
Status |
Updated |
HTML;
$incomplete = array();
while ( list( $ID, $requestID, $gfacID, $status, $updated ) = mysqli_fetch_array( $result ) )
{
if ( $status != 'completed' )
$incomplete[] = $gfacID;
$text .= <<$ID |
$requestID |
$gfacID |
$status |
$updated |
HTML;
}
$text .= "\n\n" .
"\n";
}
if ( empty( $incomplete ) )
return $text;
// Now switch over to the global db
global $globaldbhost, $globaldbuser, $globaldbpasswd, $globaldbname;
$globaldb = mysqli_connect( $globaldbhost, $globaldbuser, $globaldbpasswd, $globaldbname );
if ( ! $globaldb )
{
$text .= "Cannot open global database on $globaldbhost : $globaldbname
\n";
return $text;
}
$text .= <<
GFAC Status
gfacID |
Cluster |
DB |
Status |
Message |
Updated |
HTML;
$in_queue = 0;
foreach ( $incomplete as $gfacID )
{
$query = "SELECT cluster, us3_db, status, queue_msg, time " .
"FROM analysis " .
"WHERE gfacID = '$gfacID' ";
$result = mysqli_query( $link, $query )
or die( "Query failed : $query
\n" . mysqli_error($link) );
if ( mysqli_num_rows( $result ) == 1 )
{
$in_queue++;
list( $cluster, $db, $status, $msg, $time ) = mysqli_fetch_array( $result );
$text .= <<$gfacID |
$cluster |
$db |
$status |
$msg |
$time |
HTML;
}
}
if ( $in_queue == 0 )
$text .= "No local jobs currently in the queue |
\n";
$text .= "\n\n" .
"\n";
mysqli_close( $globaldb );
return $text;
}
function HPCDetail( $requestID )
{
global $link;
$query = "SELECT * FROM HPCAnalysisRequest WHERE HPCAnalysisRequestID=$requestID";
$result = mysqli_query( $link, $query )
or die( "Query failed : $query
\n" . mysqli_error($link));
$row = mysqli_fetch_assoc( $result );
$row['requestXMLFile'] = '' . htmlentities( $row['requestXMLFile'] ) . '
';
// Save for later
$requestGUID = $row['HPCAnalysisRequestGUID'];
$cluster = $row['clusterName'];
#var_dump($cluster);
$text = <<
HPC Request Detail
HTML;
foreach ($row as $key => $value)
{
$text .= " $key | $value |
\n";
}
$text .= "\n";
$query = "SELECT * FROM HPCAnalysisResult WHERE HPCAnalysisRequestID=$requestID";
$result = mysqli_query( $link, $query )
or die( "Query failed : $query
\n" . mysqli_error($link));
$row = mysqli_fetch_assoc( $result );
$row['jobfile'] = '' . htmlentities( $row['jobfile'] ) . '
';
// Get GFAC job status
global $uses_airavata;
if ( $uses_airavata === true )
{
$row['gfacStatus'] = nl2br( getExperimentStatus( $row['gfacID'] ) );
}
else
{
$row['gfacStatus'] = nl2br( getJobstatus( $row['gfacID'] ) );
}
// Get queue messages from disk directory, if it still exists
global $submit_dir;
global $dbname;
$msg_filename = "$submit_dir$requestGUID/$dbname-$requestID-messages.txt";
$queue_msgs = false;
if ( file_exists( $msg_filename ) )
{
$queue_msgs = file_get_contents( $msg_filename );
$len_msgs = strlen( $queue_msgs );
$queue_msgs = '' . $queue_msgs . '
';
}
// Get resulting model and noise information
if ( ! empty( $resultID ) )
{
$resultID = $row['HPCAnalysisResultID'];
$models = array();
$noise = array();
$query = "SELECT resultID FROM HPCAnalysisResultData " .
"WHERE HPCAnalysisResultID = $resultID " .
"AND HPCAnalysisResultType = 'model' ";
$result = mysqli_query( $link, $query )
or die( "Query failed : $query
\n" . mysqli_error($link));
$models = mysqli_fetch_row( $result ); // An array with all of them
if ( $models !== false )
$row['modelIDs'] = implode( ", ", $models );
$query = "SELECT resultID FROM HPCAnalysisResultData " .
"WHERE HPCAnalysisResultID = $resultID " .
"AND HPCAnalysisResultType = 'noise' ";
$result = mysqli_query( $link, $query )
or die( "Query failed : $query
\n" . mysqli_error($link));
$noise = mysqli_fetch_row( $result ); // An array with all of them
if ( $noise !== false )
$row['noiseIDs'] = implode( ", ", $noise );
}
$text .= <<
HPC Result Detail
HTML;
foreach ($row as $key => $value)
{
$text .= " $key | $value |
\n";
}
if ( $queue_msgs !== false )
{
$linkmsg = "Length Messages";
$text .= " $linkmsg | $len_msgs |
\n";
if ( isset( $_GET[ 'msgs' ] ) )
$text .= " Queue Messages | $queue_msgs |
\n";
}
$text .= "
\n";
return $text;
}
?>