graph

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2023 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Getenv

func Getenv(key, def string) string

Getenv retrieves the value of the environment variable named by the key. Return def if not set

func LoadGraph

func LoadGraph(ctx context.Context, graphName string, opts ...Option) (*ProcessingGraph, GraphConfig, GraphEnvs, error)

LoadGraph returns the graph from its name and its default configuration

func LoadGraphFromFile

func LoadGraphFromFile(ctx context.Context, graphFile string, opts ...Option) (*ProcessingGraph, GraphConfig, GraphEnvs, error)

LoadGraphFromFile returns the graph from a filename

func WithDockerManager added in v1.0.0

func WithDockerManager(dockerManager DockerManager) interface {
	Option
}

func WithSnap added in v1.0.0

func WithSnap() interface {
	Option
}

Types

type Arg

type Arg interface{}

type ArgConfig

type ArgConfig string // arg from config

type ArgFixed

type ArgFixed string // fixed arg

type ArgIn

type ArgIn struct {
	Input     int               `json:"tile_index"` // Index of input [0, 1, 2]
	Layer     service.Layer     `json:"layer"`
	Extension service.Extension `json:"extension"`
}

type ArgJSON

type ArgJSON struct {
	Arg
}

func (*ArgJSON) UnmarshalJSON

func (a *ArgJSON) UnmarshalJSON(data []byte) error

type ArgOut

type ArgOut struct {
	service.Layer `json:"layer"`
	Extension     service.Extension `json:"extension"`
}

type ArgTile

type ArgTile string // arg from tile info

type CmdLogFilter added in v1.0.0

type CmdLogFilter struct {
	// contains filtered or unexported fields
}

CmdLogFilter formats log from other commands

func (*CmdLogFilter) Filter added in v1.0.0

func (f *CmdLogFilter) Filter(msg string, defaultLevel zapcore.Level) (string, zapcore.Level, bool)

Filter implement log.Filter

func (*CmdLogFilter) WrapError added in v1.0.0

func (f *CmdLogFilter) WrapError(err error) error

WrapError implements LogFilter

type DType

type DType int32

DType of an output file

const (
	Undefined DType = iota
	UInt8
	UInt16
	UInt32
	Int16
	Int32
	Float32
	Float64
	Complex64
)

DType of an output file

func DTypeFromString

func DTypeFromString(dtype string) DType

func (*DType) UnmarshalJSON

func (dtype *DType) UnmarshalJSON(data []byte) error

type DockerConfig added in v1.0.0

type DockerConfig struct {
	Envs             []string
	RegistryServer   string // "https://eu.gcr.io" for gcs
	RegistryUserName string // _json_key for gcs
	RegistryPassword string // service account for gcs
	VolumesToMount   string // List of volumes to mount (comma separated)
}

func (*DockerConfig) SetFlags added in v1.0.0

func (cfg *DockerConfig) SetFlags() *string

SetFlags configures flag for a docker config Returns dockerEnvs as string, comma sep.

cfg := DockerConfig{} dockerEnvsStr := cfg.Flags()

flag.Parse()

if *dockerEnvsStr != "" {
		cfg.Envs = strings.Split(*dockerEnvsStr, ",")
	}

type DockerLogFilter added in v1.0.0

type DockerLogFilter struct {
	// contains filtered or unexported fields
}

DockerLogFilter formats log from docker Engine

func (*DockerLogFilter) Filter added in v1.0.0

func (f *DockerLogFilter) Filter(msg string, defaultLevel zapcore.Level) (string, zapcore.Level, bool)

func (*DockerLogFilter) WrapError added in v1.0.0

func (f *DockerLogFilter) WrapError(err error) error

type DockerManager added in v1.0.0

type DockerManager interface {
	Process(ctx context.Context, cmd, workdir string, args []string, envs []string) error
}

func NewDockerManager added in v1.0.0

func NewDockerManager(ctx context.Context, config DockerConfig) (DockerManager, error)

type File

type File struct {
	Layer     service.Layer     `json:"layer"`
	Extension service.Extension `json:"extension"`
}

File is a layer with an extension

type GraphConfig

type GraphConfig map[string]string

GraphConfig is a configuration map for a processing graph

func PhrDefaultConfig added in v1.0.0

func PhrDefaultConfig() GraphConfig

func S1DefaultConfig

func S1DefaultConfig() GraphConfig

S1DefaultConfig returns a basic configuration

func SpotDefaultConfig added in v1.0.0

func SpotDefaultConfig() GraphConfig

type GraphEnvs added in v1.0.0

type GraphEnvs []string

GraphEnvs is a configuration map for a processing graph

type InFile

type InFile struct {
	File
	Condition TileCondition `json:"condition"`
}

InFile describes an input file of the processing

func (*InFile) UnmarshalJSON

func (i *InFile) UnmarshalJSON(data []byte) error

type LogFilter

type LogFilter interface {
	log.Filter
	// WrapError wraps the error with additionnal information from the logs
	WrapError(err error) error
}

type Option added in v1.0.0

type Option interface {
	// contains filtered or unexported methods
}

type OutFile

type OutFile struct {
	File

	DType     DType         `json:"datatype"`
	NoData    float64       `json:"nodata"`
	Min       float64       `json:"min_value"`
	Max       float64       `json:"max_value"`
	ExtMin    float64       `json:"ext_min_value"`
	ExtMax    float64       `json:"ext_max_value"`
	Exponent  float64       `json:"exponent"` // JSON default: 1
	Nbands    int           `json:"nbands"`   // JSON default: 1
	Action    OutFileAction `json:"action"`
	Condition TileCondition `json:"condition"` // JSON default: pass
	// contains filtered or unexported fields
}

OutFile describes an output file of the processing

func (*OutFile) UnmarshalJSON

func (of *OutFile) UnmarshalJSON(data []byte) error

type OutFileAction

type OutFileAction int32

OutFileAction

const (
	ToIgnore OutFileAction = iota
	ToCreate
	ToIndex
	ToDelete
)

OutFileAction

func (*OutFileAction) UnmarshalJSON

func (a *OutFileAction) UnmarshalJSON(data []byte) error

type ProcessingGraph

type ProcessingGraph struct {
	InFiles [3][]InFile
	// contains filtered or unexported fields
}

ProcessingGraph is a set of steps

func (*ProcessingGraph) Process

func (g *ProcessingGraph) Process(ctx context.Context, config GraphConfig, graphEnvs GraphEnvs, tiles []common.Tile) ([][]OutFile, error)

Process runs the graph Returns the files to create or to delete

func (*ProcessingGraph) Summary

func (g *ProcessingGraph) Summary() string

type ProcessingGraphJSON

type ProcessingGraphJSON struct {
	Config   map[string]string `json:"config"`
	Envs     []string          `json:"envs,omitempty"`
	Steps    []ProcessingStep  `json:"processing_steps"`
	InFiles  [3][]InFile       `json:"in_files"`
	OutFiles [][]OutFile       `json:"out_files"`
}

type ProcessingStep

type ProcessingStep struct {
	Engine    string // Python or Snap
	Command   string
	Args      map[string]Arg
	Condition TileCondition
}

func (*ProcessingStep) UnmarshalJSON

func (a *ProcessingStep) UnmarshalJSON(data []byte) error

type PythonLogFilter

type PythonLogFilter struct {
	// contains filtered or unexported fields
}

PythonLogFilter formats log from python

func (*PythonLogFilter) Filter

func (f *PythonLogFilter) Filter(msg string, defaultLevel zapcore.Level) (string, zapcore.Level, bool)

Filter implement log.Filter

func (*PythonLogFilter) WrapError

func (f *PythonLogFilter) WrapError(err error) error

WrapError implements LogFilter

type SNAPLogFilter

type SNAPLogFilter struct {
	// contains filtered or unexported fields
}

SNAPLogFilter formats log from ESA/SNAP

func (*SNAPLogFilter) Filter

func (f *SNAPLogFilter) Filter(msg string, defaultLevel zapcore.Level) (string, zapcore.Level, bool)

Filter implement log.Filter

func (*SNAPLogFilter) WrapError

func (f *SNAPLogFilter) WrapError(err error) error

WrapError implements LogFilter

type TileCondition

type TileCondition struct {
	Name string
	Pass func([]common.Tile, *File) bool
}

TileCondition is a condition on tiles to do an action (execute a step, create a file...)

func (*TileCondition) UnmarshalJSON

func (t *TileCondition) UnmarshalJSON(data []byte) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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