Sha256: 2b5ce5021866f67a34230857a6b2a2570744060d7748aa25815ffa9c92e39d8d

Contents?: true

Size: 615 Bytes

Versions: 1

Compression:

Stored size: 615 Bytes

Contents

require 'simple_worker'

class TestRunner < SimpleWorker::Base

    def run(data=nil)
        puts 'running the runner for leroy '.upcase + ' with data: ' + data.inspect
        @times = data["times"].to_i
        @times.times do |i|
            puts 'running at ' + i.to_s
            sleep 1
            set_progress(:percent=> (i / @times * 100))
        end
    end

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

    def progress
        if @count
            return @count / @times
        end
        return 0.0
    end



end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
simple_worker-0.0.13 test/test_runner.rb