flytekit.core.utils
0.1.dev2184+g1e0cbe7.d20250401
flytekit.core.utils
Directory
Classes
Class
Description
AutoDeletingTempDir
Creates a posix safe tempdir which is auto deleted once out of scope.
ClassDecorator
Abstract class for class decorators.
Directory
timeit
A context manager and a decorator that measures the execution time of the wrapped code block or functions.
Methods
Variables
Property
Type
Description
TYPE_CHECKING
bool
Methods
has_return_statement()
def has_return_statement (
func: typing. Callable,
) -> bool
Parameter
Type
func
typing.Callable
load_proto_from_file()
def load_proto_from_file (
pb2_type,
path,
)
Parameter
Type
pb2_type
path
str2bool()
def str2bool (
value: typing. Optional[str],
) -> n: the boolean value
Convert a string to a boolean. This is useful for parsing environment variables.
Parameter
Type
value
typing.Optional[str]
write_proto_to_file()
def write_proto_to_file (
proto,
path,
)
Parameter
Type
proto
path
flytekit.core.utils.AutoDeletingTempDir
Creates a posix safe tempdir which is auto deleted once out of scope
class AutoDeletingTempDir (
working_dir_prefix,
tmp_dir,
cleanup,
)
Parameter
Type
working_dir_prefix
tmp_dir
cleanup
Methods
force_cleanup()
get_named_tempfile()
def get_named_tempfile (
name,
)
list_dir()
The list of absolute filepaths for all immediate sub-paths
:rtype: list[Text]
Properties
Property
Type
Description
name
:rtype: Text
flytekit.core.utils.ClassDecorator
Abstract class for class decorators.
We can attach config on the decorator class and use it in the upper level.
class ClassDecorator (
task_function,
kwargs,
)
If the decorator is called with arguments, func will be None.
If the decorator is called without arguments, func will be function to be decorated.
Parameter
Type
task_function
kwargs
**kwargs
Methods
Method
Description
execute()
This method will be called when the decorated function is called.
get_extra_config()
Get the config of the decorator.
execute()
def execute (
args,
kwargs,
)
This method will be called when the decorated function is called.
Parameter
Type
args
*args
kwargs
**kwargs
Get the config of the decorator.
flytekit.core.utils.Directory
Methods
Method
Description
list_dir()
The list of absolute filepaths for all immediate sub-paths.
list_dir()
The list of absolute filepaths for all immediate sub-paths
:rtype: list[Text]
Properties
Property
Type
Description
name
:rtype: Text
flytekit.core.utils.timeit
A context manager and a decorator that measures the execution time of the wrapped code block or functions.
It will append a timing information to TimeLineDeck. For instance:
@timeit(“Function description”)
def function()
with timeit(“Wrapped code block description”):
# your code
class timeit (
name: str,
)