public function buildJob(JobBuilder $builder, array $options) { $builder->add('example_extractor', 'json_extractor', ['path' => 'results'])->add('example_transformer', 'callback_transformer', ['callback' => function ($value, $target) { $img = sprintf('http://maps.googleapis.com/maps/api/streetview?size=800x600&location=%F,%F&fov=90&heading=235&pitch=10&sensor=false', $value->geometry->location->lat, $value->geometry->location->lng); return file_get_contents($img); }, 'metadata_write' => ['place_id' => 'id']])->add('example_loader', 'file_loader', ['args' => function (Options $options) { $values = $options['execution']->read(); $metadata = $values[0]->getMetadata(); return [new \SplFileObject(__DIR__ . "/../temp/job-" . $metadata['place_id'] . ".jpeg", 'w+')]; }]); }
public function buildJob(JobBuilder $builder, array $options) { $builder->add('extract_user_url', 'json_extractor', ['path' => '*.url', 'adapter' => function ($resource) { // Github api need an user agent $context = stream_context_create(['http' => ['header' => 'User-Agent: jobflow']]); return file_get_contents($resource, false, $context); }])->add('get_user_url', 'callback_transformer', array('callback' => function ($value, $target) { return $value . '?access_token=236b93940ce523226035931f67d2de6bcc1aeab9'; }))->add('users_loader', 'pipe_loader')->add('email_extractor', 'json_extractor', ['adapter' => function ($resource) { $context = stream_context_create(['http' => ['header' => 'User-Agent: jobflow']]); return file_get_contents($resource, false, $context); }])->add('get_user_email', 'callback_transformer', array('callback' => function ($value, $target) { if (property_exists($value, 'email') && strlen($value->email)) { return $value->email . "\n"; } return ''; }))->add('email_loader', 'file_loader'); }
/** * {@inheritdoc} */ public function buildJob(JobBuilder $builder, array $options) { $builder->setRequeue($options['requeue']); }
/** * {@inheritdoc} */ public function buildJob(JobBuilder $builder, array $options) { $builder->addEventSubscriber(new LoggerListener($this->logger)); }
public function buildJob(JobBuilder $builder, array $options) { $builder->setAttribute('etl_type', $options['etl_type']); }