flytekit.clis.sdk_in_container.run
| Class |
Description |
DynamicEntityLaunchCommand |
This is a dynamic command that is created for each launch plan. |
Entities |
NamedTuple to group all entities in a file. |
RemoteEntityGroup |
click multicommand that retrieves launchplans from a remote flyte instance and executes them. |
RunCommand |
A click command group for registering and executing flyte workflows & tasks in a file. |
RunLevelComputedParams |
This class is used to store the computed parameters that are used to run a workflow / task / launchplan. |
RunLevelParams |
This class is used to store the parameters that are used to run a workflow / task / launchplan. |
WorkflowCommand |
click multicommand at the python file layer, subcommands should be all the workflows in the file. |
YamlFileReadingCommand |
|
def dump_flyte_remote_snippet(
execution: flytekit.remote.executions.FlyteWorkflowExecution,
project: str,
domain: str,
)
| Parameter |
Type |
Description |
execution |
flytekit.remote.executions.FlyteWorkflowExecution |
|
project |
str |
|
domain |
str |
|
def get_entities_in_file(
filename: pathlib.Path,
should_delete: bool,
) -> flytekit.clis.sdk_in_container.run.Entities
Returns a list of flyte workflow names and list of Flyte tasks in a file.
| Parameter |
Type |
Description |
filename |
pathlib.Path |
|
should_delete |
bool |
|
def is_optional(
_type,
)
Checks if the given type is Optional Type
| Parameter |
Type |
Description |
_type |
|
|
def load_naive_entity(
module_name: str,
entity_name: str,
project_root: str,
) -> typing.Union[flytekit.core.workflow.WorkflowBase, flytekit.core.base_task.PythonTask]
Load the workflow of a script file.
N.B.: it assumes that the file is self-contained, in other words, there are no relative imports.
| Parameter |
Type |
Description |
module_name |
str |
|
entity_name |
str |
|
project_root |
str |
|
def options_from_run_params(
run_level_params: flytekit.clis.sdk_in_container.run.RunLevelParams,
) -> flytekit.core.options.Options
| Parameter |
Type |
Description |
run_level_params |
flytekit.clis.sdk_in_container.run.RunLevelParams |
|
def run_command(
ctx: click.core.Context,
entity: typing.Union[flytekit.core.workflow.PythonFunctionWorkflow, flytekit.core.base_task.PythonTask, flytekit.core.launch_plan.LaunchPlan],
)
Returns a function that is used to implement WorkflowCommand and execute a flyte workflow.
| Parameter |
Type |
Description |
ctx |
click.core.Context |
|
entity |
typing.Union[flytekit.core.workflow.PythonFunctionWorkflow, flytekit.core.base_task.PythonTask, flytekit.core.launch_plan.LaunchPlan] |
|
def run_remote(
remote: flytekit.remote.remote.FlyteRemote,
entity: typing.Union[flytekit.remote.entities.FlyteWorkflow, flytekit.remote.entities.FlyteTask, flytekit.remote.entities.FlyteLaunchPlan],
project: str,
domain: str,
inputs: typing.Dict[str, typing.Any],
run_level_params: flytekit.clis.sdk_in_container.run.RunLevelParams,
type_hints: typing.Optional[typing.Dict[str, typing.Type]] = None,
)
Helper method that executes the given remote FlyteLaunchplan, FlyteWorkflow or FlyteTask
| Parameter |
Type |
Description |
remote |
flytekit.remote.remote.FlyteRemote |
|
entity |
typing.Union[flytekit.remote.entities.FlyteWorkflow, flytekit.remote.entities.FlyteTask, flytekit.remote.entities.FlyteLaunchPlan] |
|
project |
str |
|
domain |
str |
|
inputs |
typing.Dict[str, typing.Any] |
|
run_level_params |
flytekit.clis.sdk_in_container.run.RunLevelParams |
|
type_hints |
typing.Optional[typing.Dict[str, typing.Type]] |
|
def to_click_option(
ctx: click.core.Context,
flyte_ctx: flytekit.core.context_manager.FlyteContext,
input_name: str,
literal_var: flytekit.models.interface.Variable,
python_type: typing.Type,
default_val: typing.Any,
required: bool,
) -> click.core.Option
This handles converting workflow input types to supported click parameters with callbacks to initialize
the input values to their expected types.
| Parameter |
Type |
Description |
ctx |
click.core.Context |
|
flyte_ctx |
flytekit.core.context_manager.FlyteContext |
|
input_name |
str |
|
literal_var |
flytekit.models.interface.Variable |
|
python_type |
typing.Type |
|
default_val |
typing.Any |
|
required |
bool |
|
This is a dynamic command that is created for each launch plan. This is used to execute a launch plan.
It will fetch the launch plan from remote and create parameters from all the inputs of the launch plan.
class DynamicEntityLaunchCommand(
name: str,
h: str,
entity_name: str,
launcher: str,
**kwargs,
)
Create Rich Command instance.
| Parameter |
Type |
Description |
name |
str |
|
h |
str |
|
entity_name |
str |
|
launcher |
str |
|
**kwargs |
|
|
def get_params(
ctx: click.core.Context,
) -> typing.List[ForwardRef('click.Parameter')]
| Parameter |
Type |
Description |
ctx |
click.core.Context |
|
def invoke(
ctx: click.core.Context,
) -> typing.Any
Default or None values should be ignored. Only values that are provided by the user should be passed to the
remote execution.
| Parameter |
Type |
Description |
ctx |
click.core.Context |
|
NamedTuple to group all entities in a file
| Method |
Description |
all() |
|
matching_lp() |
Returns the variable name of the launch plan in the file. |
def matching_lp(
lp_name: str,
) -> typing.Optional[str]
Returns the variable name of the launch plan in the file
| Parameter |
Type |
Description |
lp_name |
str |
|
click multicommand that retrieves launchplans from a remote flyte instance and executes them.
class RemoteEntityGroup(
command_name: str,
)
Create RichGroup instance.
| Parameter |
Type |
Description |
command_name |
str |
|
| Method |
Description |
get_command() |
Given a context and a command name, this returns a. |
list_commands() |
Returns a list of subcommand names in the order they should. |
def get_command(
ctx,
name,
)
Given a context and a command name, this returns a
Command object if it exists or returns None.
| Parameter |
Type |
Description |
ctx |
|
|
name |
|
|
def list_commands(
ctx,
)
Returns a list of subcommand names in the order they should
appear.
| Parameter |
Type |
Description |
ctx |
|
|
A click command group for registering and executing flyte workflows & tasks in a file.
class RunCommand(
*args,
**kwargs,
)
Create RichGroup instance.
| Parameter |
Type |
Description |
*args |
|
|
**kwargs |
|
|
| Method |
Description |
get_command() |
Given a context and a command name, this returns a. |
list_commands() |
Returns a list of subcommand names in the order they should. |
def get_command(
ctx,
filename,
)
Given a context and a command name, this returns a
Command object if it exists or returns None.
| Parameter |
Type |
Description |
ctx |
|
|
filename |
|
|
def list_commands(
ctx,
add_remote: bool = True,
)
Returns a list of subcommand names in the order they should
appear.
| Parameter |
Type |
Description |
ctx |
|
|
add_remote |
bool |
|
This class is used to store the computed parameters that are used to run a workflow / task / launchplan.
Computed parameters are created during the execution
class RunLevelComputedParams(
project_root: typing.Optional[str] = None,
module: typing.Optional[str] = None,
temp_file_name: typing.Optional[str] = None,
)
| Parameter |
Type |
Description |
project_root |
typing.Optional[str] |
|
module |
typing.Optional[str] |
|
temp_file_name |
typing.Optional[str] |
|
This class is used to store the parameters that are used to run a workflow / task / launchplan.
class RunLevelParams(
config_file: typing.Optional[str] = None,
verbose: bool = False,
pkgs: typing.List[str] = <factory>,
project: str = 'flytesnacks',
domain: str = 'development',
destination_dir: str = '.',
copy_all: bool = False,
copy: typing.Optional[flytekit.constants.CopyFileDetection] = 'auto',
image_config: flytekit.configuration.ImageConfig = <factory>,
service_account: str = '',
wait_execution: bool = False,
poll_interval: int = None,
dump_snippet: bool = False,
overwrite_cache: bool = False,
interruptible: typing.Optional[bool] = None,
envvars: typing.Dict[str, str] = <factory>,
resource_requests: typing.Optional[flytekit.core.resources.Resources] = None,
resource_limits: typing.Optional[flytekit.core.resources.Resources] = None,
tags: typing.List[str] = <factory>,
name: str = None,
labels: typing.Dict[str, str] = <factory>,
annotations: typing.Dict[str, str] = <factory>,
raw_output_data_prefix: str = None,
max_parallelism: int = None,
disable_notifications: bool = False,
remote: bool = False,
limit: int = 50,
cluster_pool: str = '',
execution_cluster_label: str = '',
computed_params: flytekit.clis.sdk_in_container.run.RunLevelComputedParams = <factory>,
_remote: typing.Optional[flytekit.remote.remote.FlyteRemote] = None,
)
| Parameter |
Type |
Description |
config_file |
typing.Optional[str] |
|
verbose |
bool |
|
pkgs |
typing.List[str] |
|
project |
str |
|
domain |
str |
|
destination_dir |
str |
|
copy_all |
bool |
|
copy |
typing.Optional[flytekit.constants.CopyFileDetection] |
|
image_config |
flytekit.configuration.ImageConfig |
|
service_account |
str |
|
wait_execution |
bool |
|
poll_interval |
int |
|
dump_snippet |
bool |
|
overwrite_cache |
bool |
|
interruptible |
typing.Optional[bool] |
|
envvars |
typing.Dict[str, str] |
|
resource_requests |
typing.Optional[flytekit.core.resources.Resources] |
|
resource_limits |
typing.Optional[flytekit.core.resources.Resources] |
|
tags |
typing.List[str] |
|
name |
str |
|
labels |
typing.Dict[str, str] |
|
annotations |
typing.Dict[str, str] |
|
raw_output_data_prefix |
str |
|
max_parallelism |
int |
|
disable_notifications |
bool |
|
remote |
bool |
|
limit |
int |
|
cluster_pool |
str |
|
execution_cluster_label |
str |
|
computed_params |
flytekit.clis.sdk_in_container.run.RunLevelComputedParams |
|
_remote |
typing.Optional[flytekit.remote.remote.FlyteRemote] |
|
| Property |
Type |
Description |
is_remote |
bool |
|
def from_dict(
d: typing.Dict[str, typing.Any],
) -> RunLevelParams
| Parameter |
Type |
Description |
d |
typing.Dict[str, typing.Any] |
|
Return the set of base parameters added to every pyflyte run workflow subcommand.
click multicommand at the python file layer, subcommands should be all the workflows in the file.
class WorkflowCommand(
filename: str,
*args,
**kwargs,
)
Create RichGroup instance.
| Parameter |
Type |
Description |
filename |
str |
|
*args |
|
|
**kwargs |
|
|
| Method |
Description |
get_command() |
This command uses the filename with which this command was created, and the string name of the entity passed. |
list_commands() |
Returns a list of subcommand names in the order they should. |
def get_command(
ctx,
exe_entity,
)
This command uses the filename with which this command was created, and the string name of the entity passed
after the Python filename on the command line, to load the Python object, and then return the Command that
click should run.
| Parameter |
Type |
Description |
ctx |
|
The click Context object. |
exe_entity |
|
string of the flyte entity provided by the user. Should be the name of a workflow, or task function. |
def list_commands(
ctx,
)
Returns a list of subcommand names in the order they should
appear.
| Parameter |
Type |
Description |
ctx |
|
|
class YamlFileReadingCommand(
name: str,
params: typing.List[click.core.Option],
help: str,
callback: typing.Callable = None,
)
Create Rich Command instance.
| Parameter |
Type |
Description |
name |
str |
|
params |
typing.List[click.core.Option] |
|
help |
str |
|
callback |
typing.Callable |
|
| Method |
Description |
parse_args() |
Given a context and a list of arguments this creates the parser. |
def parse_args(
ctx: click.core.Context,
args: typing.List[str],
) -> typing.List[str]
Given a context and a list of arguments this creates the parser
and parses the arguments, then modifies the context as necessary.
This is automatically invoked by make_context.
| Parameter |
Type |
Description |
ctx |
click.core.Context |
|
args |
typing.List[str] |
|