Comments (11)
Hi @andrewhavens,
How are you doing?
Is the full yaml? Or is a part of it?
Please show me how do you load that yaml.
Thanks
from sidekiq-scheduler.
My example YAML is only one of my jobs. I can try removing the others to narrow it down.
My initializer looks like this:
require 'sidekiq/scheduler'
Sidekiq.configure_server do |config|
config.on(:startup) do
Sidekiq.schedule = YAML.load_file(File.expand_path("../../../config/sidekiq_schedule.yml", __FILE__))
end
end
It seems to be loading the schedule because it appears in the Sidekiq UI.
from sidekiq-scheduler.
I wonder, it is raising an error because my class extends from ActiveJob::Base
?
from sidekiq-scheduler.
Could you load it from sidekiq.yml instead. I think works better that way.
from sidekiq-scheduler.
You can add a key called schedule to your sidekiq.yml like this and that will be loaded automatically
:schedule:
job:
every: 4h
class: MyWorker
from sidekiq-scheduler.
Ah, yes, adding that to sidekiq.yml
seemed to get it to work. I did not previously have a sidekiq.yml
file, but I created one with the following contents:
:schedule:
job:
every: 30s
class: PushNotifications::SendNotificationJob
args: ["2c56d016-ddbd-4537-8a19-4bf4d2a2e462", "Test Notification!"]
Now the jobs are automatically running, but they are still failing for the same reason. Here is the output from the sidekiq log:
2016-01-07T23:54:55.337Z 25918 TID-oweq2fkzc INFO: Running in ruby 2.2.3p173 (2015-08-18 revision 51636) [x86_64-darwin15]
2016-01-07T23:54:55.337Z 25918 TID-oweq2fkzc INFO: See LICENSE and the LGPL-3.0 for licensing details.
2016-01-07T23:54:55.337Z 25918 TID-oweq2fkzc INFO: Upgrade to Sidekiq Pro for more features and support: http://sidekiq.org
2016-01-07T23:54:55.338Z 25918 TID-oweq2fkzc INFO: Booting Sidekiq 4.0.2 with redis options {:url=>nil}
2016-01-07T23:54:55.350Z 25918 TID-oweq2fkzc INFO: Loading Schedule
2016-01-07T23:54:55.350Z 25918 TID-oweq2fkzc INFO: Scheduling job
2016-01-07T23:54:55.351Z 25918 TID-oweq2fkzc INFO: Schedules Loaded
2016-01-07T23:54:55.351Z 25918 TID-oweq2fkzc INFO: Starting processing, hit Ctrl-C to stop
2016-01-07T23:55:25.614Z 25918 TID-owerpsjqk INFO: queueing PushNotifications::SendNotificationJob (job)
2016-01-07T23:55:25.615Z 25918 TID-owerpsjqk INFO: ArgumentError: Message must include a Sidekiq::Worker class, not class name: [PushNotifications::SendNotificationJob, PushNotifications::BaseJob, ActiveJob::Base, ActiveJob::Translation, ActiveJob::Logging, ActiveJob::Callbacks, ActiveSupport::Callbacks, ActiveJob::Execution, ActiveSupport::Rescuable, ActiveJob::Enqueuing, ActiveJob::QueueName, ActiveJob::QueueAdapter, ActiveJob::Core, Object, PP::ObjectMixin, ActiveSupport::Dependencies::Loadable, JSON::Ext::Generator::GeneratorMethods::Object, Kernel, BasicObject]
from sidekiq-scheduler.
Looks like this error comes from this line in Sidekiq: https://github.com/mperham/sidekiq/blob/6ad6a3aa330deebd76c6cf0d353f66abd3bef93b/lib/sidekiq/client.rb#L225
from sidekiq-scheduler.
I'm guessing it has something to do with how sidekiq-scheduler is trying to queue my ActiveJob jobs directly with Sidekiq instead of using the ActiveJob adapter: https://github.com/rails/rails/blob/master/activejob/lib/active_job/queue_adapters/sidekiq_adapter.rb
from sidekiq-scheduler.
Yes, you are right I will be working on a fix for this. Thank you.
from sidekiq-scheduler.
I was able to get it to run with this configuration. Not ideal, but it's a start.
Note that I did not have to pass all of the options to the wrapper job. I assume that it used some defaults. I'm not sure if wrapped
is necessary either.
:schedule:
unread_count_job:
every: 30s
class: ActiveJob::QueueAdapters::SidekiqAdapter::JobWrapper
wrapped: PushNotifications::SendNotificationJob
args:
-
job_class: PushNotifications::SendNotificationJob
# job_id: job_id,
# queue_name: queue_name,
# priority: priority,
arguments: ["533fa9ab-57e2-4c96-9b36-3f9c45ba317a", "Test Notification!"]
# locale: I18n.locale
from sidekiq-scheduler.
Fix on released v2.0.2.
from sidekiq-scheduler.
Related Issues (20)
- Did sidekiq-scheduler 5.0.0 add a Rails dependency? HOT 3
- Raises an exception when rufus_scheduler_options is nil by default HOT 3
- Could not find gem 'sidekiq-scheduler (= 5.0.1)' with platform 'arm64-darwin-21' HOT 1
- Sidekiq version requirement HOT 1
- Run job multiple times, but never at the same time HOT 3
- Uppercase character in header name: Cache-Control
- Sidekiq 7.1 warns when deprecated Redis commands are used
- Cron expression with day of month does not work HOT 4
- Support for Ruby 3.0 and deconstruct Hashes as keyword arguments. HOT 5
- Move away from deprecated Redis commands HOT 2
- undefined method `next_time' for nil:NilClass HOT 5
- re-use Sidekiq Rack::Static instance for assets
- RedisManager does not appear to be updating in test env HOT 6
- Sidekick (docker) deprecation warning HOT 1
- UI not loading on heroku HOT 7
- Error handler threw an error HOT 2
- [feature request] environment specific schedules HOT 1
- Recommend Sidekiq::Job instead of Sidekiq::Worker HOT 1
- How to test that sidekiq.yml is *correct*? HOT 3
- SidekiqScheduler::Manager enormous inspect output HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sidekiq-scheduler.