_createTaskReference($fileId, $brokerTaskId, $taskName); } } catch (Exception $e) { Logging::info("Invalid request: " . $e->getMessage()); } } /** * Create a CeleryTasks object for a pending task * TODO: should we have a database layer class to handle Propel operations? * * @param $fileId int CcFiles identifier * @param $brokerTaskId int broker task identifier to so we can asynchronously * receive completed task messages * @param $taskName string broker task name * * @throws Exception * @throws PropelException */ protected function _createTaskReference($fileId, $brokerTaskId, $taskName) { $trackReferenceId = $this->createTrackReference($fileId); $task = new CeleryTasks(); $task->setDbTaskId($brokerTaskId); $task->setDbName($taskName); $utc = new DateTimeZone("UTC"); $task->setDbDispatchTime(new DateTime("now", $utc)); $task->setDbStatus(CELERY_PENDING_STATUS); $task->setDbTrackReference($trackReferenceId); $task->save(); } /** * Update a CeleryTasks object for a completed task * TODO: should we have a database layer class to handle Propel operations? * * @param $task CeleryTasks the completed CeleryTasks object * @param $status string Celery task status * * @throws Exception * @throws PropelException */ public function updateTask($task, $status) { $task->setDbStatus($status); $task->save(); } /** * Update a ThirdPartyTrackReferences object for a completed upload * * @param $task CeleryTasks the completed CeleryTasks object * @param $trackId int ThirdPartyTrackReferences identifier * @param $track object third-party service track object * @param $status string Celery task status * * @throws Exception * @throws PropelException */ abstract function updateTrackReference($task, $trackId, $track, $status); }