sevenwire-bj 1.0.2 → 1.0.4

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.
data/HISTORY CHANGED
@@ -1,4 +1,7 @@
1
- 1.0.3
1
+ 1.0.4:
2
+ - added config["utc"] to convert times from local to utc (by Brandon Arbini)
3
+
4
+ 1.0.3:
2
5
  - env wasn't properly unpacked by runner, added YAML.load(job.env), thanks
3
6
  Chris Wanstrath
4
7
  - made operations that generate migrations, etc, verbose - they dump
data/bj.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "bj"
3
- s.version = "1.0.2"
3
+ s.version = "1.0.4"
4
4
  s.summary = "Bj"
5
5
 
6
6
  s.files = ["bin", "bin/bj", "bj.gemspec", "HISTORY", "install.rb", "lib", "lib/bj", "lib/bj/api.rb", "lib/bj/attributes.rb", "lib/bj/bj.rb", "lib/bj/errors.rb", "lib/bj/joblist.rb", "lib/bj/logger.rb", "lib/bj/runner.rb", "lib/bj/stdext.rb", "lib/bj/table.rb", "lib/bj/util.rb", "lib/bj.rb", "rakefile", "README", "TODO"]
data/lib/bj.rb CHANGED
@@ -3,7 +3,7 @@ unless defined? Bj
3
3
  #
4
4
  # constants and associated attrs
5
5
  #
6
- Bj::VERSION = "1.0.2" #unless defined?(Bj::VERSION)
6
+ Bj::VERSION = "1.0.4" #unless defined?(Bj::VERSION)
7
7
  def self.version() Bj::VERSION end
8
8
 
9
9
  Bj::LIBDIR = File.expand_path(File::join(File.dirname(__FILE__), "bj")) + File::SEPARATOR unless
@@ -185,7 +185,7 @@ class Bj
185
185
  job = thread = stdout = stderr = nil
186
186
 
187
187
  Bj.transaction(options) do
188
- now = Time.now.utc
188
+ now = Util.now
189
189
 
190
190
  job = Bj::Table::Job.find :first,
191
191
  :conditions => ["state = ? and submitted_at <= ?", "pending", now],
@@ -202,7 +202,7 @@ class Bj
202
202
  stdin = job.stdin || ''
203
203
  stdout = job.stdout || ''
204
204
  stderr = job.stderr || ''
205
- started_at = Time.now.utc
205
+ started_at = Util.now
206
206
 
207
207
  thread = Util.start command, :cwd=>Bj.rails_root, :env=>env, :stdin=>stdin, :stdout=>stdout, :stderr=>stderr
208
208
 
@@ -215,7 +215,7 @@ class Bj
215
215
  end
216
216
 
217
217
  exit_status = thread.value
218
- finished_at = Time.now.utc
218
+ finished_at = Util.now
219
219
 
220
220
  Bj.transaction(options) do
221
221
  job = Bj::Table::Job.find job.id
@@ -289,7 +289,7 @@ class Bj
289
289
 
290
290
  def fill_morgue
291
291
  Bj.transaction do
292
- now = Time.now.utc
292
+ now = Util.now
293
293
  jobs = Bj::Table::Job.find :all,
294
294
  :conditions => ["state = 'running' and runner = ?", Bj.hostname]
295
295
  jobs.each do |job|
@@ -311,7 +311,7 @@ class Bj
311
311
 
312
312
  def archive_jobs
313
313
  Bj.transaction do
314
- now = Time.now.utc
314
+ now = Util.now
315
315
  too_old = now - Bj.ttl
316
316
  jobs = Bj::Table::Job.find :all,
317
317
  :conditions => ["(state = 'finished' or state = 'dead') and submitted_at < ?", too_old]
@@ -145,7 +145,7 @@ class Bj
145
145
  :tag => "",
146
146
  :is_restartable => true,
147
147
  :submitter => Bj.hostname,
148
- :submitted_at => Time.now.utc,
148
+ :submitted_at => Util.now
149
149
  }
150
150
  end
151
151
  end
@@ -127,6 +127,10 @@ class Bj
127
127
  b = e.backtrace.join("\n") rescue ""
128
128
  "#{ m }(#{ c })\n#{ b }"
129
129
  end
130
+
131
+ def now
132
+ Bj.config["utc"] ? Time.now.utc : Time.now
133
+ end
130
134
  end
131
135
  send :extend, ModuleMethods
132
136
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sevenwire-bj
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ara T. Howard