1.16.10

flytekit.configuration.file

Directory

Classes

Class Description
ConfigEntry A top level Config entry holder, that holds multiple different representations of the config.
ConfigFile
LegacyConfigEntry Creates a record for the config entry.
YamlConfigEntry Creates a record for the config entry.

Methods

Method Description
bool_transformer()
comma_list_transformer()
int_transformer()
read_file_if_exists() Reads the contents of the file if passed a path.
set_if_exists() Given a dict d sets the key k with value of config v, if the config value v is set.

Variables

Property Type Description
FLYTECTL_CONFIG_ENV_VAR str
FLYTECTL_CONFIG_ENV_VAR_OVERRIDE str

Methods

bool_transformer()

def bool_transformer(
    config_val: typing.Any,
) -> bool
Parameter Type Description
config_val typing.Any

comma_list_transformer()

def comma_list_transformer(
    config_val: typing.Any,
)
Parameter Type Description
config_val typing.Any

int_transformer()

def int_transformer(
    config_val: typing.Any,
)
Parameter Type Description
config_val typing.Any

read_file_if_exists()

def read_file_if_exists(
    filename: typing.Optional[str],
    encoding,
) -> typing.Optional[str]

Reads the contents of the file if passed a path. Otherwise, returns None.

Parameter Type Description
filename typing.Optional[str] The file path to load
encoding The encoding to use when reading the file. :return: The contents of the file as a string or None.

set_if_exists()

def set_if_exists(
    d: dict,
    k: str,
    v: typing.Any,
) -> dict

Given a dict d sets the key k with value of config v, if the config value v is set and return the updated dictionary.

The input dictionary d will be mutated.

Parameter Type Description
d dict
k str
v typing.Any

flytekit.configuration.file.ConfigEntry

A top level Config entry holder, that holds multiple different representations of the config. Legacy means the INI style config files. YAML support is for the flytectl config file, which is there by default when flytectl starts a sandbox

class ConfigEntry(
    legacy: LegacyConfigEntry,
    yaml_entry: typing.Optional[YamlConfigEntry],
    transform: typing.Optional[typing.Callable[[str], typing.Any]],
)
Parameter Type Description
legacy LegacyConfigEntry
yaml_entry typing.Optional[YamlConfigEntry]
transform typing.Optional[typing.Callable[[str], typing.Any]]

Methods

Method Description
read() Reads the config Entry from the various sources in the following order,.

read()

def read(
    cfg: typing.Optional[ConfigFile],
) -> typing.Optional[typing.Any]

Reads the config Entry from the various sources in the following order, #. First try to read from the relevant environment variable, #. If missing, then try to read from the legacy config file, if one was parsed. #. If missing, then try to read from the yaml file.

The constructor for ConfigFile currently does not allow specification of both the ini and yaml style formats.

Parameter Type Description
cfg typing.Optional[ConfigFile] :return:

flytekit.configuration.file.ConfigFile

class ConfigFile(
    location: str,
)

Load the config from this location

Parameter Type Description
location str

Methods

Method Description
get()

get()

def get(
    c: typing.Union[LegacyConfigEntry, YamlConfigEntry],
) -> typing.Any
Parameter Type Description
c typing.Union[LegacyConfigEntry, YamlConfigEntry]

Properties

Property Type Description
legacy_config
yaml_config

flytekit.configuration.file.LegacyConfigEntry

Creates a record for the config entry. contains

class LegacyConfigEntry(
    section: str,
    option: str,
    type_: typing.Type,
)
Parameter Type Description
section str
option str
type_ typing.Type

Methods

Method Description
get_env_name()
read_from_env() Reads the config entry from environment variable, the structure of the env var is current.
read_from_file()

get_env_name()

def get_env_name()

read_from_env()

def read_from_env(
    transform: typing.Optional[typing.Callable],
) -> typing.Optional[typing.Any]

Reads the config entry from environment variable, the structure of the env var is current FLYTE_{SECTION}_{OPTION} all upper cased. We will change this in the future. :return:

Parameter Type Description
transform typing.Optional[typing.Callable]

read_from_file()

def read_from_file(
    cfg: ConfigFile,
    transform: typing.Optional[typing.Callable],
) -> typing.Optional[typing.Any]
Parameter Type Description
cfg ConfigFile
transform typing.Optional[typing.Callable]

flytekit.configuration.file.YamlConfigEntry

Creates a record for the config entry.

class YamlConfigEntry(
    switch: str,
    config_value_type: typing.Type,
)
Parameter Type Description
switch str
config_value_type typing.Type

Methods

Method Description
read_from_file()

read_from_file()

def read_from_file(
    cfg: ConfigFile,
    transform: typing.Optional[typing.Callable],
) -> typing.Optional[typing.Any]
Parameter Type Description
cfg ConfigFile
transform typing.Optional[typing.Callable]