/** * @return JobOptionsValidator */ private function getJobOptionsValidator() { if ($this->job_options_validator) { return $this->job_options_validator; } $this->job_options_validator = new JobOptionsValidator($this->config->getWorkerConfig()); return $this->job_options_validator; }
/** * @return ManagerInterface * @throws Exception */ public function getManager() { $daemon_config = $this->config->getDaemonConfig(); $type = $daemon_config['type']; if (!isset($this->manager_factories[$type])) { throw new Exception("A daemon manager factory is not associated with '{$type}'."); } $manager_factory = $this->manager_factories[$type]; return new $manager_factory($this->config); }
/** * @return array */ private function getRawDaemonConfig() { $defaults = ['config_path' => '/etc/supervisord/conf.d/hodor.conf', 'process_owner' => 'apache', 'program_prefix' => 'hodor', 'program_name' => '{{PROGRAM_PREFIX}}-{{WORKER_TYPE}}-{{WORKER_NAME}}', 'logs' => ['error' => ['path' => '/var/log/hodor/%(program_name)s_%(process_num)d.error.log', 'max_size' => '10MB', 'rotate_count' => 2], 'debug' => ['path' => '/var/log/hodor/%(program_name)s_%(process_num)d.debug.log', 'max_size' => '10MB', 'rotate_count' => 2]]]; return array_replace_recursive($defaults, $this->config->getDaemonConfig()); }
/** * @covers ::__construct * @covers ::getDaemonConfig * @covers ::getOption * @dataProvider configProvider */ public function testDaemonConfigCanBeRetrieved($options) { $config = new Config(__FILE__, $options); $this->assertEquals($options['daemon'], $config->getDaemonConfig()); }
/** * @param string $name * @param array $params * @param array $options * @return BufferQueue */ public function getBufferQueueForJob($name, array $params, array $options) { $queue_name = $this->config->getJobQueueConfig()->getBufferQueueName($name, $params, $options); return $this->getQueue($queue_name); }