backend

package
v0.0.0-...-ce8f20e Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2019 License: AGPL-3.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AuthorizationKey

func AuthorizationKey(ctx context.Context, token string) *datastore.Key

AuthorizationKey key on collection AUTHORIZATIONS

func ClientResourceKey

func ClientResourceKey(ctx context.Context, clientID string) *datastore.Key

ClientResourceKey key on collection CLIENT_RESOURCES

func CreateClientAndAuthentication

func CreateClientAndAuthentication(ctx context.Context, clientID, clientSecret, scope, token string) error

CreateClientAndAuthentication creates a new client and its authentication

func CreateDefaultExport

func CreateDefaultExport(ctx context.Context, clientID string) (*types.ExportDS, error)

CreateDefaultExport creates an initial export definition

func CreateDefaultModel

func CreateDefaultModel(ctx context.Context, clientID string) (*types.ModelDS, error)

CreateDefaultModel creates an initial model definition

func CreateExport

func CreateExport(ctx context.Context, clientID, event string) (*types.ExportDS, error)

CreateExport creates a new export definition

func ExportEvents

func ExportEvents(ctx context.Context, exportID string) (int, error)

ExportEvents exports events in time range ]start, end] and writes it to a csv file on Cloud Storage

func ExportKey

func ExportKey(ctx context.Context, clientID, event string) *datastore.Key

ExportKey key on collection EXPORTS

func GetAuthorization

func GetAuthorization(ctx context.Context, token string) (*types.AuthorizationDS, error)

GetAuthorization returns the authorization for the given token

func GetEvents

func GetEvents(ctx context.Context, clientID, event string, start, end int64, page, limit int) (*[]types.EventDS, error)

GetEvents queries the events store for events of type event in the time range [start, end]

func GetExport

func GetExport(ctx context.Context, clientID, event string) (*types.ExportDS, error)

GetExport returns an export definition based on the clientID and event

func GetModel

func GetModel(ctx context.Context, clientID, name string) (*types.ModelDS, error)

GetModel returns the latest version of a model based on the clientID and name

func GetPrediction

func GetPrediction(ctx context.Context, clientID, name, id, entityType, targetEntityType string, limit int) (*api.Prediction, error)

GetPrediction returns a prediction based on a specified model

func ImportPredictions

func ImportPredictions(ctx context.Context, jobID string) error

ImportPredictions imports the results of a training job

func InvokeFunction

func InvokeFunction(ctx context.Context, function, reqID string, payload interface{}) (int, *types.GenericResponse)

InvokeFunction calls a Cloud Function and posts data to it

func MarkModelTrainingDone

func MarkModelTrainingDone(ctx context.Context, jobID, status string) error

MarkModelTrainingDone writes an export record back to the datastore with updated metadata

func MarkTrained

func MarkTrained(ctx context.Context, clientID, name string, trained, next int64) error

MarkTrained writes an export record back to the datastore with updated metadata

func MergeEvents

func MergeEvents(ctx context.Context, exportID string) error

MergeEvents merges all exported events for a model in a single file

func ModelKey

func ModelKey(ctx context.Context, clientID, name string) *datastore.Key

ModelKey key on collection MODELS

func PredictionKey

func PredictionKey(ctx context.Context, k string) *datastore.Key

PredictionKey key on collection PREDICTIONS

func PredictionKeyString

func PredictionKeyString(clientID, domain, entityID, revision string) string

PredictionKeyString returns the composite key string for a prediction

func ScheduleJob

func ScheduleJob(ctx context.Context, queue, request string) error

ScheduleJob is a shorthand to create a background job

func StoreEvent

func StoreEvent(ctx context.Context, clientID string, event *api.Event) error

StoreEvent stores an event in the datastore

func TrainModel

func TrainModel(ctx context.Context, modelID string) error

TrainModel submits a model for training to Google ML

func TrainingJobKey

func TrainingJobKey(ctx context.Context, k string) *datastore.Key

TrainingJobKey key on collection TRAINING_JOBS

Types

type TrainingInput

type TrainingInput struct {
	// FIXME: make this a generic struct for a generic glue function!
	ScaleTier      string   `json:"scaleTier"`
	PackageURIs    []string `json:"packageUris"`
	PythonModule   string   `json:"pythonModule"`
	Region         string   `json:"region"`
	JobDir         string   `json:"jobDir"`
	RuntimeVersion string   `json:"runtimeVersion"`
	PythonVersion  string   `json:"pythonVersion"`
	ModelArguments []string `json:"args"`
}

TrainingInput is used to submit a training job with Cloud ML

Jump to

Keyboard shortcuts

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