Skip to main content

Flytekit OmegaConf Plugin

Flytekit python natively supports serialization of many data types for exchanging information between tasks. The Flytekit OmegaConf Plugin extends these by the DictConfig type from the OmegaConf package as well as related types that are being used by the hydra package for configuration management.

Task example

from dataclasses import dataclass
import flytekitplugins.omegaconf  # noqa F401
from flytekit import task, workflow
from omegaconf import DictConfig

@dataclass
class MySimpleConf:
    _target_: str = "lightning_module.MyEncoderModule"
    learning_rate: float = 0.0001

@task
def my_task(cfg: DictConfig) -> None:
    print(f"Doing things with {cfg.learning_rate=}")


@workflow
def pipeline(cfg: DictConfig) -> None:
    my_task(cfg=cfg)


if __name__ == "__main__":
    from omegaconf import OmegaConf

    cfg = OmegaConf.structured(MySimpleConf)
    pipeline(cfg=cfg)

Transformer configuration

The transformer can be set to one of three modes:

Dataclass - This mode should be used with a StructuredConfig and will reconstruct the config from the matching dataclass during deserialisation in order to make typing information from the dataclass and continued validation thereof available. This requires the dataclass definition to be available via python import in the Flyte execution environment in which objects are (de-)serialised.

DictConfig - This mode will deserialize the config into a DictConfig object. In particular, dataclasses are translated into DictConfig objects and only primitive types are being checked. The definition of underlying dataclasses for structured configs is only required during the initial serialization for this mode.

Auto - This mode will try to deserialize according to the Dataclass mode and fall back to the DictConfig mode if the dataclass definition is not available. This is the default mode.

You can set the transformer mode globally or for the current context only the following ways:

from flytekitplugins.omegaconf import set_transformer_mode, set_local_transformer_mode, OmegaConfTransformerMode

# Set the global transformer mode using the new function
set_transformer_mode(OmegaConfTransformerMode.DictConfig)

# You can also the mode for the current context only
with set_local_transformer_mode(OmegaConfTransformerMode.Dataclass):
    # This will use the Dataclass mode
    pass
Since the DictConfig is flattened and keys transformed into dot notation, the keys of the DictConfig must not contain
dots.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

flytekitplugins_omegaconf-1.16.26.tar.gz (12.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

flytekitplugins_omegaconf-1.16.26-py3-none-any.whl (10.7 kB view details)

Uploaded Python 3

File details

Details for the file flytekitplugins_omegaconf-1.16.26.tar.gz.

File metadata

File hashes

Hashes for flytekitplugins_omegaconf-1.16.26.tar.gz
Algorithm Hash digest
SHA256 99ac6d822a977337b2035baa0d7077a301147b99b0b33e4db689de54002e2719
MD5 19dda21c1c8391da1ac161f2d551d783
BLAKE2b-256 5a162b84bf07f2ad24a8d8c3a3e6c72c91a521b94899d036ea5234b576c88f5a

See more details on using hashes here.

File details

Details for the file flytekitplugins_omegaconf-1.16.26-py3-none-any.whl.

File metadata

File hashes

Hashes for flytekitplugins_omegaconf-1.16.26-py3-none-any.whl
Algorithm Hash digest
SHA256 80e557cc049c94cfabbb1a97360e914748a8c759401939dbe13b3c4c50b5b1cb
MD5 c8340ce3824e9ad498d2c1b93b8bb215
BLAKE2b-256 2ee144dfa047a2a1419ce8c8edb986ee911737559ca678dff472c8c6a3bccad4

See more details on using hashes here.

Release history Release notifications | RSS feed

1.16.28

2 files

1.16.27

2 files

This release

1.16.26 This release

2 files

1.16.25

2 files

1.16.24

2 files

1.16.23

2 files

1.16.22

2 files

1.16.21

2 files

1.16.20

2 files

1.16.19

2 files

1.16.16

2 files

1.16.15

2 files

1.16.14

2 files

1.16.13

2 files

1.16.12

2 files

1.16.11

2 files

1.16.10

2 files

1.16.9

2 files

1.16.8

2 files

1.16.7

2 files

1.16.6

2 files

1.16.5

2 files

1.16.4

2 files

1.16.3

2 files

1.16.2

2 files

1.16.1

2 files

1.16.0

2 files

1.15.4

2 files

1.15.3

2 files

1.15.2

2 files

1.15.1

2 files

1.15.0

2 files

1.14.9

2 files

1.14.8

2 files

1.14.7

2 files

1.14.6

2 files

1.14.5

2 files

1.14.4

2 files

1.14.3

2 files

1.14.2

2 files

1.14.1

2 files

1.14.0

2 files

1.13.15

2 files

1.13.14

2 files

1.13.13

2 files

1.13.12

2 files

1.13.11

2 files

1.13.10

1 file

1.13.9

2 files

1.13.8

2 files

1.13.7

2 files

1.13.6

2 files

1.13.5

2 files

1.13.4

2 files

1.13.3

2 files

1.13.2

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page