Пример #1
0
 /**
  * @param KSchedularTaskConfig $taskConfig
  */
 protected function __construct(KSchedularTaskConfig $taskConfig)
 {
     parent::__construct($taskConfig);
     $username = $this->taskConfig->params->wsdlUsername;
     $password = $this->taskConfig->params->wsdlPassword;
     KalturaLog::debug("Connecting to Akamai(username: {$username}, password: {$password})");
     $this->streamClient = new AkamaiStreamsClient($username, $password);
 }
 protected function provision(KalturaBatchJob $job, KalturaProvisionJobData $data)
 {
     $job = $this->updateJob($job, null, KalturaBatchJobStatus::QUEUED);
     $engine = KProvisionEngine::getInstance($job->jobSubType, $data);
     if ($engine == null) {
         $err = "Cannot find provision engine [{$job->jobSubType}] for job id [{$job->id}]";
         return $this->closeJob($job, KalturaBatchJobErrorTypes::APP, KalturaBatchJobAppErrors::ENGINE_NOT_FOUND, $err, KalturaBatchJobStatus::FAILED);
     }
     KalturaLog::info("Using engine: " . $engine->getName());
     $results = $engine->provide($job, $data);
     if ($results->status == KalturaBatchJobStatus::FINISHED) {
         return $this->closeJob($job, null, null, null, KalturaBatchJobStatus::ALMOST_DONE, $results->data);
     }
     return $this->closeJob($job, KalturaBatchJobErrorTypes::APP, null, $results->errMessage, $results->status, $results->data);
 }
 protected function closeProvisionProvide(KalturaBatchJob $job)
 {
     if ($job->queueTime + self::$taskConfig->params->maxTimeBeforeFail < time()) {
         return new KProvisionEngineResult(KalturaBatchJobStatus::CLOSER_TIMEOUT, "Timed out");
     }
     $engine = KProvisionEngine::getInstance($job->jobSubType, $job->data);
     if ($engine == null) {
         $err = "Cannot find provision engine [{$job->jobSubType}] for job id [{$job->id}]";
         return $this->closeJob($job, KalturaBatchJobErrorTypes::APP, KalturaBatchJobAppErrors::ENGINE_NOT_FOUND, $err, KalturaBatchJobStatus::FAILED);
     }
     KalturaLog::info("Using engine: " . $engine->getName());
     $results = $engine->checkProvisionedStream($job, $job->data);
     if ($results->status == KalturaBatchJobStatus::FINISHED) {
         return $this->closeJob($job, null, null, null, KalturaBatchJobStatus::FINISHED, $results->data);
     }
     return $this->closeJob($job, null, null, $results->errMessage, KalturaBatchJobStatus::ALMOST_DONE, $results->data);
 }
 /**
  * @param KSchedularTaskConfig $taskConfig
  * @param KalturaProvisionJobData $data
  */
 protected function __construct(KSchedularTaskConfig $taskConfig, KalturaProvisionJobData $data = null)
 {
     parent::__construct($taskConfig);
     $username = null;
     $password = null;
     if (!is_null($data) && $data instanceof KalturaAkamaiProvisionJobData) {
         //all fields are set and are not empty string
         if ($data->wsdlUsername && $data->wsdlPassword && $data->cpcode && $data->emailId && $data->primaryContact) {
             $username = $data->wsdlUsername;
             $password = $data->wsdlPassword;
         }
     }
     //if one of the params was not set, use the taskConfig data
     if (!$username || !$password) {
         $username = $this->taskConfig->params->wsdlUsername;
         $password = $this->taskConfig->params->wsdlPassword;
     }
     KalturaLog::debug("Connecting to Akamai(username: {$username}, password: {$password})");
     $this->streamClient = new AkamaiStreamsClient($username, $password);
 }