trials

package
v0.0.0-...-b112479 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2023 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

AuthZProvider is the authz registry for experiments.

QueryTrialsOrderMap is a map of OrderBy choices to Sort Choices.

Functions

func BuildFilterTrialsQuery

func BuildFilterTrialsQuery(filters *apiv1.TrialFilters, selectAll bool) (*bun.SelectQuery, error)

BuildFilterTrialsQuery queries for Trials matching the supplied TrialFilters.

func BuildTrialPatchQuery

func BuildTrialPatchQuery(payload *apiv1.TrialPatch) (*bun.UpdateQuery, error)

BuildTrialPatchQuery creates an UpdateQuery according to the provided patch.

func MetricsTimeSeries

func MetricsTimeSeries(trialID int32, startTime time.Time,
	metricName string,
	startBatches int, endBatches int, xAxisMetricLabels []string,
	maxDatapoints int, timeSeriesColumn string,
	timeSeriesFilter *commonv1.PolymorphicFilter, metricType string) (
	metricMeasurements []db.MetricMeasurements, err error,
)

MetricsTimeSeries returns a time-series of the specified metric in the specified trial.

func TrialsColumnForNamespace

func TrialsColumnForNamespace(namespace apiv1.TrialSorter_Namespace,
	field string,
) (string, error)

TrialsColumnForNamespace returns the correct namespace for a TrialSorter.

Types

type TrialAuthZ

type TrialAuthZ interface {
	// POST /trial-comparison/collections
	CanCreateTrialCollection(
		ctx context.Context, curUser *model.User, projectID int32,
	) (canGetCollections bool, serverError error)

	// POST /trial-comparison/query
	// POST /trial-comparison/update-trial-tags
	AuthFilterTrialsQuery(
		ctx context.Context,
		curUser *model.User,
		query *bun.SelectQuery,
		update bool,
	) (*bun.SelectQuery, error)

	// GET /trial-comparison/collections
	AuthFilterCollectionsReadQuery(
		ctx context.Context,
		curUser *model.User,
		query *bun.SelectQuery,
	) (*bun.SelectQuery, error)

	// PATCH /trial-comparison/collections
	AuthFilterCollectionsUpdateQuery(
		ctx context.Context,
		curUser *model.User,
		query *bun.UpdateQuery,
	) (*bun.UpdateQuery, error)

	// DELETE /trial-comparison/collections
	AuthFilterCollectionsDeleteQuery(
		ctx context.Context,
		curUser *model.User,
		query *bun.DeleteQuery,
	) (*bun.DeleteQuery, error)
}

TrialAuthZ describes authz methods for experiments.

type TrialAuthZBasic

type TrialAuthZBasic struct{}

TrialAuthZBasic is basic OSS Determined authentication.

func (*TrialAuthZBasic) AuthFilterCollectionsDeleteQuery

func (a *TrialAuthZBasic) AuthFilterCollectionsDeleteQuery(
	ctx context.Context,
	curUser *model.User,
	query *bun.DeleteQuery,
) (*bun.DeleteQuery, error)

AuthFilterCollectionsDeleteQuery filters a trials DeleteQuery to those the user is authorized to delete.

func (*TrialAuthZBasic) AuthFilterCollectionsReadQuery

func (a *TrialAuthZBasic) AuthFilterCollectionsReadQuery(
	ctx context.Context,
	curUser *model.User,
	query *bun.SelectQuery,
) (*bun.SelectQuery, error)

AuthFilterCollectionsReadQuery filters a trials UpdateQuery to those the user is authorized to read.

func (*TrialAuthZBasic) AuthFilterCollectionsUpdateQuery

func (a *TrialAuthZBasic) AuthFilterCollectionsUpdateQuery(
	ctx context.Context,
	curUser *model.User,
	query *bun.UpdateQuery,
) (*bun.UpdateQuery, error)

AuthFilterCollectionsUpdateQuery filters a trials UpdateQuery to those the user is authorized to update.

func (*TrialAuthZBasic) AuthFilterTrialsQuery

func (a *TrialAuthZBasic) AuthFilterTrialsQuery(
	ctx context.Context, curUser *model.User, query *bun.SelectQuery, update bool,
) (*bun.SelectQuery, error)

AuthFilterTrialsQuery filters a trials SelectQuery to those the user is authorized for.

func (*TrialAuthZBasic) CanCreateTrialCollection

func (a *TrialAuthZBasic) CanCreateTrialCollection(
	ctx context.Context, curUser *model.User, projectID int32,
) (canCreateTrialCollection bool, serverError error)

CanCreateTrialCollection indicates whether a user can create a collection in a project.

type TrialsAPIServer

type TrialsAPIServer struct{}

TrialsAPIServer is an embedded api server struct.

func (*TrialsAPIServer) CreateTrialsCollection

CreateTrialsCollection creates a collection based on the provided name, filters, project, and sorter.

func (*TrialsAPIServer) DeleteTrialsCollection

DeleteTrialsCollection deletes the specified collection.

func (*TrialsAPIServer) GetTrialsCollections

GetTrialsCollections returns the list of collections for the (optionally) specified project.

func (*TrialsAPIServer) PatchTrialsCollection

PatchTrialsCollection patches a collection based on the (optionally) provided name, filters, and sorter.

func (*TrialsAPIServer) QueryTrials

QueryTrials returns a list of AugmentedTrials filtered according to the filters provided.

func (*TrialsAPIServer) UpdateTrialTags

UpdateTrialTags patches a target set of trials, specified either by a list of trial ids, or a set of filters, according to the provided patch.

type TrialsAugmented

type TrialsAugmented struct {
	bun.BaseModel         `bun:"table:trials_augmented_view,alias:trials_augmented_view"`
	TrialID               int32              `bun:"trial_id"`
	State                 string             `bun:"state"`
	Hparams               model.JSONObj      `bun:"hparams"`
	TrainingMetrics       map[string]float64 `bun:"training_metrics,json_use_number"`
	ValidationMetrics     map[string]float64 `bun:"validation_metrics,json_use_number"`
	Tags                  map[string]string  `bun:"tags"`
	StartTime             time.Time          `bun:"start_time"`
	EndTime               time.Time          `bun:"end_time"`
	SearcherType          string             `bun:"searcher_type"`
	ExperimentID          int32              `bun:"experiment_id"`
	ExperimentName        string             `bun:"experiment_name"`
	ExperimentDescription string             `bun:"experiment_description"`
	ExperimentLabels      []string           `bun:"experiment_labels"`
	UserID                int32              `bun:"user_id"`
	ProjectID             int32              `bun:"project_id"`
	WorkspaceID           int32              `bun:"workspace_id"`
	TotalBatches          int32              `bun:"total_batches"`
	SearcherMetric        string             `bun:"searcher_metric"`
	SearcherMetricValue   float64            `bun:"searcher_metric_value"`
	SearcherMetricLoss    float64            `bun:"searcher_metric_loss"`

	RankWithinExp int32 `bun:"rank,scanonly"`
}

TrialsAugmented shows provides information about a Trial.

func (*TrialsAugmented) Proto

func (t *TrialsAugmented) Proto() *apiv1.AugmentedTrial

Proto converts an Augmented Trial to its protobuf representation.

type TrialsCollection

type TrialsCollection struct {
	ID        int32               `bun:"id,pk,autoincrement"`
	UserID    int32               `bun:"user_id"`
	ProjectID int32               `bun:"project_id"`
	Name      string              `bun:"name"`
	Filters   *apiv1.TrialFilters `bun:"filters,type:jsonb"`
	Sorter    *apiv1.TrialSorter  `bun:"sorter,type:jsonb"`
}

TrialsCollection is a collection of Trials matching a set of TrialFilters.

func (*TrialsCollection) Proto

Proto converts TrialsCollection to proto representation.

Jump to

Keyboard shortcuts

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