api

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2021 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const SettingsFilenameJs = "CogSettings.ts"
View Source
const SettingsFilenamePy = "cog_settings.py"

Variables

View Source
var ClientActorServiceEndpoint = ClientServiceName

ClientActorServiceEndpoint is the endpoint used for client actors

View Source
var ClientServiceName = "client"

ClientServiceName is the name used for client service

View Source
var EnvironmentServiceName = "environment"

EnvironmentServiceName is the name used for environment service

View Source
var ValidProjectFilenames = []string{
	"cogment.yaml",
	"cogment.yml",
}

Functions

func ComputeTrialActorServiceName

func ComputeTrialActorServiceName(actor *TrialActor) string

ComputeTrialActorServiceName computes the service name for a given trial actor

func GetProjectConfigPathFromProjectPath

func GetProjectConfigPathFromProjectPath(projectPath string) (string, error)

GetProjectConfigPathFromProjectPath returns the path to an existing project configuration file in a given directory

func ProtoAliasFromProtoPath

func ProtoAliasFromProtoPath(path string) string

ProtoAliasFromProtoPath convert the path to a .proto file to an unique alias like path/to/data.proto => path_to_data_pb

Types

type ActorClass

type ActorClass struct {
	Name   string
	Action struct {
		Space string
	}
	Observation *Observation
	ConfigType  string `yaml:"config_type"`
}

type ActorImplementation

type ActorImplementation struct {
	Name         string
	ActorClasses []string
}

ActorImplementation represents an actor implementation:

  • its unique name, and
  • the actor classes it implements.

type ActorService

type ActorService struct {
	Name            string
	Endpoint        string
	Implementations []ActorImplementation
}

ActorService represents an actor service:

  • its unique name,
  • its endpoint, and
  • the actor implementations it hosts

type Application

type Application struct {
	Id               string `json:"id,omitempty"`
	Name             string `json:"name"`
	CreatedAt        int    `json:"created_at,omitempty"`
	LastDeploymentAt int    `json:"last_deployment_at,omitempty"`
}

type ApplicationDetails

type ApplicationDetails struct {
	Id          string                   `json:"id,omitempty"`
	CreatedAt   int                      `json:"created_at,omitempty"`
	Status      string                   `json:"status"`
	ErrorReason string                   `json:"error_reason"`
	Services    map[string]ServiceStatus `json:"services"`
}

type ComponentsConfigurations

type ComponentsConfigurations struct {
	Orchestrator helper.VersionInfo
	Python       helper.VersionInfo
	Metrics      helper.VersionInfo
	Dashboard    helper.VersionInfo
}

ComponentsConfigurations describes the configuration of the cogment components

type DeltaApplyFn

type DeltaApplyFn struct {
	Python     string
	Javascript string
}

type DockerRegistry

type DockerRegistry struct {
	Id          int    `json:"id,omitempty"`
	RegistryUrl string `json:"registry_url"`
	CreatedAt   int    `json:"created_at,omitempty"`
	UpdatedAt   int    `json:"updated_at,omitempty"`
}

type Environment

type Environment struct {
	ConfigType string `yaml:"config_type"`
}

type Import

type Import struct {
	Proto      []string
	ProtoAlias []string
	Python     []string
	Javascript []string
}

type LogEntry

type LogEntry struct {
	ServiceName string `json:"service_name"`
	Message     string `json:"message"`
	Timestamp   uint64 `json:"timestamp"`
	Source      string `json:"source"`
}

type Observation

type Observation struct {
	Space        string
	Delta        string
	DeltaApplyFn *DeltaApplyFn `yaml:"delta_apply_fn"`
}

type ProjectConfig

type ProjectConfig struct {
	ActorClasses      []*ActorClass `yaml:"actor_classes"`
	CliVersion        string
	Commands          map[string]string
	Components        ComponentsConfigurations
	Environment       *Environment
	Import            Import
	ProjectConfigPath string
	ProjectName       string
	Trial             *Trial
	TrialParams       *TrialParams `yaml:"trial_params"`
	Typescript        bool
	WebClient         bool
}

ProjectConfig describes the root configuration of a cogment app, as loaded from a `cogment.yaml` file.

func CreateDefaultProjectConfig

func CreateDefaultProjectConfig() (*ProjectConfig, error)

CreateDefaultProjectConfig creates a project with the defaults defined in "/api/default_cogment.yaml"

func CreateProjectConfigFromProjectPath

func CreateProjectConfigFromProjectPath(projectPath string) (*ProjectConfig, error)

CreateProjectConfigFromProjectPath creates a new instance of ProjectConfig from a given directory. It will lookup `cogment.yaml`, `cogment.yml`

func CreateProjectConfigFromYaml

func CreateProjectConfigFromYaml(filename string) (*ProjectConfig, error)

CreateProjectConfigFromYaml creates a new instance of ProjectConfig from a given `cogment.yaml` file

func ExtendDefaultProjectConfig

func ExtendDefaultProjectConfig(config *ProjectConfig) (*ProjectConfig, error)

ExtendDefaultProjectConfig extends the default project configuration with the given config

the given config is left untouched.

func (*ProjectConfig) CountActorsByActorClass

func (p *ProjectConfig) CountActorsByActorClass(name string) (countAi, countHuman int)

func (*ProjectConfig) ListClientActorImplementations

func (p *ProjectConfig) ListClientActorImplementations() []ActorImplementation

ListClientActorImplementations lists the client actor implementations from the default trial

func (*ProjectConfig) ListServiceActorServices

func (p *ProjectConfig) ListServiceActorServices() []ActorService

ListServiceActorServices lists the service actor services used by the default trial

type RegistryConfiguration

type RegistryConfiguration struct {
	RegistryUrl string `json:"registry_url"`
	Username    string `json:"username"`
	Password    string `json:"password"`
}

type SearchLogsResult

type SearchLogsResult struct {
	Results []*LogEntry `json:"results"`
	Count   int         `json:"count"`
	Total   int         `json:"total"`
}

type ServiceStatus

type ServiceStatus struct {
	Image     string   `json:"image"`
	Endpoints []string `json:"endpoints"`
	Status    string   `json:"status"`
	Errors    []string `json:"errors"`
}

type Trial

type Trial struct {
	ConfigType string   `yaml:"config_type"`
	PreHooks   []string `yaml:"pre_hooks"`
}

type TrialActor

type TrialActor struct {
	Name           string
	ActorClass     string `yaml:"actor_class"`
	Endpoint       string
	Implementation string
	Config         map[string]interface{}
}

type TrialParams

type TrialParams struct {
	Environment struct {
		Endpoint string
		Config   map[string]interface{}
	}
	Actors []*TrialActor
}

Jump to

Keyboard shortcuts

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