Example #1
0
 /**
  * Set a Task’s Progress
  *
  * Example (inside a worker):
  * <code>
  * require_once "phar://iron_worker.phar";
  * $worker = new IronWorker(); # assuming you have iron.json inside a worker
  * $args = getArgs();
  * $task_id = $args['task_id'];
  * $worker->setProgress($task_id, 50, "Task is half-done");
  * </code>
  *
  * @param string $task_id Task ID
  * @param int $percent An integer, between 0 and 100 inclusive, that describes the completion of the task.
  * @param string $msg Any message or data describing the completion of the task. Must be a string value, and the 64KB request limit applies.
  * @return mixed
  * @throws CException
  */
 public function workerSetProgress($task_id, $percent, $msg = '')
 {
     try {
         return $this->_worker->setProgress($task_id, $percent, $msg);
     } catch (Exception $e) {
         Yii::log('Error in IronWorker: ' . $e->getMessage(), 'error', 'ext.yiiron');
         throw new CException($e->getMessage());
     }
 }