Beispiel #1
0
 /**
  * @param Elasticsearch\Job $job
  * @param StorageApi\OrchestrationTask $task
  * @param Encryptor $encryptor
  * @return \GuzzleHttp\Psr7\Response
  */
 public function sendOrchestratorRequest(Elasticsearch\Job $job, StorageApi\OrchestrationTask $task, Encryptor $encryptor)
 {
     $timeout = $task->getTimeoutMinutes() ? $task->getTimeoutMinutes() : KeboolaOrchestratorBundle::TIMEOUT_MINUTES;
     try {
         return $this->post($task->getComponentUrl(), array('config' => array('curl' => array(CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_0)), 'body' => json_encode($task->getActionParameters()), 'headers' => array('X-StorageApi-Token' => $encryptor->decrypt($job->getToken()), 'X-KBC-RunId' => $job->getRunId(), 'X-User-Agent', KeboolaOrchestratorBundle::SYRUP_COMPONENT_NAME . " - JobExecutor"), 'timeout' => $timeout * 60));
     } catch (RequestException $e) {
         $handlerContext = $e->getHandlerContext();
         if (is_array($handlerContext)) {
             if (array_key_exists('errno', $handlerContext)) {
                 if ($handlerContext['errno'] == CURLE_OPERATION_TIMEOUTED) {
                     $this->logger->debug('curl.debug', array('handlerContext' => $e->getHandlerContext()));
                     //						throw new Exception\JobRuntimeException(sprintf('Task processing timeout after %d minutes', $timeout));
                 }
             }
         }
         throw $e;
     }
 }
Beispiel #2
0
 /**
  * @return mixed
  */
 public function getActionParameters()
 {
     return $this->task->getActionParameters();
 }