Sha256: 4442f6992528d6d72bf75e516cee7246fafea7a57ace832f1831b4e8cf496103

Contents?: true

Size: 1.46 KB

Versions: 10

Compression:

Stored size: 1.46 KB

Contents

=begin
begin
    require File.join(File.dirname(__FILE__), '../lib/simple_worker')
rescue Exception => ex
    puts ex.message
    require 'simple_worker'
end
=end

# Bump for new checksum.sdf adsfjlaksdjf dasfasdfadsf
class TestWorker2 < SimpleWorker::Base

    merge File.join(File.dirname(__FILE__), 'models', 'model_1.rb')
    unmerge 'models/model_2.rb'
    merge_worker File.join(File.dirname(__FILE__), 'second_worker.rb'), 'SecondWorker'

    attr_accessor :s3_key, :times, :x


    #TEST dsd
    def who_am_i2?
        return self.class.name
    end

    def run
        log 'running the runner for leroy '.upcase + ' with data: '

        log 's3_key instance_variable = ' + self.s3_key
        times.times do |i|
            log 'running at ' + i.to_s
            sleep 1
            set_progress(:percent=> (i / times * 100))
        end
        m1 = Model1.new
        log "I made a new model1"
        m1.say_hello

        second_workers = []
        now = Time.now
        10.times do |i|
            second_worker = SecondWorker.new
            second_worker.start_time = now
            second_worker.num = i
            second_worker.queue
            second_workers << second_worker
        end

        10.times do |i|
            second_workers.each do |sw|
                puts sw.to_s
                puts sw.status["status"].to_s
            end
        end
    end

    def set_complete(params=nil)
        log 'SET COMPLETE YAY!' + params[:task_set_id]
    end

end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
simple_worker-0.5.8 test/test_worker_2.rb
simple_worker-0.5.6 test/test_worker_2.rb
simple_worker-0.5.5 test/test_worker_2.rb
simple_worker-0.5.4 test/test_worker_2.rb
simple_worker-0.5.2 test/test_worker_2.rb
simple_worker-0.5.1 test/test_worker_2.rb
simple_worker-0.4.0 test/test_worker_2.rb
simple_worker-0.3.24 test/test_worker_2.rb
simple_worker-0.3.23 test/test_worker_2.rb
simple_worker-0.3.22 test/test_worker_2.rb