py_calc

package
v1.1.18 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2024 License: MIT Imports: 18 Imported by: 0

Documentation

Overview

Package py_calc contains definition of the custom processor py_calc

Index

Constants

View Source
const FORMULA_MARKER_CALCULATIONS = "--FMCALC"
View Source
const FORMULA_MARKER_DATA_POINTS_INITIALIZATION = "--FMINIT"
View Source
const FORMULA_MARKER_END = "--FMEND"
View Source
const FORMULA_MARKER_FUNCTION_DEFINITIONS = "--FMDEF"
View Source
const FORMULA_MARKER_SUCCESS = "--FMOK"
View Source
const ProcPrefix string = "p_"
View Source
const ProcessorPyCalcName string = "py_calc"
View Source
const PythonDatetimeFormat string = "2006-01-02T15:04:05.000-07:00"

Python supports microseconds in datetime. Unfortunately, Cassandra supports only milliseconds. Millis are our lingua franca. So, use only three digits after decimal point Python 8601 requires ":" in the timezone

View Source
const ReaderPrefix string = "r_"

Variables

This section is empty.

Functions

This section is empty.

Types

type PyCalcEnvSettings

type PyCalcEnvSettings struct {
	// Windows: `python` or `C:\Users\%USERNAME%\AppData\Local\Programs\Python\Python310\python.exe`
	// WSL: `python` or `/mnt/c/Users/myusername/AppData/Local/Programs/Python/Python310/python.exe`
	// Linux: `python`
	InterpreterPath string `json:"python_interpreter_path"`
	// Usually: ["-u", "-"]. -u is essential: without it, we will not see stdout/stderr in the timeout scenario
	InterpreterParams []string `json:"python_interpreter_params"`
	ExecutionTimeout  int      `json:"execution_timeout"` // Default 5000 milliseconds
}

type PyCalcProcessorDef

type PyCalcProcessorDef struct {
	PythonUrls                    []string                          `json:"python_code_urls"`
	CalculatedFields              map[string]*sc.WriteTableFieldDef `json:"calculated_fields"`
	UsedInTargetExpressionsFields sc.FieldRefs
	PythonCode                    string
	CalculationOrder              []string
	EnvSettings                   PyCalcEnvSettings
}

func (*PyCalcProcessorDef) Deserialize

func (procDef *PyCalcProcessorDef) Deserialize(raw json.RawMessage, customProcSettings json.RawMessage, caPath string, privateKeys map[string]string) error

func (*PyCalcProcessorDef) GetFieldRefs

func (procDef *PyCalcProcessorDef) GetFieldRefs() *sc.FieldRefs

func (*PyCalcProcessorDef) GetUsedInTargetExpressionsFields

func (procDef *PyCalcProcessorDef) GetUsedInTargetExpressionsFields() *sc.FieldRefs

func (*PyCalcProcessorDef) Run

func (procDef *PyCalcProcessorDef) Run(logger *l.CapiLogger, pCtx *ctx.MessageProcessingContext, rsIn *proc.Rowset, flushVarsArray func(varsArray []*eval.VarValuesMap, varsArrayCount int) error) error

Jump to

Keyboard shortcuts

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