Core Flytekit

This package contains all of the most common abstractions you’ll need to write Flyte workflows, and extend Flytekit.

Basic Authoring

These are the essentials needed to get started writing tasks and workflows. The elements here correspond well with Basics section of the user guide.

task

This is the core decorator to use for any task type in flytekit.

workflow

This decorator declares a function to be a Flyte workflow.

kwtypes

This is a small helper function to convert the keyword arguments to an OrderedDict of types.

current_context

Use this method to get a handle of specific parameters available in a flyte task.

ExecutionParameters

This is a run-time user-centric context object that is accessible to every @task method.

FlyteContext

This is an internal-facing context object, that most users will not have to deal with.

map_task

Use a map task for parallelizable tasks that are run across a List of an input type.

ImperativeWorkflow

An imperative workflow is a programmatic analogue to the typical @workflow function-based workflow and is better suited to programmatic applications.

Running Locally

Tasks and Workflows can both be locally run (assuming the relevant tasks are capable of local execution). This is useful for unit testing.

Branching and Conditionals

Branches and conditionals can be expressed explicitly in Flyte. These conditions are evaluated in the flyte engine and hence should be used for control flow. dynamic workflows can be used to perform custom conditional logic not supported by flytekit

conditional

Use a conditional section to control the flow of a workflow.

Customizing Tasks & Workflows

TaskMetadata

Metadata for a Task.

Resources

This class is used to specify both resource requests and resource limits.

WorkflowFailurePolicy

Defines the behavior for a workflow execution in the case of an observed node execution failure.

Dynamic and Nested Workflows

See the Dynamic module for more information.

dynamic

Please first see the comments for flytekit.task() and flytekit.workflow().

Scheduling

CronSchedule

Use this when you have a launch plan that you want to run on a cron expression.

FixedRate

Use this class to schedule a fixed-rate interval for a launch plan.

Notifications

Email

This notification should be used when sending regular emails to people.

PagerDuty

This notification should be used when sending emails to the PagerDuty service.

Slack

This notification should be used when sending emails to the Slack.

Reference Entities

get_reference_entity

See the documentation for flytekit.reference_task and flytekit.reference_workflow as well.

LaunchPlanReference

TaskReference

WorkflowReference

reference_task

A reference task is a pointer to a task that already exists on your Flyte installation.

reference_workflow

A reference workflow is a pointer to a workflow that already exists on your Flyte installation.

Core Task Types

SQLTask

Base task types for all SQL tasks.

ContainerTask

This is an intermediate class that represents Flyte Tasks that run a container at execution time.

PythonFunctionTask

A Python Function task should be used as the base for all extensions that have a python function.

PythonInstanceTask

This class should be used as the base class for all Tasks that do not have a user defined function body, but have a platform defined execute method.

LaunchPlan

Launch Plans are one of the core constructs of Flyte.

Secrets and SecurityContext

Secret

See Using Secrets in a Task for usage examples.

SecurityContext

This is a higher level wrapper object that for the most part users shouldn’t have to worry about.