private function spawn(KSchedularTaskConfig $taskConfig)
 {
     $taskIndex = $this->getNextAvailableIndex($taskConfig->name, $taskConfig->maxInstances);
     $taskIndex = intval($taskIndex);
     $this->lastRunTime[$taskConfig->name] = time();
     $this->nextRunIndex[$taskConfig->name] = $taskIndex + 1;
     KalturaLog::info("Executing {$taskConfig->name} [{$taskIndex}]");
     $tasksetPath = $this->schedulerConfig->getTasksetPath();
     $proc = new KProcessWrapper($taskIndex, $this->logDir, $this->phpPath, $tasksetPath, clone $taskConfig);
     $this->runningTasks[$taskConfig->name][$taskIndex] =& $proc;
     self::onRunningInstancesEvent($taskConfig, count($this->runningTasks[$taskConfig->name]));
 }
 private function spawn(KSchedularTaskConfig $taskConfig)
 {
     $taskIndex = $this->getNextAvailableIndex($taskConfig->name, $taskConfig->maxInstances);
     $taskIndex = intval($taskIndex);
     $this->nextRunIndex[$taskConfig->name] = $taskIndex + 1;
     $this->lastRunTime[$taskConfig->name] = time();
     KalturaLog::info("Executing {$taskConfig->name} [{$taskIndex}]");
     $tasksetPath = $this->schedulerConfig->getTasksetPath();
     $taskConf = clone $taskConfig;
     if (array_key_exists($taskConfig->id, $this->queueSizes)) {
         $taskConf->setQueueSize($this->queueSizes[$taskConfig->id]);
     } else {
         $taskConf->setQueueSize(0);
     }
     $proc = new KProcessWrapper($taskConfig, $taskIndex);
     $proc->init($this->logDir, $this->phpPath, $tasksetPath);
     $this->runningTasks[$taskConfig->name][$taskIndex] =& $proc;
     self::onRunningInstancesEvent($taskConfig, count($this->runningTasks[$taskConfig->name]));
 }