Documentation

Overview

    Package bot wraps managing Swarming bots.

    Index

    Constants

    This section is empty.

    Variables

    This section is empty.

    Functions

    This section is empty.

    Types

    type Bot

    type Bot interface {
    	// Wait waits for the bot process to exit.  The return value
    	// on subsequent calls is undefined.
    	Wait() error
    	// Drain signals for the bot to drain.  Note that this requires
    	// support from the bot script.  This should be handled by Swarming
    	// bots by waiting for the currently running task to finish before
    	// exiting.
    	Drain() error
    	// Terminate terminates the bot with SIGTERM.  Swarming bots handle
    	// SIGTERM by aborting the currently running task and exiting.
    	Terminate() error
    }

      Bot is the interface for interacting with a started Swarming bot. Wait must be called to ensure the process is waited for.

      type Config

      type Config struct {
      	// SwarmingURL is the URL of the Swarming instance.  Should be
      	// a full URL without the path, e.g. https://host.example.com
      	SwarmingURL string
      	BotID       string
      	// WorkDirectory is the Swarming bot's work directory.
      	// The caller should create this.
      	// The parent directory should be writable to allow creation
      	// of the drain file.
      	WorkDirectory string
      }

        Config is the configuration needed for starting a generic Swarming bot.

        type FakeBot

        type FakeBot struct {
        
        	// DrainFunc, if set, is called when the bot is drained.  The
        	// default behavior is Stop.
        	DrainFunc func(*FakeBot) error
        	// TerminateFunc, if set, is called when the bot is terminated.
        	// The default behavior is Stop.
        	TerminateFunc func(*FakeBot) error
        	// contains filtered or unexported fields
        }

          FakeBot is a fake implementation of Bot for tests.

          func NewFakeBot

          func NewFakeBot() *FakeBot

            NewFakeBot returns a new FakeBot.

            func (*FakeBot) Drain

            func (b *FakeBot) Drain() error

              Drain implements Bot.

              func (*FakeBot) Stop

              func (b *FakeBot) Stop()

                Stop stops the "bot process".

                func (*FakeBot) StopWith

                func (b *FakeBot) StopWith(err error)

                  StopWith stops the "bot process" with an error to be returned from Wait.

                  func (*FakeBot) Terminate

                  func (b *FakeBot) Terminate() error

                    Terminate implements Bot.

                    func (*FakeBot) Wait

                    func (b *FakeBot) Wait() error

                      Wait implements Bot.

                      type Starter

                      type Starter struct {
                      	// contains filtered or unexported fields
                      }

                        Starter has a Start method for starting Swarming bots.

                        func NewStarter

                        func NewStarter(c *http.Client) Starter

                          NewStarter returns a new Starter.

                          func (Starter) Start

                          func (s Starter) Start(c Config) (b Bot, err error)

                            Start starts a Swarming bot. The returned Bot object can be used to interact with the bot.

                            GOOS=linux, GOARCH=amd64