delayed-job

Use Delayed::Job to manage multiple job queues

▼魔方 西西 提交于 2019-11-30 19:08:42
I want to use Delayed::Job (or perhaps a more appropriate job queue to my problem) to dispatch jobs to multiple background daemons. I have several background daemons that carry out different responsibilities. Each one is interested in different jobs in the queue from the Rails app. Is this possible using Delayed::Job, or perhaps there is a different job queue that better fits this task? Since then http://github.com/collectiveidea/delayed_job has reached v3.0 and includes named queues! Excellent for simple grouped queue needs. If you like the Delayed Job, it'd be simple enough to create

rvm monit delayed_job

狂风中的少年 提交于 2019-11-30 19:05:42
问题 I am trying to run delayed_job using monit, but its failing to run as rvm's paths (local rvm installation per user basis) are not available to the command. My application is a rails2 app with bundler. Monit is not able to find bundler. Does anyone have any suggestions as to how i can tell about the rvm paths to monit? I am getting the error [rails@x-rws1 current]$ monit start delayed_job -c config/delayed_job.monitrc 'delayed_job' start: /usr/bin/env 'delayed_job' failed to start no such file

Rails 4.2 get delayed job id from active job

拟墨画扇 提交于 2019-11-30 18:08:53
Any idea how to get the Delayed::Job id from the ActiveJob enqueuing? When I enqueue a job I get back an instance of ActiveJob::Base with a @job_id , but that job id seems to be internal to ActiveJob. My best guess so far is just to walk down the most recently created jobs: active_job_id = GenerateReportJob.perform_later(self.id).job_id delayed_job = Delayed::Job.order(id: :desc).limit(5).detect do |job| YAML.load(job.handler).job_data['job_id'] == active_job_id end but that seems all kinds of hacky. Kind of surprised ActiveJob isn't returning the ID from Delayed::Job , especially since that

Store file in directory tmp on heroku Rails

99封情书 提交于 2019-11-30 14:43:12
问题 In my Delayed Job, I tried to create a file to tmp folder file_path = Rails.root.join('tmp', "#{file_name}." + file_extension); exported_file = kit.to_pdf # Save file to disk File.open(file_path, 'wb') do |file| file << exported_file end It works well in local but on Heroku there is a error in Delayed Job "No such file or directory - /app/tmp/test.pdf" So how I can solve this problem. I do not want to store file in S3. Thank you 回答1: Heroku uses what is called an ephemeral filesystem. This

Logging in delayed_job?

可紊 提交于 2019-11-30 12:40:36
问题 I can't get any log output from delayed_job , and I'm not sure my jobs are starting. Here's my Procfile: web: bundle exec rails server worker: bundle exec rake jobs:work worker: bundle exec clockwork app/clock.rb And here's the job: class ScanningJob def perform logger.info "logging from delayed_job" end def after(job) Rails.logger.info "logging from after delayed_job" end end I see that clockwork outputs to system out, and I can see worker executor starting, but I never see my log statements

Store file in directory tmp on heroku Rails

℡╲_俬逩灬. 提交于 2019-11-30 11:37:51
In my Delayed Job, I tried to create a file to tmp folder file_path = Rails.root.join('tmp', "#{file_name}." + file_extension); exported_file = kit.to_pdf # Save file to disk File.open(file_path, 'wb') do |file| file << exported_file end It works well in local but on Heroku there is a error in Delayed Job "No such file or directory - /app/tmp/test.pdf" So how I can solve this problem. I do not want to store file in S3. Thank you Heroku uses what is called an ephemeral filesystem . This means that your local filesystem is only accessible to a single dyno, and once the dyno is stopped, restarted

log doesn't work in production with delayed job

依然范特西╮ 提交于 2019-11-30 10:30:36
I'm suffering some weird issue where my delayed_jobs are failing in production. Finally I narrowed it down to the logger. If I comment out my log function calls, everything works. However if I try to log, I get this in the delayed_job handler: --- !ruby/struct:Delayed::PerformableMethod object: AR:User:1 method: :load_and_update_without_send_later args: [] | closed stream /opt/ruby/lib/ruby/1.8/logger.rb:504:in `write' /opt/ruby/lib/ruby/1.8/logger.rb:504:in `write' /opt/ruby/lib/ruby/1.8/monitor.rb:242:in `synchronize' /opt/ruby/lib/ruby/1.8/logger.rb:496:in `write' /opt/ruby/lib/ruby/1.8

delayed_job not logging

青春壹個敷衍的年華 提交于 2019-11-30 08:36:21
问题 I cannot log messages from my delayed_job process. Here is the job that is being run. class MyJob def initialize(blahblah) @blahblah = blahblah @logger = Logger.new(File.join(Rails.root, 'log', 'delayed_job.log')) end def perform @logger.add Logger::INFO, "logging from delayed_job" #do stuff end end I've tried various logging levels, and I have config.log_level = :debug in my environment configuration. I run delayed_job from monit. I'm using delayed_job 3.0.1 with ruby 1.9.3 and rails 3.0.10.

How to ignore Delayed Job query logging in development on Rails

冷暖自知 提交于 2019-11-30 08:31:44
How would I silence/ignore these Delayed Job query logs from log/development.log? Delayed::Backend::ActiveRecord::Job Load (1.0ms) UPDATE "delayed_jobs" SET locked_at = '2013-11-19 19:55:45.053991', locked_by = 'host:desktop-virtual pid:22277' WHERE id IN (SELECT id FROM "delayed_jobs" WHERE ((run_at <= '2013-11-19 19:55:45.053435' AND (locked_at IS NULL OR locked_at < '2013-11-19 15:55:45.053519') OR locked_by = 'host:desktop-virtual pid:22277') AND failed_at IS NULL) ORDER BY priority ASC, run_at ASC LIMIT 1 FOR UPDATE) RETURNING * Delayed::Backend::ActiveRecord::Job Load (1.4ms) UPDATE

Rails 3/delayed_job - Wanted: Basic example of delayed mail

偶尔善良 提交于 2019-11-30 07:33:36
I've been trying to figure out how to send delayed mail using delayed_job with rails 3. I've tried pretty much every combination of feasible possibilities I can think of - I can get the mail to run in the background, I just can't get it to delay the sending to a future time. The delayed_jobs table in the db clears the tasks, the log says 'sent', the delayed_job task processor picks up the task & says sent without failure...but the mail is either: sent immediately, or simply doesn't arrive if I try to send in the future. If anyone could offer a bare-bones example of a rails 3 delayed_job that