def wait_each(timeout = -1)
                if ! block_given?
                    ary = Array.new
                end
                while true
                    begin
                        info = DRMAA.wait(ANY_JOB, timeout)
                    rescue DRMAAInvalidJobError
                        break
                    end
                    if block_given?
                        yield info
                    else
                        ary << info
                    end
                end
                if ! block_given?
                    return ary
                end
            end
def wait_each(timeout = -1)
                if ! block_given?
                    ary = Array.new
                end
                while true
                    begin
                        info = DRMAA.wait(ANY_JOB, timeout)
                    rescue DRMAAInvalidJobError
                        break
                    end
                    if block_given?
                        yield info
                    else
                        ary << info
                    end
                end
                if ! block_given?
                    return ary
                end
            end
run block with JobInfo to finish for each waited session job
 or return JobInfo array if no block was passed