Skip to content
Browse files

Changed to use built in wait_until_complete method.

  • Loading branch information...
1 parent 605dacd commit 9f950bc9264d3e32bb90a004a13affff2a6dd583 @treeder treeder committed Mar 25, 2012
View
2 lib/iron_worker/config.rb
@@ -241,7 +241,7 @@ def self.check_for_file(f, callerr)
# try relative
# p caller
f2 = File.join(File.dirname(callerr), f)
- puts 'f2=' + f2
+ #puts 'f2=' + f2
if File.exist? f2
exists = true
f = f2
View
2 lib/iron_worker/service.rb
@@ -25,7 +25,7 @@ def initialize(token, options={})
options[:logger] = IronWorker.logger
super("worker-aws-us-east-1.iron.io", token, options)
self.host = self.config.host if self.config && self.config.host
- # automerge simple worker gem and dependenices
+ # automerge simple worker gem and dependencies
self.config.merge_gem('zip')
self.config.merge_gem('rest-client')
self.config.merge_gem('rest')
View
2 test/quick_schedule.rb
@@ -9,7 +9,7 @@ class QuickRun < TestBase
def test_scheduler
worker = TestWorker.new
worker.schedule(:start_at=>10.seconds.from_now)
- status = wait_for_task(worker)
+ status = worker.wait_until_complete
assert status["status"] == "complete"
assert status["msg"].present?
end
View
4 test/test_base.rb
@@ -11,7 +11,7 @@
raise ex
end
-IronWorker.logger.level = Logger::DEBUG
+#IronWorker.logger.level = Logger::DEBUG
IronWorker.service=nil
IronWorker.config.merged_gems={}
@@ -42,7 +42,7 @@ def setup
config.scheme = @config['iron_worker']['scheme'] if @config['iron_worker']['scheme']
config.global_attributes["db_user"] = "sa"
config.global_attributes["db_pass"] = "pass"
- config.database = @config["database"]
+ #config.database = @config["database"]
config.force_upload = true
# config.skip_auto_dependencies = true
end
View
4 test/test_gems.rb
@@ -9,7 +9,7 @@ def test_dropbox_gem
worker = AwesomeJob.new
worker.queue
- wait_for_task(worker)
+ worker.wait_until_complete
puts 'log=' + worker.get_log
@@ -22,7 +22,7 @@ def test_aws_s3_gem
worker.run_local
worker.queue
- wait_for_task(worker)
+ worker.wait_until_complete
puts 'log=' + worker.get_log
View
6 test/test_iron_worker.rb
@@ -102,7 +102,7 @@ def test_data_passing
cool = CoolWorker.new
cool.array_of_models = [CoolModel.new(:name => "name1"), CoolModel.new(:name => "name2")]
cool.queue
- status = wait_for_task(cool)
+ status = cool.wait_until_complete
assert status["status"] == "complete"
log = IronWorker.service.log(cool.task_id)
puts 'log=' + log.inspect
@@ -129,15 +129,15 @@ def test_set_progress
def test_exceptions
worker = FailWorker.new
worker.queue
- status = wait_for_task(worker)
+ status = worker.wait_until_complete
assert status["status"] == "error"
assert status["msg"].present?
end
def test_tmpdir
worker = TmpDirWorker.new
worker.queue
- status = wait_for_task(worker)
+ status = worker.wait_until_complete
assert status["status"] == "complete"
log = worker.get_log
assert log.include?("TMPDIR"), "TMPDIR is not set"
View
6 test/test_scheduling.rb
@@ -9,22 +9,22 @@ def test_scheduler
start_time = Time.now
worker.schedule(:start_at=>30.seconds.from_now)
- status = wait_for_task(worker)
+ status = worker.wait_until_complete
assert status["status"] == "complete"
end_time = Time.now
duration = (end_time-start_time)
puts "duration=#{duration}"
assert duration > 30
worker.schedule(:start_at=>1.seconds.from_now, :run_every=>5, :end_at=>60.seconds.from_now)
- status = wait_for_task(worker)
+ status = worker.wait_until_complete
assert status["status"] == "complete"
puts "run_count=#{status["run_count"]}"
assert status["run_count"] > 5
assert status["run_count"] < 20
worker.schedule(:start_at => 2.seconds.since, :run_every => 5, :run_times => 5)
- status = wait_for_task(worker)
+ status = worker.wait_until_complete
assert status["status"] == "complete"
puts "run_count=#{status["run_count"]}"
assert status["run_count"] == 5
View
6 test/test_scheduling_no_active_support.rb
@@ -9,22 +9,22 @@ def test_scheduler
start_time = Time.now
worker.schedule(:start_at=>(Time.now + 30).iso8601)
- status = wait_for_task(worker)
+ status = worker.wait_until_complete
assert status["status"] == "complete"
end_time = Time.now
duration = (end_time-start_time)
puts "duration=#{duration}"
assert duration > 30
worker.schedule(:start_at=>Time.now.iso8601, :run_every=>5, :end_at=>(Time.now + 60).iso8601)
- status = wait_for_task(worker)
+ status = worker.wait_until_complete
assert status["status"] == "complete"
puts "run_count=#{status["run_count"]}"
assert status["run_count"] > 5
assert status["run_count"] < 20
worker.schedule(:start_at => Time.now.iso8601, :run_every => 5, :run_times => 5)
- status = wait_for_task(worker)
+ status = worker.wait_until_complete
assert status["status"] == "complete"
puts "run_count=#{status["run_count"]}"
assert status["run_count"] == 5

0 comments on commit 9f950bc

Please sign in to comment.
Something went wrong with that request. Please try again.