I am trying to use the Rufus Scheduler (within Dashing) to schedule a cron job, but also have it run once upon the server spinning up. I am following the readme here where it is saying to do the following:
scheduler.cron '00 14 * * *', :first_in => '3d' do
# ... every day at 14h00, but start after 3 * 24 hours
end
When I try to do this, I get the following error in my job:
`cron': unknown option: :first_in (ArgumentError)
Has anyone come across this?
Dashing is using rufus-scheduler 2.0.24 ( https://github.com/Shopify/dashing/blob/55f90939eae4d6eb64822fd3590f694418396510/dashing.gemspec#L24 ) which doesn't support the first_in feature for cron.
First_in was introduced for cron in rufus-scheduler 3.0.
It seems you're reading the rufus-scheduler 3.x documentation instead of the 2.x one.
The documentation for rufus-scheduler is at https://github.com/jmettraux/rufus-scheduler#rufus-scheduler , on top of it, there is the link to the 2.x documentation ( https://github.com/jmettraux/rufus-scheduler/blob/two/README.rdoc ). You'll have better luck there.
A 2.x alternative would be:
scheduler.in '3d' do
scheduler.cron '00 14 * * *' do
# ... every day at 1400
end
end
Related
I'm working on an AWS Lambda using the serverless framework. I'm trying to get my Lambda function to run on an EventBridge trigger, more specifically a cron schedule. The schedule being to run every 30 minutes between 20:00 and 07:00 Mon-Friday. However, this is great for prod, but in QA/UAT I want a different cron schedule (most likely). Thus I'm looking to implement stage based cron triggers so that I can schedule it for the day time in QA/UAT, but schedule it for the evening in production.
I originally tried a single cron schedule trigger of cron (0/30 20:30-06:30 ? * 1-5 *) for UAT, but that didn't work for some reason. My Lambda function ran only twice after 20:30, which I've yet to figure out.
My serverless file contains:
custom:
stage: "${opt:stage, self:provider.stage, 'dev'}"
stages:
- dev
- uat
eveningSchedule:
dev: cron(0/30 08:00-12:59 ? * 1-5 *)
uat: cron(0/30 20:30-23:59 ? * 1-5 *)
morningSchedule:
dev: cron(0/30 12:01-17:30 ? * 1-5 *)
uat: cron(0/30 00:30-06:30 ? * 1-5 *)
The function is defined as :
functions:
handler123:
handler: foo::bar::functionName
package:
artifact: ./bin/Release/net6.0/foo.bar.zip
events:
- schedule: "${self:custom.eveningSchedule.stage}"
- schedule: "${self:custom.morningSchedule.stage}"
The error I get when running sls deploy is:
Cannot resolve variable at "functions.CifFileRetriever.events.0": Value not found at "self" source and "functions.CifFileRetriever.events.1": Value not found at "self"
Would be massively grateful for any help on this one.
I am using Ruby on Rails 5.2.0 to develop a system and I need to run a job every 2 minute.
I'm using sidekiq for background processing and sidekiq-cron for scheduling jobs.
I execute the following line in rails console:
job=Sidekiq::Cron::Job.new( name: 'TestWorker_Job', cron: '*/2 * * * *', klass: 'PriceWorker')
And this is the answer
=> #<Sidekiq::Cron::Job:0x000055b6d54707e8
#active_job=false,
#active_job_queue_name_delimiter=nil,
#active_job_queue_name_prefix=nil,
#args=[],
#cron="*/2 * * * *",
#fetch_missing_args=true,
#klass="PriceWorker",
#last_enqueue_time=nil,
#message={"retry"=>false, "queue"=>"default", "class"=>"PriceWorker", "args"=>[]},
#name="TestWorker_Job",
#queue="default",
#queue_name_with_prefix="default",
#status="enabled">
But it throws me an error:
job.errors
=> ["'cron' -> */2 * * * *: uninitialized constant Rufus::Scheduler::CronLine"]
There is no valid job. I don't know what i am doing wrong. Sidekiq-cron github page do the same thing.
sidekiq-cron is not targeting the correct version of rufus-scheduler. To make it work again, add this to your Gemfile:
gem 'rufus-scheduler', '~> 3.4.0'
Then run $ bundle install rufus-scheduler.
I have scheduled a coordinator using cron expression
frequency = "20 3 * * 2-4" but it gives error.
The oozie coordinator logs say "java.lang.IllegalArgumentException" : paramter [frequency]=[20 3 * * 2-4] must be an integer . Parsing error for input String : "20 3 * * 2-4"
HDP version : 2.5.3
Oozie Client build version : 4.2.0.2.5.3.0-37
..
..
You are requesting Oozie to apply XML schema for Coordinator... in version 0.2 of that schema.
The documentation hints that CRON syntax worked with schema 0.2 but I'm pretty sure that CRON scheduling was introduced in Oozie V4.0 (and documented in V4.1) -- and since Oozie V4.0 introduced schema 0.4 I believe that the documentation is wrong.
Bottom line: requesting xmlns="uri:oozie:coordinator:0.4" should allow Oozie to parse your CRON schedule correctly.
I updated one of my apps to Rails 5 and upgraded the Ruby version to 2.3.1 as well. The app already used Puma prior to the Rails 5 upgrade as well and was deployed on a Digital Ocean droplet.
When I start rails server locally, I get the normal output in my Rails log, which I've copied below.
=> Booting Puma
=> Rails 5.0.0 application starting in development on http://localhost:3000
=> Run `rails server -h` for more startup options
[14669] Puma starting in cluster mode...
[14669] * Version 3.4.0 (ruby 2.3.1-p112), codename: Owl Bowl Brawl
[14669] * Min threads: 5, max threads: 5
[14669] * Environment: development
[14669] * Process workers: 2
[14669] * Preloading application
[14669] * Listening on tcp://localhost:3000
[14669] Use Ctrl-C to stop
[14669] - Worker 1 (pid: 14684) booted, phase: 0
[14669] - Worker 0 (pid: 14683) booted, phase: 0
Everything looks normal to me. When I visit localhost:3000, the browser has a pending request that is pending indefinitely. There is no further activity in the Rails log acknowledging that any request is being received.
Has anyone encountered this type of issue, or know of any potential causes for that?
Resolved this issue, and confirmed by #marvindanig who was experiencing the same issue, that the 'tmp' folder needed to be cleared. There is a rake task in rails to do so...
rake tmp:clear
How do I get Redmine to start fast on Linux (CentOS)?
I upgraded all last week: latest Redmine, Ruby, Passenger, etc...
I tried about all I could find in the Redmine forum and other posts of getting it to speed up faster, that is: when requesting the Redmine website after a few hours being idle, it starts slow, but then it's blazing fast.
I am using Apache web server with Passenger. Below my current apache config, please some advice, as I am out of ideas:
LoadModule passenger_module /usr/local/rvm/gems/ruby-1.9.3-p448/gems/passenger-4.0.19/buildout/apache2/mod_passenger.so
PassengerRoot /usr/local/rvm/gems/ruby-1.9.3-p448/gems/passenger-4.0.19
PassengerDefaultRuby /usr/local/rvm/wrappers/ruby-1.9.3-p448/ruby
# Refs:
# http://stackoverflow.com/questions/8235309/redmine-perfomance-inconsistency
# http://www.redmine.org/boards/2/topics/31783
# This option should be 0, but has an issue: https://code.google.com/p/phusion-passenger/issues/detail?id=904
PassengerPoolIdleTime 999999
PassengerMinInstances 2
PassengerHighPerformance on
PassengerPreStart https://myhost/redmine
PassengerMaxPoolSize 5
PassengerMaxInstancesPerApp 4
PassengerStatThrottleRate 10
RailsAppSpawnerIdleTime 0
PassengerMaxPreloaderIdleTime 0
RailsBaseURI /redmine
RailsEnv production
I solved this by setting up a cron job to request the redmine homepage every 15 minutes:
*/15 * * * * /usr/bin/curl http://redmine_server/ --stderr - > /dev/null