rufus-scheduler 3.3.0 → 3.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.txt +35 -0
- data/CREDITS.txt +11 -0
- data/LICENSE.txt +1 -1
- data/README.md +74 -8
- data/fail.txt +2 -0
- data/lib/rufus/scheduler/cronline.rb +42 -42
- data/lib/rufus/scheduler/job_array.rb +0 -24
- data/lib/rufus/scheduler/jobs.rb +27 -46
- data/lib/rufus/scheduler/locks.rb +0 -23
- data/lib/rufus/scheduler/util.rb +3 -27
- data/lib/rufus/scheduler.rb +20 -38
- data/log.txt +285 -0
- data/n.txt +38 -0
- data/rufus-scheduler.gemspec +5 -3
- data/sofia.md +89 -0
- metadata +19 -15
- data/lib/rufus/scheduler/zotime.rb +0 -449
data/lib/rufus/scheduler/util.rb
CHANGED
|
@@ -1,27 +1,3 @@
|
|
|
1
|
-
#--
|
|
2
|
-
# Copyright (c) 2006-2016, John Mettraux, jmettraux@gmail.com
|
|
3
|
-
#
|
|
4
|
-
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
5
|
-
# of this software and associated documentation files (the "Software"), to deal
|
|
6
|
-
# in the Software without restriction, including without limitation the rights
|
|
7
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
8
|
-
# copies of the Software, and to permit persons to whom the Software is
|
|
9
|
-
# furnished to do so, subject to the following conditions:
|
|
10
|
-
#
|
|
11
|
-
# The above copyright notice and this permission notice shall be included in
|
|
12
|
-
# all copies or substantial portions of the Software.
|
|
13
|
-
#
|
|
14
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
15
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
16
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
17
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
18
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
19
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
20
|
-
# THE SOFTWARE.
|
|
21
|
-
#
|
|
22
|
-
# Made in Japan.
|
|
23
|
-
#++
|
|
24
|
-
|
|
25
1
|
|
|
26
2
|
module Rufus
|
|
27
3
|
|
|
@@ -68,9 +44,9 @@ module Rufus
|
|
|
68
44
|
|
|
69
45
|
def self.parse_at(o, opts={})
|
|
70
46
|
|
|
71
|
-
return o if o.is_a?(
|
|
72
|
-
return
|
|
73
|
-
|
|
47
|
+
return o if o.is_a?(EoTime)
|
|
48
|
+
return EoTime.make(o) if o.is_a?(Time)
|
|
49
|
+
EoTime.parse(o, opts)
|
|
74
50
|
|
|
75
51
|
rescue StandardError => se
|
|
76
52
|
|
data/lib/rufus/scheduler.rb
CHANGED
|
@@ -1,46 +1,26 @@
|
|
|
1
|
-
#--
|
|
2
|
-
# Copyright (c) 2006-2016, John Mettraux, jmettraux@gmail.com
|
|
3
|
-
#
|
|
4
|
-
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
5
|
-
# of this software and associated documentation files (the "Software"), to deal
|
|
6
|
-
# in the Software without restriction, including without limitation the rights
|
|
7
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
8
|
-
# copies of the Software, and to permit persons to whom the Software is
|
|
9
|
-
# furnished to do so, subject to the following conditions:
|
|
10
|
-
#
|
|
11
|
-
# The above copyright notice and this permission notice shall be included in
|
|
12
|
-
# all copies or substantial portions of the Software.
|
|
13
|
-
#
|
|
14
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
15
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
16
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
17
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
18
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
19
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
20
|
-
# THE SOFTWARE.
|
|
21
|
-
#
|
|
22
|
-
# Made in Japan.
|
|
23
|
-
#++
|
|
24
1
|
|
|
2
|
+
require 'set'
|
|
25
3
|
require 'date' if RUBY_VERSION < '1.9.0'
|
|
26
4
|
require 'time'
|
|
27
5
|
require 'thread'
|
|
28
|
-
|
|
6
|
+
|
|
7
|
+
require 'et-orbi'
|
|
29
8
|
|
|
30
9
|
|
|
31
10
|
module Rufus
|
|
32
11
|
|
|
33
12
|
class Scheduler
|
|
34
13
|
|
|
14
|
+
VERSION = '3.4.0'
|
|
15
|
+
|
|
16
|
+
EoTime = ::EtOrbi::EoTime
|
|
17
|
+
|
|
35
18
|
require 'rufus/scheduler/util'
|
|
36
|
-
require 'rufus/scheduler/zotime'
|
|
37
19
|
require 'rufus/scheduler/jobs'
|
|
38
20
|
require 'rufus/scheduler/cronline'
|
|
39
21
|
require 'rufus/scheduler/job_array'
|
|
40
22
|
require 'rufus/scheduler/locks'
|
|
41
23
|
|
|
42
|
-
VERSION = '3.3.0'
|
|
43
|
-
|
|
44
24
|
#
|
|
45
25
|
# A common error class for rufus-scheduler
|
|
46
26
|
#
|
|
@@ -104,7 +84,7 @@ module Rufus
|
|
|
104
84
|
@trigger_lock = opts[:trigger_lock] || Rufus::Scheduler::NullLock.new
|
|
105
85
|
|
|
106
86
|
# If we can't grab the @scheduler_lock, don't run.
|
|
107
|
-
|
|
87
|
+
lock || return
|
|
108
88
|
|
|
109
89
|
start
|
|
110
90
|
end
|
|
@@ -128,7 +108,7 @@ module Rufus
|
|
|
128
108
|
#
|
|
129
109
|
def self.start_new
|
|
130
110
|
|
|
131
|
-
fail "this is rufus-scheduler 3.
|
|
111
|
+
fail "this is rufus-scheduler 3.x, use .new instead of .start_new"
|
|
132
112
|
end
|
|
133
113
|
|
|
134
114
|
def shutdown(opt=nil)
|
|
@@ -154,12 +134,12 @@ module Rufus
|
|
|
154
134
|
|
|
155
135
|
def uptime
|
|
156
136
|
|
|
157
|
-
@started_at ?
|
|
137
|
+
@started_at ? EoTime.now - @started_at : nil
|
|
158
138
|
end
|
|
159
139
|
|
|
160
140
|
def uptime_s
|
|
161
141
|
|
|
162
|
-
self.class.to_duration(uptime)
|
|
142
|
+
uptime ? self.class.to_duration(uptime) : ''
|
|
163
143
|
end
|
|
164
144
|
|
|
165
145
|
def join
|
|
@@ -305,7 +285,7 @@ module Rufus
|
|
|
305
285
|
jobs = jobs.reject { |j| j.next_time.nil? || j.unscheduled_at }
|
|
306
286
|
end
|
|
307
287
|
|
|
308
|
-
tags = Array(opts[:tag] || opts[:tags]).collect
|
|
288
|
+
tags = Array(opts[:tag] || opts[:tags]).collect(&:to_s)
|
|
309
289
|
jobs = jobs.reject { |j| tags.find { |t| ! j.tags.include?(t) } }
|
|
310
290
|
|
|
311
291
|
jobs
|
|
@@ -409,7 +389,7 @@ module Rufus
|
|
|
409
389
|
# Accepts a query option, which can be set to:
|
|
410
390
|
# * :all (default), returns all the threads that are work threads
|
|
411
391
|
# or are currently running a job
|
|
412
|
-
# * :active, returns all threads that are
|
|
392
|
+
# * :active, returns all threads that are currently running a job
|
|
413
393
|
# * :vacant, returns the threads that are not running a job
|
|
414
394
|
#
|
|
415
395
|
# If, thanks to :blocking => true, a job is scheduled to monopolize the
|
|
@@ -478,7 +458,9 @@ module Rufus
|
|
|
478
458
|
stderr.puts(" #{pre} tz:")
|
|
479
459
|
stderr.puts(" #{pre} ENV['TZ']: #{ENV['TZ']}")
|
|
480
460
|
stderr.puts(" #{pre} Time.now: #{Time.now}")
|
|
481
|
-
stderr.puts(" #{pre} local_tzone: #{
|
|
461
|
+
stderr.puts(" #{pre} local_tzone: #{EoTime.local_tzone.inspect}")
|
|
462
|
+
stderr.puts(" #{pre} et-orbi:")
|
|
463
|
+
stderr.puts(" #{pre} #{EoTime.platform_info}")
|
|
482
464
|
stderr.puts(" #{pre} scheduler:")
|
|
483
465
|
stderr.puts(" #{pre} object_id: #{object_id}")
|
|
484
466
|
stderr.puts(" #{pre} opts:")
|
|
@@ -558,7 +540,7 @@ module Rufus
|
|
|
558
540
|
|
|
559
541
|
def start
|
|
560
542
|
|
|
561
|
-
@started_at =
|
|
543
|
+
@started_at = EoTime.now
|
|
562
544
|
|
|
563
545
|
@thread =
|
|
564
546
|
Thread.new do
|
|
@@ -585,7 +567,7 @@ module Rufus
|
|
|
585
567
|
|
|
586
568
|
def trigger_jobs
|
|
587
569
|
|
|
588
|
-
now =
|
|
570
|
+
now = EoTime.now
|
|
589
571
|
|
|
590
572
|
@jobs.each(now) do |job|
|
|
591
573
|
|
|
@@ -604,9 +586,9 @@ module Rufus
|
|
|
604
586
|
next unless job && to && ts
|
|
605
587
|
# thread might just have become inactive (job -> nil)
|
|
606
588
|
|
|
607
|
-
to = ts + to unless to.is_a?(
|
|
589
|
+
to = ts + to unless to.is_a?(EoTime)
|
|
608
590
|
|
|
609
|
-
next if to >
|
|
591
|
+
next if to > EoTime.now
|
|
610
592
|
|
|
611
593
|
t.raise(Rufus::Scheduler::TimeoutError)
|
|
612
594
|
end
|
data/log.txt
ADDED
|
@@ -0,0 +1,285 @@
|
|
|
1
|
+
Worker information
|
|
2
|
+
hostname: i-078c3db-precise-production-2-worker-org-docker.travisci.net:f906399b-e569-4426-b0d7-1619a6db7baa
|
|
3
|
+
version: v2.5.0 https://github.com/travis-ci/worker/tree/da3a43228dffc0fcca5a46569ca786b22991979f
|
|
4
|
+
instance: 1292ed6:travis:ruby
|
|
5
|
+
startup: 845.717814ms
|
|
6
|
+
Build system information
|
|
7
|
+
Build language: ruby
|
|
8
|
+
Build group: stable
|
|
9
|
+
Build dist: precise
|
|
10
|
+
Build id: 213618964
|
|
11
|
+
Job id: 213618967
|
|
12
|
+
travis-build version: 35b504699
|
|
13
|
+
Build image provisioning date and time
|
|
14
|
+
Thu Feb 5 15:09:33 UTC 2015
|
|
15
|
+
Operating System Details
|
|
16
|
+
Distributor ID: Ubuntu
|
|
17
|
+
Description: Ubuntu 12.04.5 LTS
|
|
18
|
+
Release: 12.04
|
|
19
|
+
Codename: precise
|
|
20
|
+
Linux Version
|
|
21
|
+
3.13.0-29-generic
|
|
22
|
+
Cookbooks Version
|
|
23
|
+
a68419e https://github.com/travis-ci/travis-cookbooks/tree/a68419e
|
|
24
|
+
GCC version
|
|
25
|
+
gcc (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3
|
|
26
|
+
Copyright (C) 2011 Free Software Foundation, Inc.
|
|
27
|
+
This is free software; see the source for copying conditions. There is NO
|
|
28
|
+
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
29
|
+
|
|
30
|
+
LLVM version
|
|
31
|
+
clang version 3.4 (tags/RELEASE_34/final)
|
|
32
|
+
Target: x86_64-unknown-linux-gnu
|
|
33
|
+
Thread model: posix
|
|
34
|
+
Pre-installed Ruby versions
|
|
35
|
+
ruby-1.9.3-p551
|
|
36
|
+
Pre-installed Node.js versions
|
|
37
|
+
v0.10.36
|
|
38
|
+
Pre-installed Go versions
|
|
39
|
+
1.4.1
|
|
40
|
+
Redis version
|
|
41
|
+
redis-server 2.8.19
|
|
42
|
+
riak version
|
|
43
|
+
2.0.2
|
|
44
|
+
MongoDB version
|
|
45
|
+
MongoDB 2.4.12
|
|
46
|
+
CouchDB version
|
|
47
|
+
couchdb 1.6.1
|
|
48
|
+
Neo4j version
|
|
49
|
+
1.9.4
|
|
50
|
+
RabbitMQ Version
|
|
51
|
+
3.4.3
|
|
52
|
+
ElasticSearch version
|
|
53
|
+
1.4.0
|
|
54
|
+
Installed Sphinx versions
|
|
55
|
+
2.0.10
|
|
56
|
+
2.1.9
|
|
57
|
+
2.2.6
|
|
58
|
+
Default Sphinx version
|
|
59
|
+
2.2.6
|
|
60
|
+
Installed Firefox version
|
|
61
|
+
firefox 31.0esr
|
|
62
|
+
PhantomJS version
|
|
63
|
+
1.9.8
|
|
64
|
+
ant -version
|
|
65
|
+
Apache Ant(TM) version 1.8.2 compiled on December 3 2011
|
|
66
|
+
mvn -version
|
|
67
|
+
Apache Maven 3.2.5 (12a6b3acb947671f09b81f49094c53f426d8cea1; 2014-12-14T17:29:23+00:00)
|
|
68
|
+
Maven home: /usr/local/maven
|
|
69
|
+
Java version: 1.7.0_76, vendor: Oracle Corporation
|
|
70
|
+
Java home: /usr/lib/jvm/java-7-oracle/jre
|
|
71
|
+
Default locale: en_US, platform encoding: ANSI_X3.4-1968
|
|
72
|
+
OS name: "linux", version: "3.13.0-29-generic", arch: "amd64", family: "unix"
|
|
73
|
+
|
|
74
|
+
$ export DEBIAN_FRONTEND=noninteractive
|
|
75
|
+
Reading package lists...
|
|
76
|
+
Building dependency tree...
|
|
77
|
+
Reading state information...
|
|
78
|
+
The following extra packages will be installed:
|
|
79
|
+
libc-bin libc-dev-bin libc6-dev
|
|
80
|
+
Suggested packages:
|
|
81
|
+
glibc-doc
|
|
82
|
+
The following packages will be upgraded:
|
|
83
|
+
libc-bin libc-dev-bin libc6 libc6-dev
|
|
84
|
+
4 upgraded, 0 newly installed, 0 to remove and 271 not upgraded.
|
|
85
|
+
Need to get 8,886 kB of archives.
|
|
86
|
+
After this operation, 13.3 kB of additional disk space will be used.
|
|
87
|
+
Get:1 http://us.archive.ubuntu.com/ubuntu/ precise-updates/main libc6-dev amd64 2.15-0ubuntu10.16 [2,948 kB]
|
|
88
|
+
Get:2 http://us.archive.ubuntu.com/ubuntu/ precise-updates/main libc-dev-bin amd64 2.15-0ubuntu10.16 [84.2 kB]
|
|
89
|
+
Get:3 http://us.archive.ubuntu.com/ubuntu/ precise-updates/main libc-bin amd64 2.15-0ubuntu10.16 [1,179 kB]
|
|
90
|
+
Get:4 http://us.archive.ubuntu.com/ubuntu/ precise-updates/main libc6 amd64 2.15-0ubuntu10.16 [4,674 kB]
|
|
91
|
+
Fetched 8,886 kB in 0s (32.1 MB/s)
|
|
92
|
+
Preconfiguring packages ...
|
|
93
|
+
(Reading database ... 71420 files and directories currently installed.)
|
|
94
|
+
Preparing to replace libc6-dev 2.15-0ubuntu10.10 (using .../libc6-dev_2.15-0ubuntu10.16_amd64.deb) ...
|
|
95
|
+
Unpacking replacement libc6-dev ...
|
|
96
|
+
Preparing to replace libc-dev-bin 2.15-0ubuntu10.10 (using .../libc-dev-bin_2.15-0ubuntu10.16_amd64.deb) ...
|
|
97
|
+
Unpacking replacement libc-dev-bin ...
|
|
98
|
+
Preparing to replace libc-bin 2.15-0ubuntu10.10 (using .../libc-bin_2.15-0ubuntu10.16_amd64.deb) ...
|
|
99
|
+
Unpacking replacement libc-bin ...
|
|
100
|
+
Processing triggers for man-db ...
|
|
101
|
+
Setting up libc-bin (2.15-0ubuntu10.16) ...
|
|
102
|
+
(Reading database ... 71419 files and directories currently installed.)
|
|
103
|
+
Preparing to replace libc6 2.15-0ubuntu10.10 (using .../libc6_2.15-0ubuntu10.16_amd64.deb) ...
|
|
104
|
+
Unpacking replacement libc6 ...
|
|
105
|
+
Setting up libc6 (2.15-0ubuntu10.16) ...
|
|
106
|
+
Setting up libc-dev-bin (2.15-0ubuntu10.16) ...
|
|
107
|
+
Setting up libc6-dev (2.15-0ubuntu10.16) ...
|
|
108
|
+
Processing triggers for libc-bin ...
|
|
109
|
+
ldconfig deferred processing now taking place
|
|
110
|
+
$ git clone --depth=50 --branch=master https://github.com/jmettraux/rufus-scheduler.git jmettraux/rufus-scheduler
|
|
111
|
+
Cloning into 'jmettraux/rufus-scheduler'...
|
|
112
|
+
remote: Counting objects: 362, done.
|
|
113
|
+
remote: Compressing objects: 100% (217/217), done.
|
|
114
|
+
remote: Total 362 (delta 185), reused 290 (delta 143), pack-reused 0
|
|
115
|
+
Receiving objects: 100% (362/362), 121.72 KiB | 0 bytes/s, done.
|
|
116
|
+
Resolving deltas: 100% (185/185), done.
|
|
117
|
+
Checking connectivity... done.
|
|
118
|
+
|
|
119
|
+
$ cd jmettraux/rufus-scheduler
|
|
120
|
+
$ git checkout -qf f3539da98361a36182d7e2c81f8f045e64891755
|
|
121
|
+
|
|
122
|
+
This job is running on container-based infrastructure, which does not allow use of 'sudo', setuid and setguid executables.
|
|
123
|
+
If you require sudo, add 'sudo: required' to your .travis.yml
|
|
124
|
+
See https://docs.travis-ci.com/user/workers/container-based-infrastructure/ for details.
|
|
125
|
+
$ rvm use 2.1.1 --install --binary --fuzzy
|
|
126
|
+
ruby-2.1.1 is not installed - installing.
|
|
127
|
+
Searching for binary rubies, this might take some time.
|
|
128
|
+
Found remote file https://s3.amazonaws.com/travis-rubies/binaries/ubuntu/12.04/x86_64/ruby-2.1.1.tar.bz2
|
|
129
|
+
Checking requirements for ubuntu.
|
|
130
|
+
Requirements installation successful.
|
|
131
|
+
ruby-2.1.1 - #configure
|
|
132
|
+
ruby-2.1.1 - #download
|
|
133
|
+
% Total % Received % Xferd Average Speed Time Time Time Current
|
|
134
|
+
Dload Upload Total Spent Left Speed
|
|
135
|
+
100 20.9M 100 20.9M 0 0 88.3M 0 --:--:-- --:--:-- --:--:-- 92.2M
|
|
136
|
+
No checksum for downloaded archive, recording checksum in user configuration.
|
|
137
|
+
ruby-2.1.1 - #validate archive
|
|
138
|
+
ruby-2.1.1 - #extract
|
|
139
|
+
ruby-2.1.1 - #validate binary
|
|
140
|
+
ruby-2.1.1 - #setup
|
|
141
|
+
ruby-2.1.1 - #gemset created /home/travis/.rvm/gems/ruby-2.1.1@global
|
|
142
|
+
ruby-2.1.1 - #importing gemset /home/travis/.rvm/gemsets/global.gems|/-\|/-\|.-\|/-\|/-.|/-\|/-\|.-\|/-\|/-.|/-\|/-\|.-\|/-\|/-.|/-\|/-\|.-\|/-\|/-.|/-\|/-\|.-\|/-\|/-.|/-\|/-\|.-\|/-\|/-.|/-\|/-\|.-\|/-\|/-.|/-\|/-\|.-\|/-\|/-.|/-\|/-\|.-\|/-\|/-.|/-\|/-\|.-\|/-\|/-.|/-\|/-\|.-\|/-\|/-.|/-\|/-\|.-\|/-\|/-.|/-\|/-\|.-\|/-\|/-.|/-\|/-\|.-\|/-\|/-.|/-\|/-\|.-\|/-\|/-.|/-\|/-\|.-\|/-\|/-.|/-\|/-\|.-\|/-\|/-.|/-\|/-\|.-\|/-\|/-.|/-\|/-\|.-\|/-\|/-.|/-\|/-\|.-\|/-\|/-.|/-\|/-\|.-\|/-\|/-.|/-\|/-\|.-\|/-\|/-.|/-\|/-\|.-\|/-\|/-.|/-\|/-\|.-\|/-\|/-.|/-\|/-\|.-\|/-\|/-.|/-\|/-\|.-\|/-\|/-.|/-\|/-\|.-\|.
|
|
143
|
+
ruby-2.1.1 - #generating global wrappers|/-\|/-\|.-\|/-\|/-.|/-\|/-\|.-\|/-\|/-.|/-\|/-\|.-\|/-\|/-.|/-\|/-\|.-\|/.
|
|
144
|
+
ruby-2.1.1 - #uninstalling gem rubygems-bundler-1.4.4|/.
|
|
145
|
+
ruby-2.1.1 - #gemset created /home/travis/.rvm/gems/ruby-2.1.1
|
|
146
|
+
ruby-2.1.1 - #importing gemset /home/travis/.rvm/gemsets/default.gems|/-\|/-\|.-\|/-\|/-.|/-\|/-\|.-\|/-\|/-.|/-\|/-\|.-\|/-\|/-.|/-\|/-\|.-\|/-\|/-.|/-\|/-\|.-\|/-\|/-.|/-\|/-\|.-\|/-\|/-.|/-\|/-\|.-\|/-\|/-.|/-\|/-\|.-\|/-\|/-.|/-\|/-\|.-\|/-\|/-.|/-\|/-\|.-\|/-\|/-.
|
|
147
|
+
ruby-2.1.1 - #generating default wrappers|/-\|/-\|.-\|/-\|/-.|/-\|/-\|.-\|/-\|/-.|/-\|/-\|.-\|/-\|/-.|/-\|/-\|.-\|/-.
|
|
148
|
+
chown: changing ownership of `/home/travis/.rvm/user/installs': Operation not permitted
|
|
149
|
+
Using /home/travis/.rvm/gems/ruby-2.1.1
|
|
150
|
+
|
|
151
|
+
$ export BUNDLE_GEMFILE=$PWD/Gemfile
|
|
152
|
+
Setting up build cache
|
|
153
|
+
$ export CASHER_DIR=$HOME/.casher
|
|
154
|
+
$ Installing caching utilities
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
attempting to download cache archive
|
|
158
|
+
fetching master/cache-linux-precise-e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855--rvm-2.1.1--gemfile-Gemfile.tgz
|
|
159
|
+
found cache
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
adding /home/travis/build/jmettraux/rufus-scheduler/vendor/bundle to cache
|
|
164
|
+
creating directory /home/travis/build/jmettraux/rufus-scheduler/vendor/bundle
|
|
165
|
+
|
|
166
|
+
$ ruby --version
|
|
167
|
+
ruby 2.1.1p76 (2014-02-24 revision 45161) [x86_64-linux]
|
|
168
|
+
$ rvm --version
|
|
169
|
+
rvm 1.26.10 (latest-minor) by Wayne E. Seguin <wayneeseguin@gmail.com>, Michal Papis <mpapis@gmail.com> [https://rvm.io/]
|
|
170
|
+
$ bundle --version
|
|
171
|
+
Bundler version 1.14.6
|
|
172
|
+
$ gem --version
|
|
173
|
+
2.2.2
|
|
174
|
+
$ bundle install --jobs=3 --retry=3 --path=${BUNDLE_PATH:-vendor/bundle}
|
|
175
|
+
Fetching gem metadata from https://rubygems.org/..........
|
|
176
|
+
Fetching version metadata from https://rubygems.org/.
|
|
177
|
+
Resolving dependencies...
|
|
178
|
+
Using chronic 0.10.2
|
|
179
|
+
Using diff-lcs 1.3
|
|
180
|
+
Using thread_safe 0.3.6
|
|
181
|
+
Using rspec-support 3.5.0
|
|
182
|
+
Using bundler 1.14.6
|
|
183
|
+
Using tzinfo 1.2.2
|
|
184
|
+
Using rspec-core 3.5.4
|
|
185
|
+
Using rspec-expectations 3.5.0
|
|
186
|
+
Using rspec-mocks 3.5.0
|
|
187
|
+
Using rspec 3.5.0
|
|
188
|
+
Installing et-orbi 1.0.0
|
|
189
|
+
Using rufus-scheduler 3.4.0 from source at `.`
|
|
190
|
+
Bundle complete! 3 Gemfile dependencies, 12 gems now installed.
|
|
191
|
+
Bundled gems are installed into ./vendor/bundle.
|
|
192
|
+
|
|
193
|
+
$ bundle exec rspec
|
|
194
|
+
RUBY_VERSION: 2.1.1
|
|
195
|
+
RUBY_PLATFORM: x86_64-linux
|
|
196
|
+
.................................................................................................................F...................F..........F................................................................................................*.................*..........................................................................................
|
|
197
|
+
|
|
198
|
+
Pending: (Failures listed here are expected and do not affect your suite's status)
|
|
199
|
+
|
|
200
|
+
1) Rufus::Scheduler#at accepts an ActiveSupport time thinggy
|
|
201
|
+
# Not yet implemented
|
|
202
|
+
# ./spec/schedule_at_spec.rb:149
|
|
203
|
+
|
|
204
|
+
2) Rufus::Scheduler#schedule_in accepts an ActiveSupport .from_now thinggy
|
|
205
|
+
# Not yet implemented
|
|
206
|
+
# ./spec/schedule_in_spec.rb:73
|
|
207
|
+
|
|
208
|
+
Failures:
|
|
209
|
+
|
|
210
|
+
1) Rufus::Scheduler::CronJob#next_time returns the next trigger time (first_at => Time)
|
|
211
|
+
Failure/Error: expect(nt.zone).to eq(Rufus::Scheduler::ZoTime.local_tzone)
|
|
212
|
+
|
|
213
|
+
expected: #<TZInfo::TimezoneProxy: Etc/UTC>
|
|
214
|
+
got: #<TZInfo::DataTimezone: UTC>
|
|
215
|
+
|
|
216
|
+
(compared using ==)
|
|
217
|
+
|
|
218
|
+
Diff:
|
|
219
|
+
@@ -1,2 +1,2 @@
|
|
220
|
+
-#<TZInfo::TimezoneProxy: Etc/UTC>
|
|
221
|
+
+#<TZInfo::DataTimezone: UTC>
|
|
222
|
+
# ./spec/job_cron_spec.rb:128:in `block (3 levels) in <top (required)>'
|
|
223
|
+
|
|
224
|
+
2) Rufus::Scheduler::RepeatJob :first/:first_in/:first_at => point in time accepts a Time instance
|
|
225
|
+
Failure/Error: expect(job.first_at.zone).to eq(Rufus::Scheduler::ZoTime.local_tzone)
|
|
226
|
+
|
|
227
|
+
expected: #<TZInfo::TimezoneProxy: Etc/UTC>
|
|
228
|
+
got: #<TZInfo::DataTimezone: UTC>
|
|
229
|
+
|
|
230
|
+
(compared using ==)
|
|
231
|
+
|
|
232
|
+
Diff:
|
|
233
|
+
@@ -1,2 +1,2 @@
|
|
234
|
+
-#<TZInfo::TimezoneProxy: Etc/UTC>
|
|
235
|
+
+#<TZInfo::DataTimezone: UTC>
|
|
236
|
+
# ./spec/job_repeat_spec.rb:138:in `block (3 levels) in <top (required)>'
|
|
237
|
+
|
|
238
|
+
3) Rufus::Scheduler::RepeatJob :last/:last_in/:last_at => point in time accepts a Time instance
|
|
239
|
+
Failure/Error: expect(job.last_at.zone).to eq(Rufus::Scheduler::ZoTime.local_tzone)
|
|
240
|
+
|
|
241
|
+
expected: #<TZInfo::TimezoneProxy: Etc/UTC>
|
|
242
|
+
got: #<TZInfo::DataTimezone: UTC>
|
|
243
|
+
|
|
244
|
+
(compared using ==)
|
|
245
|
+
|
|
246
|
+
Diff:
|
|
247
|
+
@@ -1,2 +1,2 @@
|
|
248
|
+
-#<TZInfo::TimezoneProxy: Etc/UTC>
|
|
249
|
+
+#<TZInfo::DataTimezone: UTC>
|
|
250
|
+
# ./spec/job_repeat_spec.rb:286:in `block (3 levels) in <top (required)>'
|
|
251
|
+
|
|
252
|
+
Finished in 3 minutes 5.5 seconds (files took 0.25551 seconds to load)
|
|
253
|
+
350 examples, 3 failures, 2 pending
|
|
254
|
+
|
|
255
|
+
Failed examples:
|
|
256
|
+
|
|
257
|
+
rspec ./spec/job_cron_spec.rb:119 # Rufus::Scheduler::CronJob#next_time returns the next trigger time (first_at => Time)
|
|
258
|
+
rspec ./spec/job_repeat_spec.rb:131 # Rufus::Scheduler::RepeatJob :first/:first_in/:first_at => point in time accepts a Time instance
|
|
259
|
+
rspec ./spec/job_repeat_spec.rb:279 # Rufus::Scheduler::RepeatJob :last/:last_in/:last_at => point in time accepts a Time instance
|
|
260
|
+
|
|
261
|
+
|
|
262
|
+
|
|
263
|
+
The command "bundle exec rspec" exited with 1.
|
|
264
|
+
store build cache
|
|
265
|
+
$ bundle clean
|
|
266
|
+
|
|
267
|
+
change detected (content changed, file is created, or file is deleted):
|
|
268
|
+
/home/travis/build/jmettraux/rufus-scheduler/vendor/bundle/ruby/2.1.0/cache/et-orbi-1.0.0.gem
|
|
269
|
+
/home/travis/build/jmettraux/rufus-scheduler/vendor/bundle/ruby/2.1.0/gems/et-orbi-1.0.0/cases.txt
|
|
270
|
+
/home/travis/build/jmettraux/rufus-scheduler/vendor/bundle/ruby/2.1.0/gems/et-orbi-1.0.0/CHANGELOG.md
|
|
271
|
+
/home/travis/build/jmettraux/rufus-scheduler/vendor/bundle/ruby/2.1.0/gems/et-orbi-1.0.0/CREDITS.md
|
|
272
|
+
/home/travis/build/jmettraux/rufus-scheduler/vendor/bundle/ruby/2.1.0/gems/et-orbi-1.0.0/et-orbi.gemspec
|
|
273
|
+
/home/travis/build/jmettraux/rufus-scheduler/vendor/bundle/ruby/2.1.0/gems/et-orbi-1.0.0/lib/et_orbi.rb
|
|
274
|
+
/home/travis/build/jmettraux/rufus-scheduler/vendor/bundle/ruby/2.1.0/gems/et-orbi-1.0.0/lib/et-orbi.rb
|
|
275
|
+
/home/travis/build/jmettraux/rufus-scheduler/vendor/bundle/ruby/2.1.0/gems/et-orbi-1.0.0/lib/etorbi.rb
|
|
276
|
+
/home/travis/build/jmettraux/rufus-scheduler/vendor/bundle/ruby/2.1.0/gems/et-orbi-1.0.0/LICENSE.txt
|
|
277
|
+
/home/travis/build/jmettraux/rufus-scheduler/vendor/bundle/ruby/2.1.0/gems/et-orbi-1.0.0/
|
|
278
|
+
|
|
279
|
+
...
|
|
280
|
+
|
|
281
|
+
changes detected, packing new archive
|
|
282
|
+
uploading archive
|
|
283
|
+
|
|
284
|
+
|
|
285
|
+
Done. Your build exited with 1.
|
data/n.txt
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
|
|
2
|
+
Chisels – Nomi (鑿)
|
|
3
|
+
Striking chisel – Tataki-nomi (叩鑿)
|
|
4
|
+
Primary striking chisel – Hon-tataki (本叩き)
|
|
5
|
+
Wide chisel – Hiro-nomi (広鑿)
|
|
6
|
+
Mid-thin chisel – Chu-usu-nomi (中薄鑿)
|
|
7
|
+
Mid-sized striking chisel – Chu-tataki-nomi (中叩鑿)
|
|
8
|
+
Butt chisel – Oire-nomi (大入鑿)
|
|
9
|
+
Mortise chisel – Mukoumachi-nomi (向う区鑿)
|
|
10
|
+
Double blade mortise chisel – Nihon-mukoumachi-nomi (二本向う区鑿)
|
|
11
|
+
Teverse round chisel – Ura-maru-nomi (裏丸鑿)
|
|
12
|
+
Tsubo type round chisel – Tsubo-maru-nomi (壺丸鑿)
|
|
13
|
+
Finishing chisel – Shiage-nomi (仕上鑿)
|
|
14
|
+
Paring chisel – Tsuki-nomi (突鑿)
|
|
15
|
+
Acute angles chisel – Ari-nomi (蟻鑿) or Shinogi-nomi (鎬鑿)
|
|
16
|
+
Thin chisel – Usu-nomi (薄鑿)
|
|
17
|
+
Trowel chisel – Kote-nomi (鏝鑿)
|
|
18
|
+
Special chisel’s
|
|
19
|
+
Sword guard chisel – Tsuba-nomi (鐔鑿)
|
|
20
|
+
Punching-out chisel – Uchinuki (打抜)
|
|
21
|
+
Chip-removing chisel – Sokosarae-nomi (底さらえ鑿)
|
|
22
|
+
Harpoon chisel – Mori-nomi (銛鑿)
|
|
23
|
+
Sickle chisel – Kama-nomi (鎌鑿)
|
|
24
|
+
Chisel parts and other names
|
|
25
|
+
Front side of blade – Ko ()
|
|
26
|
+
Back side of blade – Ura (裏)
|
|
27
|
+
Sharp edge – Kissaki ()
|
|
28
|
+
Blade facet – Kireba ()
|
|
29
|
+
Blade corners – Mimi ()
|
|
30
|
+
Side edge – Kobashi ()
|
|
31
|
+
Hollow back of chisel – Ura-suki (裏透き)
|
|
32
|
+
The flat back of the chisel – Beta-ura () // Beta is optimal size for chisels
|
|
33
|
+
Blade shaft – Kubi ()
|
|
34
|
+
Tang – Nakago ()
|
|
35
|
+
Ring between blade and handle – Kuchigane ()
|
|
36
|
+
Handle – E ()
|
|
37
|
+
Capping ring – Katsura ()
|
|
38
|
+
|
data/rufus-scheduler.gemspec
CHANGED
|
@@ -16,7 +16,7 @@ Gem::Specification.new do |s|
|
|
|
16
16
|
s.summary = 'job scheduler for Ruby (at, cron, in and every jobs)'
|
|
17
17
|
|
|
18
18
|
s.description = %{
|
|
19
|
-
|
|
19
|
+
Job scheduler for Ruby (at, cron, in and every jobs). Not a replacement for crond.
|
|
20
20
|
}.strip
|
|
21
21
|
|
|
22
22
|
#s.files = `git ls-files`.split("\n")
|
|
@@ -26,9 +26,11 @@ job scheduler for Ruby (at, cron, in and every jobs).
|
|
|
26
26
|
'*.gemspec', '*.txt', '*.rdoc', '*.md'
|
|
27
27
|
]
|
|
28
28
|
|
|
29
|
-
s.
|
|
29
|
+
s.required_ruby_version = '>= 1.9'
|
|
30
30
|
|
|
31
|
-
s.
|
|
31
|
+
s.add_runtime_dependency 'et-orbi', '~> 1.0'
|
|
32
|
+
|
|
33
|
+
s.add_development_dependency 'rspec', '~> 3.4.0'
|
|
32
34
|
s.add_development_dependency 'chronic'
|
|
33
35
|
|
|
34
36
|
s.require_path = 'lib'
|
data/sofia.md
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
|
|
2
|
+
I would take a different approach, one with a single schedule:
|
|
3
|
+
|
|
4
|
+
```ruby
|
|
5
|
+
# config/initializers/scheduler.rb
|
|
6
|
+
|
|
7
|
+
require 'rufus-scheduler'
|
|
8
|
+
|
|
9
|
+
Rufus::Scheduler.singleton.cron('* * * * *') do
|
|
10
|
+
# every minute
|
|
11
|
+
|
|
12
|
+
HarvestPlan.trigger_if_necessary
|
|
13
|
+
end
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
```ruby
|
|
17
|
+
# app/models/harvest_plan.rb
|
|
18
|
+
|
|
19
|
+
class HarvestPlan < ApplicationRecord
|
|
20
|
+
|
|
21
|
+
def self.trigger_if_necessary
|
|
22
|
+
|
|
23
|
+
now = Time.now
|
|
24
|
+
|
|
25
|
+
HarvestPlan.where(start_date < now && repetitions > 0) do |plan|
|
|
26
|
+
# warning pseudo active record code !
|
|
27
|
+
|
|
28
|
+
elapsed = now - plan.last_time / 3600
|
|
29
|
+
next if elapsed < @harveset_plan.hours_between
|
|
30
|
+
# that elapsed check could even be done in the `where` above
|
|
31
|
+
|
|
32
|
+
# clear to trigger
|
|
33
|
+
|
|
34
|
+
plan.trigger
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def trigger
|
|
39
|
+
|
|
40
|
+
self.repetitions -= 1
|
|
41
|
+
self.last_time = Time.now
|
|
42
|
+
self.save
|
|
43
|
+
|
|
44
|
+
CreateHarvestFromPlanJob.perform_later(self)
|
|
45
|
+
# that's ugly, when do not want to perform_later, we want to perform now!
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
```ruby
|
|
51
|
+
# in the controller...
|
|
52
|
+
|
|
53
|
+
def create
|
|
54
|
+
|
|
55
|
+
@harvest_plan = HarvestPlan.new(resource_params)
|
|
56
|
+
@harvest_plan.start_date = Time.parse(resource_params[:start_date])
|
|
57
|
+
|
|
58
|
+
return unless @harvest_plan.save
|
|
59
|
+
|
|
60
|
+
ApplicationController.new.insert_in_messages_list(
|
|
61
|
+
session, :success, 'Harvest plan created')
|
|
62
|
+
|
|
63
|
+
redirect_to farms_path
|
|
64
|
+
end
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
You could even avoid using rufus-scheduler:
|
|
69
|
+
|
|
70
|
+
```ruby
|
|
71
|
+
# config/initializers/scheduler.rb
|
|
72
|
+
|
|
73
|
+
Thread.new do
|
|
74
|
+
loop do
|
|
75
|
+
begin
|
|
76
|
+
sleep 59
|
|
77
|
+
HarvestPlan.trigger_if_necessary
|
|
78
|
+
rescue => err
|
|
79
|
+
Rails.logger.warn "#{err.object_id} - problem with HarvestPlan triggering... " + err.inspect
|
|
80
|
+
err.backtrace.each do |line|
|
|
81
|
+
Rails.logger.warn "#{err.object_id} - #{line}"
|
|
82
|
+
end
|
|
83
|
+
end
|
|
84
|
+
end
|
|
85
|
+
end
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
Best regards.
|
|
89
|
+
|