Clara Gregori
05/15/2024, 2:43 PMRunLLM
05/15/2024, 2:43 PMClara Gregori
05/15/2024, 2:46 PMRunLLM
05/15/2024, 2:46 PMClara Gregori
05/15/2024, 3:14 PMRunLLM
05/15/2024, 3:14 PMpyflyte run
using the --image
flag, you can specify each image with a unique name. Here's an example:
pyflyte run --remote --image mindmeld="ghcr.io/flyteorg/flytecookbook:core-latest" --image borebuster="ghcr.io/flyteorg/flytekit:py3.9-latest" multi_images.py multi_images_wf
Would you like more detail?
Sources:
- Multiple images in a workflow
- Specifying multiple images
- Using different images for different tasksClara Gregori
05/15/2024, 3:16 PMRunLLM
05/15/2024, 3:16 PMpyflyte run --remote --image mindmeld="ghcr.io/flyteorg/flytecookbook:core-latest" --image borebuster="ghcr.io/flyteorg/flytekit:py3.9-latest" multi_images.py multi_images_wf
Ensure that each image has a unique identifier like 'mindmeld' and 'borebuster'.
Would you like more detail?
Sources:
- Multiple images in a workflow
- Specifying multiple images
- Using different images for different tasks π 0 button π 0 button π‘ Hint: Mention @runllm in the thread for followups.Clara Gregori
05/15/2024, 3:25 PMlaunchplan?
RunLLM
05/15/2024, 3:25 PMLaunchPlan
in Flyte is a configuration that defines how to execute a workflow. It includes a set of bound workflow inputs, optional runtime overrides like notifications and schedules, and can specify default or fixed inputs. LaunchPlans are the only means to invoke workflow executions, allowing workflows to be shared, scheduled, and executed with predefined or user-specified inputs.
Would you like more detail?
Sources:
- Launch Plans
- Launch Plans Example
- Launch Plans Concept π 0 button π 0 button π‘ Hint: Mention @runllm in the thread for followups.Clara Gregori
05/15/2024, 3:27 PMRunLLM
05/15/2024, 3:27 PMfrom flytekit.remote import FlyteRemote
from flytekit.configuration import Config
# Initialize FlyteRemote
remote = FlyteRemote(
config=Config.for_endpoint(endpoint="flyte.example.net"),
default_project="flytesnacks",
default_domain="development",
)
# Fetch the workflow
flyte_workflow = remote.fetch_workflow(name="workflows.example.wf", version="v1")
# Execute the workflow
execution = remote.execute(
flyte_workflow, inputs={"mean": 1}, execution_name="workflow-execution", wait=True
)
Would you like more detail?
Sources:
- Running tasks
- Running tasks - Flyte
- Remote Workflow Example π 0 button π 0 button π‘ Hint: Mention @runllm in the thread for followups.Clara Gregori
05/15/2024, 4:51 PMRunLLM
05/15/2024, 4:51 PMfrom flytekit.remote import FlyteRemote
from flytekit.configuration import Config
# Initialize FlyteRemote
remote = FlyteRemote(
config=Config.for_endpoint(endpoint="flyte.example.net"),
default_project="flytesnacks",
default_domain="development",
)
Step 2: Fetch Workflow
# Fetch the workflow
flyte_workflow = remote.fetch_workflow(name="workflows.example.wf", version="v1")
Step 3: Execute Workflow
# Execute the workflow
execution = remote.execute(
flyte_workflow, inputs={"mean": 1}, execution_name="workflow-execution", wait=True
)
# Or use execution_name_prefix to avoid repeated execution names
execution = remote.execute(
flyte_workflow, inputs={"mean": 1}, execution_name_prefix="flyte", wait=True
)
Full Example
from flytekit.remote import FlyteRemote
from flytekit.configuration import Config
# Initialize FlyteRemote
remote = FlyteRemote(
config=Config.for_endpoint(endpoint="flyte.example.net"),
default_project="flytesnacks",
default_domain="development",
)
# Fetch the workflow
flyte_workflow = remote.fetch_workflow(name="workflows.example.wf", version="v1")
# Execute the workflow
execution = remote.execute(
flyte_workflow, inputs={"mean": 1}, execution_name="workflow-execution", wait=True
)
# Or use execution_name_prefix to avoid repeated execution names
execution = remote.execute(
flyte_workflow, inputs={"mean": 1}, execution_name_prefix="flyte", wait=True
)
# Inspecting execution
input_keys = execution.inputs.keys()
output_keys = execution.outputs.keys()
Would you like more detail?
Sources:
- Running tasks
- Running tasks - Flyte
- Remote Workflow Example π 0 button π 0 button π‘ Hint: Mention @runllm in the thread for followups.Clara Gregori
05/15/2024, 4:55 PMRunLLM
05/15/2024, 4:55 PMflytectl
, flytekit
, etc.).
2. Run the Python Script: Execute the Python script that contains the FlyteRemote API calls.
Step 1: Set Up Environment
Ensure you have flytectl
and flytekit
installed. You can install them using:
pip install flytekit
brew install flytectl
Step 2: Run the Python Script
Create a Python script (e.g., run_workflow.py
) with the following content:
from flytekit.remote import FlyteRemote
from flytekit.configuration import Config
# Initialize FlyteRemote
remote = FlyteRemote(
config=Config.for_endpoint(endpoint="flyte.example.net"),
default_project="flytesnacks",
default_domain="development",
)
# Fetch the workflow
flyte_workflow = remote.fetch_workflow(name="workflows.example.wf", version="v1")
# Execute the workflow
execution = remote.execute(
flyte_workflow, inputs={"mean": 1}, execution_name="workflow-execution", wait=True
)
# Or use execution_name_prefix to avoid repeated execution names
execution = remote.execute(
flyte_workflow, inputs={"mean": 1}, execution_name_prefix="flyte", wait=True
)
# Inspecting execution
input_keys = execution.inputs.keys()
output_keys = execution.outputs.keys()
print(f"Inputs: {input_keys}, Outputs: {output_keys}")
Run the script using Python:
python run_workflow.py
This will execute the workflow via the FlyteRemote API.
Would you like more detail?
Sources:
- Running tasks
- Running tasks - Flyte
- Remote Workflow Example π 0 button π 0 button π‘ Hint: Mention @runllm in the thread for followups.Clara Gregori
05/15/2024, 4:58 PMRunLLM
05/15/2024, 4:58 PMflytectl
and flytekit
installed.
2. Start the Demo Cluster: Use flytectl
to start the demo cluster.
3. Configure FlyteRemote: Set up the FlyteRemote object to point to the demo cluster.
4. Run the Python Script: Execute the Python script that contains the FlyteRemote API calls.
Step 1: Set Up Environment
Ensure you have flytectl
and flytekit
installed:
pip install flytekit
brew install flytectl
Step 2: Start the Demo Cluster
Start the demo cluster using `flytectl`:
flytectl demo start
Step 3: Configure FlyteRemote
Create a Python script (e.g., run_workflow.py
) with the following content:
from flytekit.remote import FlyteRemote
from flytekit.configuration import Config
# Initialize FlyteRemote
remote = FlyteRemote(
config=Config.auto(config_file="~/.flyte/config-sandbox.yaml"),
default_project="flytesnacks",
default_domain="development",
)
# Fetch the workflow
flyte_workflow = remote.fetch_workflow(name="workflows.example.wf", version="v1")
# Execute the workflow
execution = remote.execute(
flyte_workflow, inputs={"mean": 1}, execution_name="workflow-execution", wait=True
)
# Or use execution_name_prefix to avoid repeated execution names
execution = remote.execute(
flyte_workflow, inputs={"mean": 1}, execution_name_prefix="flyte", wait=True
)
# Inspecting execution
input_keys = execution.inputs.keys()
output_keys = execution.outputs.keys()
print(f"Inputs: {input_keys}, Outputs: {output_keys}")
Step 4: Run the Python Script
Run the script using Python:
python run_workflow.py
This will execute the workflow on the remote demo cluster via the FlyteRemote API.
Would you like more detail?
Sources:
- Running tasks
- Running tasks - Flyte
- Remote Workflow Example π 0 button π 0 button π‘ Hint: Mention @runllm in the thread for followups.Clara Gregori
05/15/2024, 5:00 PMRunLLM
05/15/2024, 5:00 PMhttp://localhost:30081
.
2. Use FlyteRemote to Interact with the API: The FlyteRemote object abstracts the direct API calls, but if you need to make raw HTTP requests, you can use the Flyte Admin API endpoints.
Example Using FlyteRemote
from flytekit.remote import FlyteRemote
from flytekit.configuration import Config
# Initialize FlyteRemote
remote = FlyteRemote(
config=Config.for_endpoint(endpoint="http://localhost:30081"),
default_project="flytesnacks",
default_domain="development",
)
# Fetch the workflow
flyte_workflow = remote.fetch_workflow(name="workflows.example.wf", version="v1")
# Execute the workflow
execution = remote.execute(
flyte_workflow, inputs={"mean": 1}, execution_name="workflow-execution", wait=True
)
# Inspecting execution
input_keys = execution.inputs.keys()
output_keys = execution.outputs.keys()
print(f"Inputs: {input_keys}, Outputs: {output_keys}")
Example Using Raw HTTP Request
If you need to make a raw HTTP request to the Flyte Admin API, you can use the following approach:
import requests
import json
# Define the Flyte Admin API endpoint
url = "http://localhost:30081/api/v1/workflows/flytesnacks/development/workflows.example.wf"
# Define the payload for execution
payload = {
"project": "flytesnacks",
"domain": "development",
"name": "workflows.example.wf",
"inputs": {
"mean": 1
}
}
# Make the HTTP POST request to execute the workflow
response = requests.post(url, data=json.dumps(payload), headers={"Content-Type": "application/json"})
# Print the response
print(response.json())
URL Structure
- Base URL: http://localhost:30081
(or your Flyte Admin endpoint)
- API Path: /api/v1/workflows/{project}/{domain}/{workflow_name}
Replace {project}
, {domain}
, and {workflow_name}
with your specific values.
Would you like more detail?
Sources:
- FlyteRemote API
- Flyte Admin API
- Flyte Admin API Example π 0 button π 0 button π‘ Hint: Mention @runllm in the thread for followups.Clara Gregori
05/15/2024, 5:28 PMRunLLM
05/15/2024, 5:28 PMexample_workflow.py
.
from flytekit import task, workflow
@task
def add(a: int, b: int) -> int:
return a + b
@workflow
def example_workflow(a: int, b: int) -> int:
return add(a=a, b=b)
Step 2: Register the Workflow
Use flytectl
to register the workflow. Run the following commands in your terminal:
flytectl register files --project flytesnacks --domain development --archive example_workflow.py --version v1
Step 3: Execute the Workflow Using FlyteRemote
Create another Python script to execute the registered workflow using FlyteRemote. Save this as run_workflow.py
.
from flytekit.remote import FlyteRemote
from flytekit.configuration import Config
# Initialize FlyteRemote
remote = FlyteRemote(
config=Config.for_endpoint(endpoint="http://localhost:30081"),
default_project="flytesnacks",
default_domain="development",
)
# Fetch the workflow
flyte_workflow = remote.fetch_workflow(name="example_workflow", version="v1")
# Execute the workflow
execution = remote.execute(
flyte_workflow, inputs={"a": 5, "b": 3}, execution_name="workflow-execution", wait=True
)
# Inspecting execution
input_keys = execution.inputs.keys()
output_keys = execution.outputs.keys()
print(f"Inputs: {input_keys}, Outputs: {output_keys}")
print(f"Execution Outputs: {execution.outputs}")
Step 4: Run the Execution Script
Run the run_workflow.py
script using Python:
python run_workflow.py
This will execute the example_workflow
on the Flyte cluster and print the inputs and outputs of the execution.
Would you like more detail?
Sources:
- FlyteRemote API
- Flyte Admin API
- Flyte Admin API ExampleClara Gregori
05/15/2024, 5:35 PMRunLLM
05/15/2024, 5:35 PMflytectl
expects the archive file to be in .tar
, .tar.gz
, or .tgz
format. You need to package your workflow into one of these supported formats before registering it.
Hereβs how you can do it:
1. Package the Workflow: Use pyflyte
to package the workflow into a .tar.gz
file.
2. Register the Packaged Workflow: Use flytectl
to register the packaged workflow.
Step 1: Package the Workflow
Create a flyte_package
directory and move your workflow script there. Then, use pyflyte
to package it.
mkdir flyte_package
mv example_workflow.py flyte_package/
pyflyte --pkgs flyte_package package
This will create a flyte-package.tgz
file.
Step 2: Register the Packaged Workflow
Use flytectl
to register the packaged workflow:
flytectl register files --project flytesnacks --domain development --archive flyte-package.tgz --version v1
Full Example
1. Define the Workflow: Save as example_workflow.py
.
from flytekit import task, workflow
@task
def add(a: int, b: int) -> int:
return a + b
@workflow
def example_workflow(a: int, b: int) -> int:
return add(a=a, b=b)
2. Package the Workflow:
mkdir flyte_package
mv example_workflow.py flyte_package/
pyflyte --pkgs flyte_package package
3. Register the Packaged Workflow:
flytectl register files --project flytesnacks --domain development --archive flyte-package.tgz --version v1
4. Execute the Workflow Using FlyteRemote: Save as run_workflow.py
.
from flytekit.remote import FlyteRemote
from flytekit.configuration import Config
# Initialize FlyteRemote
remote = FlyteRemote(
config=Config.for_endpoint(endpoint="http://localhost:30081"),
default_project="flytesnacks",
default_domain="development",
)
# Fetch the workflow
flyte_workflow = remote.fetch_workflow(name="example_workflow", version="v1")
# Execute the workflow
execution = remote.execute(
flyte_workflow, inputs={"a": 5, "b": 3}, execution_name="workflow-execution", wait=True
)
# Inspecting execution
input_keys = execution.inputs.keys()
output_keys = execution.outputs.keys()
print(f"Inputs: {input_keys}, Outputs: {output_keys}")
print(f"Execution Outputs: {execution.outputs}")
5. Run the Execution Script:
python run_workflow.py
Would you like more detail?
Sources:
- FlyteRemote API
- Flyte Admin API
- Flyte Admin API Example π 0 button π 0 button π‘ Hint: Mention @runllm in the thread for followups.Clara Gregori
05/16/2024, 12:37 PMRunLLM
05/16/2024, 12:37 PMflytectl
.
2. Remove Flyte Configuration and Data: Clean up any remaining configuration files and data.
3. Reinstall Flyte Components: Reinstall flytectl
and other necessary components.
4. Start the Demo Cluster: Start the demo cluster again.
Step 1: Uninstall Flyte Components
If you have installed Flyte using Helm, you can uninstall it using the following command:
helm uninstall flyte -n flyte
If you used flytectl
to start the demo cluster, you can stop it using:
flytectl demo stop
Step 2: Remove Flyte Configuration and Data
Remove any remaining Flyte configuration files and data. This typically includes the Flyte configuration directory and any Docker containers or volumes.
rm -rf ~/.flyte
docker system prune -a --volumes
Step 3: Reinstall Flyte Components
Reinstall flytectl
and other necessary components. Follow the installation instructions for your operating system.
For macOS:
brew install flyteorg/homebrew-tap/flytectl
For Linux:
curl -sL https://ctl.flyte.org/install | sudo bash -s -- -b /usr/local/bin
For Windows (using WSL):
curl -sL https://ctl.flyte.org/install | sudo bash -s -- -b /usr/local/bin
Step 4: Start the Demo Cluster
Start the demo cluster again using `flytectl`:
flytectl demo start
Full Example
1. Uninstall Flyte Components:
helm uninstall flyte -n flyte
flytectl demo stop
2. Remove Flyte Configuration and Data:
rm -rf ~/.flyte
docker system prune -a --volumes
3. Reinstall Flyte Components:
For macOS:
brew install flyteorg/homebrew-tap/flytectl
For Linux:
curl -sL https://ctl.flyte.org/install | sudo bash -s -- -b /usr/local/bin
For Windows (using WSL):
curl -sL https://ctl.flyte.org/install | sudo bash -s -- -b /usr/local/bin
4. Start the Demo Cluster:
flytectl demo start
Would you like more detail?
Sources:
- FlyteRemote API
- Flyte Admin API
- Flyte Admin API Example π 0 button π 0 button π‘ Hint: Mention @runllm in the thread for followups.Clara Gregori
05/16/2024, 1:04 PMRunLLM
05/16/2024, 1:04 PMflytectl
you have installed. To resolve this, you can try the following steps to completely remove flytectl
and reinstall a specific version that is known to work.
Step 1: Uninstall Flytectl
First, remove the existing flytectl
binary.
For macOS (if installed via Homebrew):
brew uninstall flytectl
For Linux and Windows (if installed via curl):
sudo rm /usr/local/bin/flytectl
Step 2: Remove Flyte Configuration and Data
Clean up any remaining Flyte configuration files and data.
rm -rf ~/.flyte
docker system prune -a --volumes
Step 3: Reinstall a Specific Version of Flytectl
Download and install a specific version of flytectl
that is known to work. For example, version v0.6.14
.
For macOS:
brew install flyteorg/homebrew-tap/flytectl@0.6.14
For Linux:
curl -sL https://github.com/flyteorg/flytectl/releases/download/v0.6.14/flytectl_Linux_x86_64.tar.gz | sudo tar -xz -C /usr/local/bin flytectl
For Windows (using WSL):
curl -sL https://github.com/flyteorg/flytectl/releases/download/v0.6.14/flytectl_Windows_x86_64.zip -o flytectl.zip
unzip flytectl.zip -d /usr/local/bin
Step 4: Verify the Installation
Verify that the correct version of flytectl
is installed.
flytectl version
Step 5: Start the Demo Cluster
Start the demo cluster again using `flytectl`:
flytectl demo start
Full Example
1. Uninstall Flytectl:
For macOS:
brew uninstall flytectl
For Linux and Windows:
sudo rm /usr/local/bin/flytectl
2. Remove Flyte Configuration and Data:
rm -rf ~/.flyte
docker system prune -a --volumes
3. Reinstall a Specific Version of Flytectl:
For macOS:
brew install flyteorg/homebrew-tap/flytectl@0.6.14
For Linux:
curl -sL https://github.com/flyteorg/flytectl/releases/download/v0.6.14/flytectl_Linux_x86_64.tar.gz | sudo tar -xz -C /usr/local/bin flytectl
For Windows (using WSL):
curl -sL https://github.com/flyteorg/flytectl/releases/download/v0.6.14/flytectl_Windows_x86_64.zip -o flytectl.zip
unzip flytectl.zip -d /usr/local/bin
4. Verify the Installation:
flytectl version
5. Start the Demo Cluster:
flytectl demo start
Would you like more detail?
Sources:
- FlyteRemote API
- Flyte Admin API
- Flyte Admin API Example π 0 button π 0 button π‘ Hint: Mention @runllm in the thread for followups.Clara Gregori
05/16/2024, 1:07 PMRunLLM
05/16/2024, 1:07 PMbrew uninstall flytectl
For Linux and Windows (if installed via curl):
sudo rm /usr/local/bin/flytectl
2. Remove Flyte Configuration and Data:
rm -rf ~/.flyte
docker system prune -a --volumes
3. Clean Up Docker Containers and Images:
docker stop $(docker ps -a -q)
docker rm $(docker ps -a -q)
docker rmi $(docker images -q)
Step 2: Reinstall Flytectl
Reinstall a specific version of flytectl
that is known to work. For example, version v0.6.14
.
For macOS:
brew install flyteorg/homebrew-tap/flytectl@0.6.14
For Linux:
curl -sL https://github.com/flyteorg/flytectl/releases/download/v0.6.14/flytectl_Linux_x86_64.tar.gz | sudo tar -xz -C /usr/local/bin flytectl
For Windows (using WSL):
curl -sL https://github.com/flyteorg/flytectl/releases/download/v0.6.14/flytectl_Windows_x86_64.zip -o flytectl.zip
unzip flytectl.zip -d /usr/local/bin
Step 3: Verify the Installation
Verify that the correct version of flytectl
is installed.
flytectl version
Step 4: Start the Demo Cluster
Start the demo cluster again using `flytectl`:
flytectl demo start
Full Example
1. Uninstall Flytectl:
For macOS:
brew uninstall flytectl
For Linux and Windows:
sudo rm /usr/local/bin/flytectl
2. Remove Flyte Configuration and Data:
rm -rf ~/.flyte
docker system prune -a --volumes
3. Clean Up Docker Containers and Images:
docker stop $(docker ps -a -q)
docker rm $(docker ps -a -q)
docker rmi $(docker images -q)
4. Reinstall a Specific Version of Flytectl:
For macOS:
brew install flyteorg/homebrew-tap/flytectl@0.6.14
For Linux:
curl -sL https://github.com/flyteorg/flytectl/releases/download/v0.6.14/flytectl_Linux_x86_64.tar.gz | sudo tar -xz -C /usr/local/bin flytectl
For Windows (using WSL):
curl -sL https://github.com/flyteorg/flytectl/releases/download/v0.6.14/flytectl_Windows_x86_64.zip -o flytectl.zip
unzip flytectl.zip -d /usr/local/bin
5. Verify the Installation:
flytectl version
6. Start the Demo Cluster:
flytectl demo start
Would you like more detail?
Sources:
- FlyteRemote API
- Flyte Admin API
- Flyte Admin API Example π 0 button π 0 button π‘ Hint: Mention @runllm in the thread for followups.