Documentation ¶
Overview ¶
Package metadata contains types to record/retrieve metadata stored in MLMD for individual pipeline steps.
Package metadata contains types to record/retrieve metadata stored in MLMD for individual pipeline steps.
Index ¶
- Constants
- func PbValueToText(v *structpb.Value) (string, error)
- func SchemaToArtifactType(schema string) (*pb.ArtifactType, error)
- func StructValueToMLMDValue(v *structpb.Value) (*pb.Value, error)
- func TextToPbValue(text string, t pipelinespec.ParameterType_ParameterTypeEnum) (*structpb.Value, error)
- func UnmarshalRuntimeArtifact(bytes []byte) (*pipelinespec.RuntimeArtifact, error)
- type Client
- func (c *Client) CreateExecution(ctx context.Context, pipeline *Pipeline, config *ExecutionConfig) (*Execution, error)
- func (c *Client) FindMatchedArtifact(ctx context.Context, artifactToMatch *pb.Artifact, pipelineContextId int64) (matchedArtifact *pb.Artifact, err error)
- func (c *Client) GetArtifactName(ctx context.Context, artifactId int64) (string, error)
- func (c *Client) GetArtifacts(ctx context.Context, ids []int64) ([]*pb.Artifact, error)
- func (c *Client) GetDAG(ctx context.Context, executionID int64) (*DAG, error)
- func (c *Client) GetEventsByArtifactIDs(ctx context.Context, artifactIds []int64) ([]*pb.Event, error)
- func (c *Client) GetExecution(ctx context.Context, id int64) (*Execution, error)
- func (c *Client) GetExecutions(ctx context.Context, ids []int64) ([]*pb.Execution, error)
- func (c *Client) GetExecutionsInDAG(ctx context.Context, dag *DAG, pipeline *Pipeline) (executionsMap map[string]*Execution, err error)
- func (c *Client) GetInputArtifactsByExecutionID(ctx context.Context, executionID int64) (inputs map[string]*pipelinespec.ArtifactList, err error)
- func (c *Client) GetOrInsertArtifactType(ctx context.Context, schema string) (typeID int64, err error)
- func (c *Client) GetOutputArtifactsByExecutionId(ctx context.Context, executionId int64) (map[string]*OutputArtifact, error)
- func (c *Client) GetPipeline(ctx context.Context, ...) (*Pipeline, error)
- func (c *Client) GetPipelineFromExecution(ctx context.Context, id int64) (*Pipeline, error)
- func (c *Client) PrePublishExecution(ctx context.Context, execution *Execution, config *ExecutionConfig) (*Execution, error)
- func (c *Client) PublishExecution(ctx context.Context, execution *Execution, ...) error
- func (c *Client) RecordArtifact(ctx context.Context, outputName, schema string, ...) (*OutputArtifact, error)
- type DAG
- type Execution
- func (e *Execution) FingerPrint() string
- func (e *Execution) GetExecution() *pb.Execution
- func (e *Execution) GetID() int64
- func (e *Execution) GetParameters() (inputs, outputs map[string]*structpb.Value, err error)
- func (e *Execution) GetPipeline() *Pipeline
- func (e *Execution) String() string
- func (e *Execution) TaskName() string
- type ExecutionConfig
- type ExecutionType
- type InputArtifact
- type OutputArtifact
- type Pipeline
- type ServerConfig
Constants ¶
const (
ImporterExecutionTypeName = "system.ImporterExecution"
)
Variables ¶
This section is empty.
Functions ¶
func SchemaToArtifactType ¶
func SchemaToArtifactType(schema string) (*pb.ArtifactType, error)
func TextToPbValue ¶
func TextToPbValue(text string, t pipelinespec.ParameterType_ParameterTypeEnum) (*structpb.Value, error)
func UnmarshalRuntimeArtifact ¶
func UnmarshalRuntimeArtifact(bytes []byte) (*pipelinespec.RuntimeArtifact, error)
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is an MLMD service client.
func (*Client) CreateExecution ¶
func (c *Client) CreateExecution(ctx context.Context, pipeline *Pipeline, config *ExecutionConfig) (*Execution, error)
CreateExecution creates a new MLMD execution under the specified Pipeline.
func (*Client) FindMatchedArtifact ¶
func (*Client) GetArtifactName ¶
func (*Client) GetArtifacts ¶
GetArtifacts ...
func (*Client) GetEventsByArtifactIDs ¶
func (c *Client) GetEventsByArtifactIDs(ctx context.Context, artifactIds []int64) ([]*pb.Event, error)
GetEventsByArtifactIDs ...
func (*Client) GetExecution ¶
func (*Client) GetExecutions ¶
GetExecutions ...
func (*Client) GetExecutionsInDAG ¶
func (c *Client) GetExecutionsInDAG(ctx context.Context, dag *DAG, pipeline *Pipeline) (executionsMap map[string]*Execution, err error)
GetExecutionsInDAG gets all executions in the DAG, and organize them into a map, keyed by task name.
func (*Client) GetInputArtifactsByExecutionID ¶
func (c *Client) GetInputArtifactsByExecutionID(ctx context.Context, executionID int64) (inputs map[string]*pipelinespec.ArtifactList, err error)
func (*Client) GetOrInsertArtifactType ¶
func (c *Client) GetOrInsertArtifactType(ctx context.Context, schema string) (typeID int64, err error)
TODO consider batching these requests
func (*Client) GetOutputArtifactsByExecutionId ¶
func (c *Client) GetOutputArtifactsByExecutionId(ctx context.Context, executionId int64) (map[string]*OutputArtifact, error)
GetOutputArtifactsByExecutionId ... TODO: Support multiple artifacts someday, probably through the v2 engine.
func (*Client) GetPipeline ¶
func (c *Client) GetPipeline(ctx context.Context, pipelineName, runID, namespace, runResource, pipelineRoot string) (*Pipeline, error)
GetPipeline returns the current pipeline represented by the specified pipeline name and run ID.
func (*Client) GetPipelineFromExecution ¶
func (*Client) PrePublishExecution ¶
func (c *Client) PrePublishExecution(ctx context.Context, execution *Execution, config *ExecutionConfig) (*Execution, error)
PrePublishExecution updates an existing MLMD execution with Pod info.
func (*Client) PublishExecution ¶
func (c *Client) PublishExecution(ctx context.Context, execution *Execution, outputParameters map[string]*structpb.Value, outputArtifacts []*OutputArtifact, state pb.Execution_State) error
PublishExecution publishes the specified execution with the given output parameters, artifacts and state.
func (*Client) RecordArtifact ¶
func (c *Client) RecordArtifact(ctx context.Context, outputName, schema string, runtimeArtifact *pipelinespec.RuntimeArtifact, state pb.Artifact_State) (*OutputArtifact, error)
RecordArtifact ...
type Execution ¶
type Execution struct {
// contains filtered or unexported fields
}
Execution is a handle for the current execution.
func NewExecution ¶
A hacky way to get Execution from pb.Execution, usually you should get an Execution from this metadata package directly without using ml_metadata.Execution
func (*Execution) FingerPrint ¶
func (*Execution) GetExecution ¶
func (*Execution) GetParameters ¶
func (*Execution) GetPipeline ¶
type ExecutionConfig ¶
type ExecutionConfig struct { TaskName string Name string // optional, MLMD execution name. When provided, this needs to be unique among all MLMD executions. ExecutionType ExecutionType NotTriggered bool // optional, not triggered executions will have CANCELED state. ParentDagID int64 // parent DAG execution ID. Only the root DAG does not have a parent DAG. InputParameters map[string]*structpb.Value InputArtifactIDs map[string][]int64 IterationIndex *int // Index of the iteration. // ContainerExecution custom properties Image, CachedMLMDExecutionID, FingerPrint string PodName, PodUID, Namespace string // DAGExecution custom properties IterationCount *int // Number of iterations for an iterator DAG. }
ExecutionConfig represents the input parameters and artifacts to an Execution.
func GenerateExecutionConfig ¶
func GenerateExecutionConfig(executorInput *pipelinespec.ExecutorInput) (*ExecutionConfig, error)
type ExecutionType ¶
type ExecutionType string
const ( ContainerExecutionTypeName ExecutionType = "system.ContainerExecution" DagExecutionTypeName ExecutionType = "system.DAGExecution" )
type InputArtifact ¶
InputArtifact is a wrapper around an MLMD artifact used as component inputs.
type OutputArtifact ¶
OutputArtifact represents a schema and an MLMD artifact for output artifacts produced by a component.
func (*OutputArtifact) Marshal ¶
func (oa *OutputArtifact) Marshal() ([]byte, error)
func (*OutputArtifact) ToRuntimeArtifact ¶
func (oa *OutputArtifact) ToRuntimeArtifact() (*pipelinespec.RuntimeArtifact, error)
type Pipeline ¶
type Pipeline struct {
// contains filtered or unexported fields
}
Pipeline is a handle for the current pipeline.
func (*Pipeline) GetPipelineRoot ¶
func (*Pipeline) GetRunCtxID ¶
type ServerConfig ¶
func DefaultConfig ¶
func DefaultConfig() *ServerConfig