1.16.26

flytekit.interactive.utils

Directory

Methods

Method Description
execute_command() Execute a command in the shell.
get_task_inputs() Read task input data from inputs.
load_module_from_path() Imports a Python module from a specified file path.

Variables

Property Type Description
EXIT_CODE_SUCCESS int

Methods

execute_command()

def execute_command(
    cmd: str,
    env: typing.Optional[typing.Dict[str, str]],
)

Execute a command in the shell.

Parameter Type Description
cmd str The command to execute.
env typing.Optional[typing.Dict[str, str]] Environment variables to set for the subprocess. These are merged on top of the current process environment, so callers can override specific variables (e.g. PORT) without dropping the rest of the inherited environment.

Raises

Exception Description
RuntimeError If the command exits with a non-zero return code.

get_task_inputs()

def get_task_inputs(
    task_module_name,
    task_name,
    context_working_dir,
)

Read task input data from inputs.pb for a specific task function and convert it into Python types and structures.

Parameter Type Description
task_module_name The name of the Python module containing the task function.
task_name The name of the task function within the module.
context_working_dir The directory path where the input file and module file are located.

Returns: dict: A dictionary containing the task inputs, converted into Python types and structures.

load_module_from_path()

def load_module_from_path(
    module_name,
    path,
)

Imports a Python module from a specified file path.

Parameter Type Description
module_name The name you want to assign to the imported module.
path The file system path to the Python file (.py) that contains the module you want to import.

Returns

module: The imported module.

Raises

Exception Description
ImportError If the module cannot be loaded from the provided path, an ImportError is raised.