delayed-job

Indicate to an ajax process that the delayed job has completed

元气小坏坏 提交于 2019-11-28 21:52:15
I have a Rails 3 app that uses delayed_job to fetch some data (with a class method) when the user hits the page. How can I indicate to the ajax process that the class method has run (so that I can stop polling)? EDIT: To clarify, I want to know when the delayed_job has run, not when the ajax process has succeeded. Then I want to pass the delayed_job completed status to the running ajax process. Typically, the best way to do this is to store, in your database, an indication of the job's progress. For instance: class User def perform_calculation begin self.update_attributes :calculation_status =

Gems/Services for autoscaling Heroku's dynos and workers

Deadly 提交于 2019-11-28 18:21:04
I want to know if there are any good solutions for autoscaling dynos AND workers on Heroku in a production environment (probably a different solution for each of those, as they are pretty unrelated). What are you/companies using, regarding this? I found lots of options, but none of them seem really mature for a production environment. There is Heroscale, which seem to introduce some latency as it does not run locally, and I also heard of some downtime. There are modifications of delayed_jobs, which have not been updated for a long time, and there are some issues with current bundlers. There is

polling with delayed_job

前提是你 提交于 2019-11-28 15:44:22
I have a process which takes generally a few seconds to complete so I'm trying to use delayed_job to handle it asynchronously. The job itself works fine, my question is how to go about polling the job to find out if it's done. I can get an id from delayed_job by simply assigning it to a variable: job = Available.delay.dosomething(:var => 1234) +------+----------+----------+------------+------------+-------------+-----------+-----------+-----------+------------+-------------+ | id | priority | attempts | handler | last_error | run_at | locked_at | failed_at | locked_by | created_at | updated_at

Rails Delayed Job & Library Class

耗尽温柔 提交于 2019-11-28 09:21:17
Hey we have a library class (lib/Mixpanel) that calls delayed job as follows: class Mixpanel attr_accessor :options attr_accessor :event def track!() .. dj = send_later :access_api # also tried with self.send_later .. end def access_api .. end The problem is that when we run rake jobs:work: we get the following error: undefined method `access_api' for #<YAML::Object:0x24681b8> Any idea why? Delayed_job always autoloads ActiveRecord classes, but it doesn't know about other types of classes (like lib) that it has marshaled in the db as YML. So, you need to explicitly trigger the class loader for

How to cancel scheduled job with delayed_job in Rails?

痞子三分冷 提交于 2019-11-28 03:56:40
I am scheduling a job to run in say, 10 minutes. How to properly cancel this particular job without using any kind of dirty extra fields in model and so on. Is there any call to remove particular job, or jobs related to specific model, instance, etc? disclaimer: I am not an expert user of delayed_job... " Is there any call to remove particular job, or jobs related to specific model, instance, etc? " Delayed::Job is just an ActiveRecord object so you can find and destroy any of those records. Depending on your use case this could be handled different ways. If someone is going to manually

Best Ruby on Rails Architecture for Image Heavy App

一笑奈何 提交于 2019-11-28 03:36:45
I'm building an application that allows for large amounts of photo uploads at once, and wanted to know what the best setup would be to tackle this. This is what I am using so far: Jquery File Upload: allows users to drag and drop images CarrierWave: Processes images and resizes them with ImageMagick Amazon S3: CarrierWave uploads images to Amazon S3 through Fog Heroku: for hosting I'd like to allow users to be able to drag and drop a large amount of images onto a page, and then navigate to other pages while the upload is going on in the background. I'd also like pictures to appear as they

How to deploy resque workers in production?

僤鯓⒐⒋嵵緔 提交于 2019-11-28 02:55:46
The GitHub guys recently released their background processing app which uses Redis: http://github.com/defunkt/resque http://github.com/blog/542-introducing-resque I have it working locally, but I'm struggling to get it working in production. Has anyone got a: Capistrano recipe to deploy workers (control number of workers, restarting them, etc) Deployed workers to separate machine(s) from where the main app is running, what settings were needed here? gotten redis to survive a reboot on the server (I tried putting it in cron but no luck) how did you work resque-web (their excellent monitoring

Getting delayed job to log

人盡茶涼 提交于 2019-11-27 19:05:53
#Here is how I have delayed job set up. Delayed::Worker.backend = :active_record #Delayed::Worker.logger = Rails.logger Delayed::Worker.logger = ActiveSupport::BufferedLogger.new("log/ ##{Rails.env}_delayed_jobs.log", Rails.logger.level) Delayed::Worker.logger.auto_flushing = 1 class Delayed::Job def logger Delayed::Worker.logger end end if JobsCommon::check_job_exists("PeriodicJob").blank? Delayed::Job.enqueue PeriodicJob.new(), 0, 30.seconds.from_now end #end #Here is my simple job. class PeriodicJob def perform Rails.logger.info "Periodic job writing #{Time.now}" Delayed::Job.enqueue

Node.js workers/background processes

不羁的心 提交于 2019-11-27 17:15:41
How can I create and use background jobs in node.js? I've come across two libs (node-resque and node-worker) but would like to know if there's something more used. Alfred I did some research on this and I would do it like this. Setup beanstalkd Install beanstalkd . Another message queue, BUT this one supports DELAYED PUTS . If you compile from source it is going to be a little harder because it depends on libevent (like memcached). But then again, I don't think you have to compile it from source, because there are a lot of binary packages available. For example on Ubuntu you can install

getaddrinfo: nodename nor servname provided, or not known

无人久伴 提交于 2019-11-27 11:17:10
I have a Ruby on Rails application that I am deploying on a computer running Mac OS X 10.6. The code where the problem arises is run by a delayed_job. The problem only occurs when it is run through delayed_job. If I run it within a console ( rails console production ) or call the API directly through cURL, it works without any problems. Also, the entire process works without issue in my development environment. Basically, the code works in one place, but for some reason, fails where it has to work. I've searched and found a few resources, but none of the suggestions apply or make any