def chimpd_wait_until_done
      local_queue = ChimpQueue.instance
      $stdout.print "Waiting for chimpd jobs to complete for group #{@group}..."

      begin
        while !@dry_run
          local_queue = ChimpQueue.instance
          #
          # load up remote chimpd jobs into the local queue
          # this makes all the standard queue control methods available to us
          #
          sleeping_counter = 0
          while true
            local_queue.reset!

            begin
              all = ChimpDaemonClient.retrieve_group_info(@chimpd_host, @chimpd_port, @group, :all)
            rescue RestClient::ResourceNotFound
              sleep 5
              $stdout.print "\nINFO: Waiting on group #{@group} to populate"
              retry
            end

            ChimpQueue.instance.create_group(@group)
            ChimpQueue[@group].set_jobs(all)

            if ChimpQueue[@group].done?
              Log.debug 'Group ' + @group.to_s + ' is completed'
              jobs = ChimpQueue[@group].size
              $stdout.print "\nINFO: Group #{@group} has completed (#{jobs} jobs)"
              break
            else
              Log.debug 'Group ' + @group.to_s + ' is not done.'
            end

            if sleeping_counter % 240 == 0
              $stdout.print "\n(Still) Waiting for group #{@group}" unless sleeping_counter == 0
            end
            $stdout.print "."
            $stdout.flush
            sleeping_counter += 5
            sleep 5
          end

          #
          # If verify_results returns false, then ask chimpd to requeue all failed jobs.
          #
          case verify_results(@group)
          when 'continue'
            break
          when 'retry'
            ChimpDaemonClient.retry_group(@chimpd_host, @chimpd_port, @group)
          when 'pause'
            @paused = true
            #stuck in this loop until action is taken
          end
        end
      ensure
        #$stdout.print " done\n"
      end
    end
def chimpd_wait_until_done
      local_queue = ChimpQueue.instance
      $stdout.print "Waiting for chimpd jobs to complete for group #{@group}..."

      begin
        while !@dry_run
          local_queue = ChimpQueue.instance
          #
          # load up remote chimpd jobs into the local queue
          # this makes all the standard queue control methods available to us
          #
          sleeping_counter = 0
          while true
            local_queue.reset!

            begin
              all = ChimpDaemonClient.retrieve_group_info(@chimpd_host, @chimpd_port, @group, :all)
            rescue RestClient::ResourceNotFound
              sleep 5
              $stdout.print "\nINFO: Waiting on group #{@group} to populate"
              retry
            end

            ChimpQueue.instance.create_group(@group)
            ChimpQueue[@group].set_jobs(all)

            if ChimpQueue[@group].done?
              Log.debug 'Group ' + @group.to_s + ' is completed'
              jobs = ChimpQueue[@group].size
              $stdout.print "\nINFO: Group #{@group} has completed (#{jobs} jobs)"
              break
            else
              Log.debug 'Group ' + @group.to_s + ' is not done.'
            end

            if sleeping_counter % 240 == 0
              $stdout.print "\n(Still) Waiting for group #{@group}" unless sleeping_counter == 0
            end
            $stdout.print "."
            $stdout.flush
            sleeping_counter += 5
            sleep 5
          end

          #
          # If verify_results returns false, then ask chimpd to requeue all failed jobs.
          #
          case verify_results(@group)
          when 'continue'
            break
          when 'retry'
            ChimpDaemonClient.retry_group(@chimpd_host, @chimpd_port, @group)
          when 'pause'
            @paused = true
            #stuck in this loop until action is taken
          end
        end
      ensure
        #$stdout.print " done\n"
      end
    end
Connect to chimpd and wait for the work queue to empty, and
 prompt the user if there are any errors.