plugin

package
v0.0.0-...-fb1c7ab Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2022 License: MIT Imports: 12 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var PluginConfig = GlobalConfig{
	HasInitialized: false,
}

Functions

func CopyPayloadInputsLocally

func CopyPayloadInputsLocally(payload ModelPayload, localRoot string) error

func DownloadObject

func DownloadObject(resource ResourceInfo) ([]byte, error)

func InitConfig

func InitConfig(cfg Config) error

func InitConfigFromEnv

func InitConfigFromEnv() error

func InitConfigFromPath

func InitConfigFromPath(configPath string) error

func Log

func Log(message Message)

func SetLogLevel

func SetLogLevel(logLevel Level)

func UpLoadFile

func UpLoadFile(resource ResourceInfo, fileBytes []byte) error

UpLoadFile

Types

type AwsConfig

type AwsConfig struct {
	Name                  string `json:"aws_config_name,omitempty"`
	IsPrimary             bool   `json:"is_primary_config"` //where payloads would get stored?
	AWS_ACCESS_KEY_ID     string `json:"aws_access_key_id"`
	AWS_SECRET_ACCESS_KEY string `json:"aws_secret_access_key_id"`
	AWS_REGION            string `json:"aws_region"`
	AWS_BUCKET            string `json:"aws_bucket"`
	S3_MOCK               bool   `json:"aws_mock,omitempty"`             //for testing with minio
	S3_ENDPOINT           string `json:"aws_endpoint,omitempty"`         //for testing with minio
	S3_DISABLE_SSL        bool   `json:"aws_disable_ssl,omitempty"`      //for testing with minio
	S3_FORCE_PATH_STYLE   bool   `json:"aws_force_path_style,omitempty"` //for testing with minio
}

type Config

type Config struct {
	AwsConfigs []AwsConfig `json:"aws_configs"`
}

func GetConfig

func GetConfig() Config

func (Config) PrimaryConfig

func (c Config) PrimaryConfig() (AwsConfig, error)

type EventConfiguration

type EventConfiguration struct {
	EventNumber       int       `json:"event_number"`
	RealizationNumber int       `json:"realization_number"`
	Seeds             []SeedSet `json:"seeds"`
}

func LoadEventConfiguration

func LoadEventConfiguration(resourceInfo ResourceInfo) (EventConfiguration, error)

func (EventConfiguration) SeedSet

func (ec EventConfiguration) SeedSet(identifier string) (SeedSet, error)

type FileData

type FileData struct {
	//Id is an internal element generated to identify any data element.
	Id string `json:"id,omitempty" yaml:"id,omitempty"`
	//FileName describes the name of the file that needs to be input or output.
	FileName string `json:"filename" yaml:"filename"`
	//InternalPaths (optional) describe the specific information in the file (e.g. /a/b/c/d/e/f for dss)
	InternalPaths []InternalPathData `json:"internal_paths,omitempty" yaml:"internal_paths,omitempty"`
}

can use this info to allow a user to link model manifests together.

type GlobalConfig

type GlobalConfig struct {
	HasInitialized bool
	Config
	// contains filtered or unexported fields
}

type GlobalLogger

type GlobalLogger struct {
	Level //i believe this will be global to the container each container having its own possible level (and wat having its own level too.)
}

type InternalPathData

type InternalPathData struct {
	//Id is an internal element generated to identify any data element.
	Id string `json:"id,omitempty" yaml:"id,omitempty"`
	//PathName describes the internal path location to the data needed or produced.
	PathName string `json:"pathname" yaml:"pathname"`
	//Type (optional) describes the type of information at the path (e.g. flow time-series)
	Type string `json:"type,omitempty" yaml:"type,omitempty"`
}

type Level

type Level uint8
const (
	DEBUG Level = iota
	INFO
	WARN
	ERROR
	FATAL
	PANIC
	DISABLED
)

func (Level) String

func (l Level) String() string

type Message

type Message struct {
	Status    Status `json:"status,omitempty"`
	Progress  int8   `json:"progress,omitempty"`
	Level     Level  `json:"level"`
	Message   string `json:"message"`
	Sender    string `json:"sender,omitempty"`
	PayloadId string `json:"payload_id"`
	// contains filtered or unexported fields
}

type Model

type Model struct {
	Name        string `json:"name" yaml:"name"`
	Alternative string `json:"alternative,omitempty" yaml:"alternative,omitempty"`
}

type ModelIdentifier

type ModelIdentifier struct {
	Model
	Files []ResourcedFileData `json:"files,omitempty" yaml:"files,omitempty"`
}

ModelIdentifier a model identifier describes a model at a high level, the name, a given alternative (simulation, plan, etc.) and the associated files that define the geometry (optional)

type ModelManifest

type ModelManifest struct {
	ManifestID      string `json:"manifest_id" yaml:"manifest_id"`
	Plugin          `json:"plugin" yaml:"plugin"`
	ModelIdentifier `json:"model_identifier" yaml:"model_identifier"`
	Inputs          []FileData `json:"inputs" yaml:"inputs"`
	Outputs         []FileData `json:"outputs" yaml:"outputs"`
}

ModelManifest

type ModelPayload

type ModelPayload struct {
	Id string `json:"payload_id" yaml:"payload_id"`
	Model
	EventIndex int                 `json:"event_index" yaml:"event_index"`
	Inputs     []ResourcedFileData `json:"inputs" yaml:"inputs"`
	Outputs    []ResourcedFileData `json:"outputs" yaml:"outputs"`
}

Payload

func LoadPayload

func LoadPayload(filepath string) (ModelPayload, error)

type Plugin

type Plugin struct {
	Name        string   `json:"name" yaml:"name"`
	ImageAndTag string   `json:"image_and_tag" yaml:"image_and_tag"`
	Command     []string `json:"command" yaml:"command"`
}

Plugin a plugin is defined by its name an image and tag and the command necessary to call it to run a payload.

type ResourceInfo

type ResourceInfo struct {
	Store Store  `json:"store" yaml:"store"`                   // s3, azure, local, queue?
	Root  string `json:"root" yaml:"root"`                     // bucket, rootdir, queue?
	Path  string `json:"path,omitempty" yaml:"path,omitempty"` // path to object
}

ResourceInfo defines the elements to resolve to a file object, what store it uses, the root (or bucket) and then the path to the asset.

type ResourcedFileData

type ResourcedFileData struct {
	//Id is an internal element generated to identify any data element.
	Id string `json:"id,omitempty" yaml:"id,omitempty"`
	//FileName describes the name of the file that needs to be input or output.
	FileName      string `json:"filename" yaml:"filename"`
	ResourceInfo  `json:"resource_info" yaml:"resource_info"`
	InternalPaths []ResourcedInternalPathData `json:"internal_paths,omitempty" yaml:"internal_paths,omitempty"`
}

ResourcedFileData

type ResourcedInternalPathData

type ResourcedInternalPathData struct {
	//PathName describes the internal path location to the data needed or produced.
	PathName     string `json:"pathname" yaml:"pathname"`
	FileName     string `json:"filename,omitempty" yaml:"filename,omitempty"`
	InternalPath string `json:"internal_path,omitempty" yaml:"internal_path,omitempty"`
	ResourceInfo `json:"resource_info" yaml:"resource_info"`
}

type SeedSet

type SeedSet struct {
	Identifier      string `json:"identifier"`
	EventSeed       int64  `json:"event_seed"`
	RealizationSeed int64  `json:"realization_seed"`
}

type Status

type Status string
const (
	COMPUTING Status = "Computing"
	FAILED    Status = "Failed"
	SUCCEEDED Status = "Succeeded"
)

type Store

type Store string
const (
	S3    Store = "S3"
	LOCAL Store = "Local"
)

Jump to

Keyboard shortcuts

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