send(); $xml = $post->getResponseBody(); } catch ( HttpException $e ) { write_log( "$self: Set status unsuccessful - $gfacID" ); return false; } // Parse the result // Not sure we need to know $gfac_status = parse_response( $xml ); // return $gfac_status; return true; } // Function to update the global database status (AThrift + Finished) function update_aira( $gfacID, $message ) { global $dbhost; global $guser; global $gpasswd; global $gDB; global $self; // Get data from global GFAC DB $gLink = mysql_connect( $dbhost, $guser, $gpasswd ); if ( ! mysql_select_db( $gDB, $gLink ) ) { write_log( "$self: Could not select DB $gDB" . mysql_error( $gLink ) ); return; } // Update message and update status to 'FINISHED' $query = "UPDATE analysis SET status='FINISHED', " . "queue_msg='" . mysql_real_escape_string( $message ) . "' " . "WHERE gfacID='$gfacID'"; mysql_query( $query, $gLink ); write_log( "$self: Status FINISHED and 'Finished...' message updated" ); // Also update the queue_messages table $query = "SELECT id FROM analysis " . "WHERE gfacID = '$gfacID'"; $result = mysql_query( $query, $gLink ); if ( ! $result ) { write_log( "$self: bad query: $query " . mysql_error( $gLink ) ); return; } if ( mysql_num_rows( $result ) == 0 ) { // write_log( "$self: can't find $gfacID in GFAC db" ); return; } list( $aID ) = mysql_fetch_array( $result ); $query = "INSERT INTO queue_messages " . "SET analysisID = $aID, " . "message = '" . mysql_real_escape_string( $message ) . "'"; $result = mysql_query( $query, $gLink ); if ( ! $result ) { write_log( "$self: bad query: $query " . mysql_error( $gLink ) ); return; } mysql_close( $gLink ); } ?>