future-grass-29161
08/16/2023, 8:01 AMkind-kite-58745
08/16/2023, 9:11 AMfuture-grass-29161
08/16/2023, 11:00 AMkind-kite-58745
08/16/2023, 12:09 PMflytectl
command-line tool, or using python’s flytekit.FlyteRemote class.
You can configure flytectl using flytectl config --file <path>
or set the environment variable FLYTECTL_CONFIG to the file path.
An example config file looks like this:
admin:
# For GRPC endpoints you might want to use dns:///flyte.myexample.com
endpoint: localhost:30080
authType: Pkce
insecure: true
console:
endpoint: <http://localhost:30080>
logger:
show-source: true
level: 0
That’s the config file that is automatically created from flytectl demo start
, the demo uses localhost but you can adjust this file according to your needs.
To schedule executions with either method you will need to expose the flyte endpoint.
With flytectl demo cluster, the endpoint service looks like this:
flyte flyte-sandbox-proxy NodePort 10.43.3.84 <none> 8000:30080/TCP 14m
Look for a similar service in your installation. If it’s a nodeport you can access it using the node’s IP address (rather than localhost) and the port, or you can set up a load balancing solution such as klipper or MetalLB to enable the LoadBalancer type services feature and give you an IP address. Once you have your flyte endpoint, add it in the flytectl configuration file and run flytectl commands such as flytectl register and flytectl create execution
Personally I didn’t get to use flytectl much yet, I prefer the FlyteRemote approach from python. This is configured like:
from flytekit.remote import FlyteRemote
from flytekit.configuration import Config
remote = FlyteRemote(
config=Config.for_endpoint(endpoint="<http://flyte.example.net|flyte.example.net>"),
default_project="flytesnacks",
default_domain="development",
)
flyte_entity = ... # one of FlyteTask, FlyteWorkflow, or FlyteLaunchPlan
execution = remote.execute(
flyte_entity, inputs={...}, execution_name="my_execution", wait=True
)
The flyte_entity can be remotely fetched or a local python decorated function with @workflow,
and can get a default launchplan for a workflow like this:
launch_plan = LaunchPlan.get_or_create(name="my_launch_plan", workflow=flyte_workflow)
future-grass-29161
08/16/2023, 1:36 PM