DelayedJob: Job failed to load: uninitialized constant Syck::Syck
I wrote a post about it.
http://www.kensodev.com/2011/08/16/uninitialized-constant-sycksyck-nameerror/
Job failed to load: uninitialized constant Syck::Syck
Include the following lines of code in boot.rb (config\boot.rb)
require 'yaml'
YAML::ENGINE.yamler= 'syck'
DelayedJob: How to solve the problem Job failed to load?
I found a solution that works for me. You can redefine the 'Object#to_yaml_properties' method within your Contact class to only include the properties you need. And thus exclude the 'errors' variable.
def to_yaml_properties
['@full_name', '@email', '@subject', '@message']
end
Hope this helps.
uninitialized constant Delayed::Job
Did you follow the installation instructions on the README file? https://github.com/collectiveidea/delayed_job
Add this to your gemfile:
gem 'delayed_job_active_record'
and then run this at the console:
$ rails generate delayed_job:active_record
$ rake db:migrate
You need to create the delayed jobs table in the database (this assumes you're using active record).
For Rails 3, all you need to do is include it in the gemfile, run that code above to create the table and migrate the database, then restart your server and go!
Rails 4 Delayed_job error - Job failed to load: undefined class/module CustomJob
I always feel like the answer is obvious...AFTER I figure it out.
The problem was that I was using a shared database and there were existing workers accessing this DB. Though I was restarting and refreshing my local instance of the server, the other instances were trying to run my jobs and the OTHER workers were causing the error, not my local instance.
Solution: Ensure that other instances of delayed_job are using the same table as the code you're testing/building/using. If so, use another DB if possible.
Delayed_job (2.1.4) error: Job failed to load: instance of IO needed. Handler nil
Found the solution: my problem was caused by mass-assignment protection. I have an initializer to protect against mass-assignment:
# SECURITY: protect against mass assignment vulnerabilities
# enforces explicitly setting attributes accessible in models (whitelisting)
ActiveRecord::Base.send(:attr_accessible, nil)
This prevented delayed_job to access the handler field! Not sure if this can be considered a bug in DJ. Here is the initializer code that solved my problem:
# Imortant: delayed job requires some attributes to be accessible - make sure they are
Delayed::Job.attr_accessible :priority, :payload_object, :handler, :run_at, :failed_at
DelayedJob sometimes cannot load job class with a namespace
Solved. Delayed job or autoloader are not to blame.
A week before adding these new jobs (like Notifiers::MessageNotifierJob
) I've increased number of delayed job workers (using capistrano3-delayed-job
gem) from 1 to 4. But, capistrano3-delayed-job haven't killed old delayed job process, and only started new 4. So I ended up with 1 old job without any knowledge about my new job classes. Whenever this old process picked the job it failed. Then one of the new processes picked this job and succeeded.
Rails 5 with DelayedJob resulting in an error
It looks to me like Delayed Job does not support Rails 5 yet:
https://github.com/collectiveidea/delayed_job/issues/896
Related Topics
Disabling Flash Message Without Disabling Cache on Click on Back Button in Rails
Selenium Webdriver & Chrome Driver - Not Able to Run Chrome Driver
How to Print a Line Number in Ruby
Ruby Selenium Web Drive: How to Find Specific Element by Xpath Div Id and CSS Class
Rails 4 - Pundit - Create Policy
Iterate and Set Ruby Object Instance Variables
How to Replace a Pattern in Ruby Array
List of All/Best Gems for Ruby
Ruby/Rails - Active Record Db Migration to MySQL - Timestamp Type
No Such File to Load -- Soap4R -- Why
Error Occurs When Trying to Install Homebrew on a MAC for Ruby on Rails
How to Marshal a Hash with Arrays
Converting Colors (Not Images) with Imagemagick
I Want to Match All Punctuation in My Regexp Except Apostrophes. How to Do That in Ruby