Sha256: 61c8555ce47516f31f18e5ad78da0e51cb107c642c36793a550f9ab9651ae8e6

Contents?: true

Size: 1.41 KB

Versions: 3

Compression:

Stored size: 1.41 KB

Contents

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

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

    merge File.join(File.dirname(__FILE__), 'models', 'model_1.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

3 entries across 3 versions & 1 rubygems

Version Path
simple_worker-0.3.19 test/test_worker_2.rb
simple_worker-0.3.18 test/test_worker_2.rb
simple_worker-0.3.17 test/test_worker_2.rb