template

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package template exports the Render method Render Evaluates templates in each command with the equivalent value from passed args. Templates are case-insensitive Supported templates are:

  • {{ .InputFile }} to receive the input file path. The protocol used will depend on the underlying system configuration. E.g. s3://bucket/key/to/file.pb or /var/run/local.pb are both valid.
  • {{ .OutputPrefix }} to receive the path prefix for where to store the outputs.
  • {{ .Inputs.myInput }} to receive the actual value of the input passed. See docs on LiteralMapToTemplateArgs for how what to expect each literal type to be serialized as.
  • {{ .RawOutputDataPrefix }} to receive a path where the raw output data should be ideally written. It is guaranteed to be unique per retry and finally one will be saved as the output path
  • {{ .PerRetryUniqueKey }} A key/id/str that is generated per retry and is guaranteed to be unique. Useful in query manipulations
  • {{ .TaskTemplatePath }} A path in blobstore/metadata store (e.g. s3, gcs etc) to where an offloaded version of the task template exists and can be accessed by the container / task execution environment. The template is a a serialized protobuf
  • {{ .PrevCheckpointPrefix }} A path to the checkpoint directory for the previous attempt. If this is the first attempt then this is replaced by an empty string
  • {{ .CheckpointOutputPrefix }} A Kozmo aware path where the current execution should write the checkpoints.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Render

func Render(ctx context.Context, inputTemplate []string, params Parameters) ([]string, error)

Render Evaluates templates in each command with the equivalent value from passed args. Templates are case-insensitive If a command isn't a valid template or failed to evaluate, it'll be returned as is. Refer to the package docs for a list of supported templates NOTE: I wanted to do in-place replacement, until I realized that in-place replacement will alter the definition of the graph. This is not desirable, as we may have to retry and in that case the replacement will not work and we want to create a new location for outputs

Types

type ErrorCollection

type ErrorCollection struct {
	Errors []error
}

func (ErrorCollection) Error

func (e ErrorCollection) Error() string

type Parameters

type Parameters struct {
	TaskExecMetadata core.TaskExecutionMetadata
	Inputs           io.InputReader
	OutputPath       io.OutputFilePaths
	Task             core.TaskTemplatePath
}

Parameters struct is used by the Templating Engine to replace the templated parameters

Jump to

Keyboard shortcuts

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