public static function runTask($params)
 {
     $task = $params->get('task');
     $parameters = $params->get('parameters');
     try {
         if (is_null($parameters)) {
             $result = Execute::runTask($task, array());
         } else {
             $result = Execute::runTask($task, $parameters);
         }
     } catch (Exception $e) {
         throw new RpcException($e->getMessage(), -31001);
     }
     return $result;
 }
 public function execute()
 {
     $task = $this->getArgument('task');
     $parameters = self::processParameters($this->getArgument('parameters'));
     print "\nExecuting task " . $task . "...\n";
     try {
         $run_result = SourceExecute::runTask($task, $parameters, $this->logger);
     } catch (Exception $e) {
         throw $e;
     }
     $pid = $run_result[0];
     $success = $run_result[2];
     $start_timestamp = $run_result[3];
     $end_timestamp = $run_result[4];
     $result = strlen($run_result[5]) >= 80 ? substr($run_result[5], 0, 80) . "..." : $run_result[5];
     $wid = $run_result[7];
     $tbl = new Console_Table(CONSOLE_TABLE_ALIGN_LEFT, CONSOLE_TABLE_BORDER_ASCII, 1, null, true);
     $tbl->setHeaders(array('Pid', 'Wid', 'Success', 'Result (truncated)', 'Time elapsed'));
     $tbl->addRow(array($pid, $wid, $this->color->convert($success ? "%gYES%n" : "%rNO%n"), $this->color->convert($success ? "%g" . $result . "%n" : "%r" . $result . "%n"), empty($end_timestamp) ? "--" : $end_timestamp - $start_timestamp));
     return $tbl->getTable();
 }