public function perform() { printf("Starting movie %s\n", $this->args['movieId']); // Build movie try { $movie = new Movie_HelioviewerMovie($this->args['movieId']); $movie->build(); } catch (Exception $e) { // Handle any errors encountered printf("Error processing movie %s\n", $this->args['movieId']); logErrorMsg($e->getMessage(), "Resque_"); // If counter was increased at queue time, decrement $this->_updateCounter(); throw $e; } printf("Finished movie %s\n", $this->args['movieId']); $this->_updateCounter(); // If the queue is empty and no jobs are being processed, set estimated // time counter to zero //$numWorking = sizeOf($redis->keys("resque:worker:*".HV_MOVIE_QUEUE)); //$queueSize = $redis->llen("resque:queue:".HV_MOVIE_QUEUE); //if ($numWorking <= 1 && $queueSize == 0) { // $redis->set('helioviewer:movie_queue_wait', 0); // return; //} }
/** * Handles errors encountered during request processing. * * @param string $msg The error message to display * @param int $errorCode Error code number * * Error Codes: * 1 DATABASE Unable to connect * 2 DATABASE Query error * 10 DATA No images found for specified datasource * 11 DATA No images found before/after specified start/end date * 12 DATA No images found in requested time range * 13 DATA Unable to process JPEG 2000 XML header box * 14 DATA Failed to decode JPEG 2000 image data * 15 DATA Error encountered while parsing image header tags * 16 DATA Insufficient data found in requested time range * 20 REQUEST No valid layers specified for request * 21 REQUEST No overlap between ROI and data in one or more dimensions * 22 REQUEST Invalid layers or quantity of layers specified * 23 REQUEST Region of interest not properly specified * 24 REQUEST Unable to locate the specified item * 25 REQUEST Invalid value specified for request parameter * 26 REQUEST Unsupported feature * 27 REQUEST Unrecognize request parameter * 28 REQUEST Required parameter missing * 30 IMAGE Unable to create one or more composite image layers * 31 IMAGE Image composition failed * 32 IMAGE Unable to apply color table * 33 IMAGE Unable to read image from cache * 40 MOVIE Queue full * 41 MOVIE Attempt to upload invalid or unfinished movie * 42 MOVIE Error encountered during authentication with YouTube * 43 MOVIE Error encountered during video encoding * 44 MOVIE Attempt to rebuild processed movie * 45 MOVIE Attempt to upload without authorizing * 46 MOVIE Attempt to upload movie more than once * 47 MOVIE Movie Already Exist * 50 SYSTEM Permissions error * 60 JHV Failed to create JPX * 61 JHV JPX creation taking too long * 62 JHV JPX summary file not found * 255 GENERAL Unexpected error * * * Note: If multiple levels of verbosity are needed, one option would be to * split up the complete error message into it's separate parts, add * a "details" field with the full message, and display only the * top-level error message in "error" */ function handleError($msg, $errorCode = 255) { // error_log('Error Code '.$errorCode.': '.$msg); header('Content-type: application/json;charset=UTF-8'); // JSON echo json_encode(array('error' => $msg, 'errno' => $errorCode)); // Don't log non-harmful errors $dontLog = array(12, 16, 23, 25, 26, 40, 42, 44, 45, 46); if (!in_array($errorCode, $dontLog)) { logErrorMsg($msg); } }
/** * Checks to see if the user is currently authenticated, and that any * previous authentication is not expired * * @return bool Returns true if the user is authenticated and that * authentication is still good, and false otherwise */ private function _authorizationIsValid() { if ($this->_httpClient->isAccessTokenExpired()) { unset($_SESSION['sessionToken']); return false; } if ($this->_httpClient->getAccessToken()) { return true; } else { //Zend_Gdata_App_HttpException include_once HV_ROOT_DIR . '/../src/Helper/ErrorHandler.php'; logErrorMsg($msg, 'Youtube_'); // Discard expired authorization unset($_SESSION['sessionToken']); return false; } return true; }