context

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2019 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func APIPath

func APIPath(apiName string, appName string) string

func APIResourcesAndComputesMatch

func APIResourcesAndComputesMatch(ctx1 *Context, ctx2 *Context) bool

func DataTypeID

func DataTypeID(dataType interface{}) string

func ExtractResourceWorkloadIDs

func ExtractResourceWorkloadIDs(resources []ComputedResource) map[string]string

func GetRawColumnUserConfig

func GetRawColumnUserConfig(rawColumn RawColumn) userconfig.Resource

Types

type API

type API struct {
	*userconfig.API
	*ComputedResourceFields
	Path      string `json:"path"`
	ModelName string `json:"model_name"` // This removes the @ from userconfig.API.Model, or sets it to userconfig.API.ModelPath if it's external
}

type APIs

type APIs map[string]*API

func (APIs) OneByID

func (apis APIs) OneByID(id string) *API

type Aggregate

type Aggregate struct {
	*userconfig.Aggregate
	*ComputedResourceFields
	Type userconfig.OutputSchema `json:"type"`
	Key  string                  `json:"key"`
}

type Aggregates

type Aggregates map[string]*Aggregate

func (Aggregates) OneByID

func (aggregates Aggregates) OneByID(id string) *Aggregate

type Aggregator

type Aggregator struct {
	*userconfig.Aggregator
	*ResourceFields
	Namespace *string `json:"namespace"`
	ImplKey   string  `json:"impl_key"`
}

type Aggregators

type Aggregators map[string]*Aggregator

func (Aggregators) OneByID

func (aggregators Aggregators) OneByID(id string) *Aggregator

type App

type App struct {
	*userconfig.App
	ID string `json:"id"`
}

type Column

type Column interface {
	ComputedResource
	GetColumnType() userconfig.ColumnType
	IsRaw() bool
}

type Columns

type Columns map[string]Column

type ComputedResource

type ComputedResource interface {
	Resource
	GetWorkloadID() string
	SetWorkloadID(string)
}

type ComputedResourceFields

type ComputedResourceFields struct {
	*ResourceFields
	WorkloadID string `json:"workload_id"`
}

func (*ComputedResourceFields) GetWorkloadID

func (r *ComputedResourceFields) GetWorkloadID() string

func (*ComputedResourceFields) SetWorkloadID

func (r *ComputedResourceFields) SetWorkloadID(workloadID string)

type Constant

type Constant struct {
	*userconfig.Constant
	*ResourceFields
	Key string `json:"key"`
}

type Constants

type Constants map[string]*Constant

func (Constants) OneByID

func (constants Constants) OneByID(id string) *Constant

type Context

type Context struct {
	ID                 string               `json:"id"`
	Key                string               `json:"key"`
	CortexConfig       *config.CortexConfig `json:"cortex_config"`
	DatasetVersion     string               `json:"dataset_version"`
	Root               string               `json:"root"`
	MetadataRoot       string               `json:"metadata_root"`
	RawDataset         RawDataset           `json:"raw_dataset"`
	StatusPrefix       string               `json:"status_prefix"`
	App                *App                 `json:"app"`
	Environment        *Environment         `json:"environment"`
	PythonPackages     PythonPackages       `json:"python_packages"`
	RawColumns         RawColumns           `json:"-"`
	Aggregates         Aggregates           `json:"aggregates"`
	TransformedColumns TransformedColumns   `json:"transformed_columns"`
	Models             Models               `json:"models"`
	APIs               APIs                 `json:"apis"`
	Constants          Constants            `json:"constants"`
	Aggregators        Aggregators          `json:"aggregators"`
	Transformers       Transformers         `json:"transformers"`
	Estimators         Estimators           `json:"estimators"`
}

func FromMsgpackBytes

func FromMsgpackBytes(b []byte) (*Context, error)

func (*Context) APIResourceWorkloadIDs

func (ctx *Context) APIResourceWorkloadIDs() map[string]string

func (*Context) APIResources

func (ctx *Context) APIResources() []ComputedResource

func (*Context) AllComputedResourceDependencies

func (ctx *Context) AllComputedResourceDependencies(resourceID string) strset.Set

func (*Context) AllResources

func (ctx *Context) AllResources() []Resource

func (*Context) AllResourcesByName

func (ctx *Context) AllResourcesByName(name string) []Resource

func (*Context) CheckAllWorkloadIDsPopulated

func (ctx *Context) CheckAllWorkloadIDsPopulated() error

func (*Context) ColumnNames

func (ctx *Context) ColumnNames() strset.Set

func (*Context) Columns

func (ctx *Context) Columns() Columns

func (*Context) ComputedResourceIDs

func (ctx *Context) ComputedResourceIDs() strset.Set

func (*Context) ComputedResourceResourceWorkloadIDs

func (ctx *Context) ComputedResourceResourceWorkloadIDs() map[string]string

func (*Context) ComputedResourceWorkloadIDs

func (ctx *Context) ComputedResourceWorkloadIDs() strset.Set

func (*Context) ComputedResources

func (ctx *Context) ComputedResources() []ComputedResource

func (*Context) DataComputedResources

func (ctx *Context) DataComputedResources() []ComputedResource

func (*Context) DataResourceWorkloadIDs

func (ctx *Context) DataResourceWorkloadIDs() map[string]string

func (*Context) DirectComputedResourceDependencies

func (ctx *Context) DirectComputedResourceDependencies(resourceID string) strset.Set

func (*Context) ExtractCortexResources

func (ctx *Context) ExtractCortexResources(
	input interface{},
	resourceTypes ...resource.Type,
) []Resource

func (*Context) GetColumn

func (ctx *Context) GetColumn(name string) Column

func (Context) MarshalJSON

func (ctx Context) MarshalJSON() ([]byte, error)

func (*Context) OneResourceByID

func (ctx *Context) OneResourceByID(resourceID string) Resource

Note: there may be >1 resources with the ID, this returns one of them

func (*Context) OneTrainingDatasetByID

func (ctx *Context) OneTrainingDatasetByID(id string) *TrainingDataset

func (*Context) PopulateWorkloadIDs

func (ctx *Context) PopulateWorkloadIDs(resourceWorkloadIDs map[string]string)

Overwrites any existing workload IDs

func (Context) ToMsgpackBytes

func (ctx Context) ToMsgpackBytes() ([]byte, error)

func (*Context) ToSerial

func (ctx *Context) ToSerial() *Serial

func (*Context) UnmarshalJSON

func (ctx *Context) UnmarshalJSON(b []byte) error

func (*Context) Validate

func (ctx *Context) Validate() error

func (*Context) VisibleResourceByName

func (ctx *Context) VisibleResourceByName(name string) (ComputedResource, error)

func (*Context) VisibleResourceByNameAndType

func (ctx *Context) VisibleResourceByNameAndType(name string, resourceTypeStr string) (ComputedResource, error)

func (*Context) VisibleResourcesByName

func (ctx *Context) VisibleResourcesByName(name string) []ComputedResource

func (*Context) VisibleResourcesMap

func (ctx *Context) VisibleResourcesMap() map[string][]ComputedResource

type DataSplit

type DataSplit struct {
	CSVData     *userconfig.CSVData     `json:"csv_data"`
	ParquetData *userconfig.ParquetData `json:"parquet_data"`
}

type Environment

type Environment struct {
	*userconfig.Environment
	ID string `json:"id"`
}

type Estimator

type Estimator struct {
	*userconfig.Estimator
	*ResourceFields
	Namespace *string `json:"namespace"`
	ImplKey   string  `json:"impl_key"`
}

type Estimators

type Estimators map[string]*Estimator

func (Estimators) OneByID

func (estimators Estimators) OneByID(id string) *Estimator

type Model

type Model struct {
	*userconfig.Model
	*ComputedResourceFields
	Key     string           `json:"key"`
	Dataset *TrainingDataset `json:"dataset"`
}

type Models

type Models map[string]*Model

func (Models) GetTrainingDatasets

func (models Models) GetTrainingDatasets() TrainingDatasets

func (Models) OneByID

func (models Models) OneByID(id string) *Model

type PythonPackage

type PythonPackage struct {
	userconfig.ResourceFields
	*ComputedResourceFields
	SrcKey     string `json:"src_key"`
	PackageKey string `json:"package_key"`
}

func (*PythonPackage) GetResourceType

func (pythonPackage *PythonPackage) GetResourceType() resource.Type

type PythonPackages

type PythonPackages map[string]*PythonPackage

type RawColumn

type RawColumn interface {
	Column
	GetCompute() *userconfig.SparkCompute
}

type RawColumns

type RawColumns map[string]RawColumn

func (RawColumns) OneByID

func (rawColumns RawColumns) OneByID(id string) RawColumn

type RawColumnsTypeSplit

type RawColumnsTypeSplit struct {
	RawIntColumns      map[string]*RawIntColumn      `json:"raw_int_columns"`
	RawStringColumns   map[string]*RawStringColumn   `json:"raw_string_columns"`
	RawFloatColumns    map[string]*RawFloatColumn    `json:"raw_float_columns"`
	RawInferredColumns map[string]*RawInferredColumn `json:"raw_inferred_columns"`
}

type RawDataset

type RawDataset struct {
	Key string `json:"key"`
}

type RawFloatColumn

type RawFloatColumn struct {
	*userconfig.RawFloatColumn
	*ComputedResourceFields
}

type RawInferredColumn

type RawInferredColumn struct {
	*userconfig.RawInferredColumn
	*ComputedResourceFields
}

type RawIntColumn

type RawIntColumn struct {
	*userconfig.RawIntColumn
	*ComputedResourceFields
}

type RawStringColumn

type RawStringColumn struct {
	*userconfig.RawStringColumn
	*ComputedResourceFields
}

type Resource

type Resource interface {
	userconfig.Resource
	GetID() string
}

func ExtractCortexResources

func ExtractCortexResources(
	input interface{},
	validResources []Resource,
	resourceTypes ...resource.Type,
) []Resource

type ResourceFields

type ResourceFields struct {
	ID           string        `json:"id"`
	ResourceType resource.Type `json:"resource_type"`
}

func (*ResourceFields) GetID

func (r *ResourceFields) GetID() string

type Serial

type Serial struct {
	*Context
	RawColumnSplit *RawColumnsTypeSplit `json:"raw_columns"`
	DataSplit      *DataSplit           `json:"environment_data"`
}

func (*Serial) ContextFromSerial

func (serial *Serial) ContextFromSerial() (*Context, error)

type TrainingDataset

type TrainingDataset struct {
	userconfig.ResourceFields
	*ComputedResourceFields
	ModelName string `json:"model_name"`
	TrainKey  string `json:"train_key"`
	EvalKey   string `json:"eval_key"`
}

func (*TrainingDataset) GetResourceType

func (trainingDataset *TrainingDataset) GetResourceType() resource.Type

type TrainingDatasets

type TrainingDatasets map[string]*TrainingDataset

type TransformedColumn

type TransformedColumn struct {
	*userconfig.TransformedColumn
	*ComputedResourceFields
	Type userconfig.ColumnType `json:"type"`
}

func (*TransformedColumn) GetColumnType

func (column *TransformedColumn) GetColumnType() userconfig.ColumnType

type TransformedColumns

type TransformedColumns map[string]*TransformedColumn

func (TransformedColumns) OneByID

func (columns TransformedColumns) OneByID(id string) *TransformedColumn

type Transformer

type Transformer struct {
	*userconfig.Transformer
	*ResourceFields
	Namespace *string `json:"namespace"`
	ImplKey   string  `json:"impl_key"`
}

type Transformers

type Transformers map[string]*Transformer

func (Transformers) OneByID

func (transformers Transformers) OneByID(id string) *Transformer

Jump to

Keyboard shortcuts

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