agent

package module
v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 28, 2024 License: MIT Imports: 24 Imported by: 0

README

ReSim Agent

The ReSim Agent allows ReSim jobs to be run on customer-controlled hosts.

It is designed to support the integration of Hardware-in-the-Loop (HiL) testing into your ReSim workflows.

See the Agent page on our docs site for more details.

Prerequisites

Install Docker (e.g. https://docs.docker.com/engine/install/ubuntu/#install-using-the-repository)

sudo chgrp docker /run/containerd/containerd.sock

Configuration

By default, the Agent loads config from ~/resim/config.yaml, caches credentials in that directory, and logs to the same directory (as well as stdout), however these settings can be overridden by setting the following environment variables:

  • RESIM_AGENT_CONFIG_DIR - to point to a different configuration and cache directory. The Agent will load configuration from config.yaml in this directory and cache credentials here.
  • RESIM_AGENT_LOG_DIR - to point to a different directory in which to write log files

The configuration file has the following options:

### Required
# Set a name for the agent which will be shown in ReSim
name: my-robot-arm
# Set the labels for which you would like this agent to run jobs (see below)
pool-labels: 
  - small
# These credentials for authenticating with the ReSim API will be provided by ReSim
username: 
password: 
### Optional 
# Log level - debug, info, warn, error (default: info)
log-level: info
# Size in MB of log file (default: 500), note that 3 compressed backups are kept
log-max-filesize: 200

Note that the pool-labels are an OR/ANY selection, that is, an agent running with the labels big and small will run jobs tagged with either of those labels.

CI

GO_VERSION is set as global variable in the repository settings

Releases

Binaries are built and uploaded to GitHub: https://github.com/resim-ai/agent/releases

To perform a release, push the appropriate v* tag to main.

Documentation

Index

Constants

View Source
const (
	APIHostDefault          = "https://agentapi.resim.ai/agent/v1"
	APIHostKey              = "api-host"
	AuthHostDefault         = "https://resim.us.auth0.com"
	AuthHostKey             = "auth-host"
	PoolLabelsKey           = "pool-labels"
	OneTaskKey              = "one-task"
	UsernameKey             = "username"
	PasswordKey             = "password"
	AgentNameKey            = "name"
	EnvPrefix               = "RESIM_AGENT"
	LogLevelKey             = "log-level"
	LogFilesizeKey          = "log-max-filesize"
	LogFilesizeDefault      = 500
	ConfigPath              = "$HOME/resim"
	CredentialCacheFilename = "cache.json"
)

Variables

This section is empty.

Functions

func CreateTmpResimDir

func CreateTmpResimDir() error

func StringifyEnvironmentVariables

func StringifyEnvironmentVariables(inputVars [][]string) []string

Types

type Agent

type Agent struct {
	APIClient         *api.ClientWithResponses
	DockerClient      *client.Client
	CurrentToken      *oauth2.Token
	TokenMutex        sync.Mutex
	ClientID          string
	AuthHost          string
	APIHost           string
	Name              string
	PoolLabels        []string
	ConfigDirOverride string
	LogDirOverride    string
	LogLevel          string
	Status            agentStatus
	CurrentTaskName   string
	CurrentTaskStatus api.TaskStatus
}

func (*Agent) GetConfigDir

func (a *Agent) GetConfigDir() (string, error)

func (*Agent) InitializeLogging

func (a *Agent) InitializeLogging() error

func (*Agent) LoadConfig

func (a *Agent) LoadConfig() error

func (*Agent) Start

func (a *Agent) Start() error

func (*Agent) Token

func (a *Agent) Token() (*oauth2.Token, error)

type AuthMode

type AuthMode string

type Task

type Task api.TaskPollOutput

Directories

Path Synopsis
Package api provides primitives to interact with the openapi HTTP API.
Package api provides primitives to interact with the openapi HTTP API.
test

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL