Sha256: c598de89a4f2e378871919baf2a3144edbd9252ae7b9a77cc7b3f0defbd8e6b1

Contents?: true

Size: 1.25 KB

Versions: 1

Compression:

Stored size: 1.25 KB

Contents

begin
    require File.join(File.dirname(__FILE__), '../lib/simple_worker')
rescue Exception
    require 'simple_worker'
end

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

    merge 'models/model_1.rb'
    merge 'second_worker.rb'

    attr_accessor :s3_key, :times, :x


    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

1 entries across 1 versions & 1 rubygems

Version Path
simple_worker-0.3.5 test/test_worker_2.rb