public function run($jobs = null) { KalturaLog::info("Schedule helper batch is running"); try { $systemReady = self::$kClient->system->ping(); if (!$systemReady) { KalturaLog::err("System is not yet ready - ping failed"); return; } } catch (KalturaClientException $e) { KalturaLog::err("System is not yet ready - ping failed"); return; } $scheduler = new KalturaScheduler(); $scheduler->configuredId = $this->getSchedulerId(); $scheduler->name = $this->getSchedulerName(); $scheduler->host = KSchedulerConfig::getHostname(); // get command results from the scheduler $commandResults = KScheduleHelperManager::loadResultsCommandsFile(); KalturaLog::info(count($commandResults) . " command results returned from the scheduler"); if (count($commandResults)) { $this->sendCommandResults($commandResults); } // get config from the schduler $configItems = KScheduleHelperManager::loadConfigItems(); if (count($configItems)) { KalturaLog::info(count($configItems) . " config records sent from the scheduler"); $this->sendConfigItems($scheduler, $configItems); } $filters = KScheduleHelperManager::loadFilters(); KalturaLog::info(count($filters) . " filter records found for the scheduler"); // get status from the schduler $statuses = KScheduleHelperManager::loadStatuses(); KalturaLog::info(count($statuses) . " status records sent from the scheduler"); // send status to the server $statusResponse = self::$kClient->batchcontrol->reportStatus($scheduler, (array) $statuses, (array) $filters); KalturaLog::info(count($statusResponse->queuesStatus) . " queue status records returned from the server"); KalturaLog::info(count($statusResponse->controlPanelCommands) . " control commands returned from the server"); KalturaLog::info(count($statusResponse->schedulerConfigs) . " config items returned from the server"); // send commands to the scheduler $commands = array_merge($statusResponse->queuesStatus, $statusResponse->schedulerConfigs, $statusResponse->controlPanelCommands); KalturaLog::info(count($commands) . " commands sent to scheduler"); $this->saveSchedulerCommands($commands); }