コード例 #1
0
ファイル: BufferQueue.php プロジェクト: lightster/hodor
 /**
  * @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;
 }
コード例 #2
0
ファイル: ManagerFactory.php プロジェクト: lightster/hodor
 /**
  * @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);
 }
コード例 #3
0
 /**
  * @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());
 }
コード例 #4
0
ファイル: ConfigTest.php プロジェクト: lightster/hodor
 /**
  * @covers ::__construct
  * @covers ::getDaemonConfig
  * @covers ::getOption
  * @dataProvider configProvider
  */
 public function testDaemonConfigCanBeRetrieved($options)
 {
     $config = new Config(__FILE__, $options);
     $this->assertEquals($options['daemon'], $config->getDaemonConfig());
 }
コード例 #5
0
 /**
  * @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);
 }