high-kitchen-90454
10/21/2024, 9:33 AMdamp-lion-88352
10/21/2024, 1:16 PMdamp-lion-88352
10/21/2024, 1:16 PMhigh-park-82026
high-kitchen-90454
10/21/2024, 2:24 PMhigh-park-82026
jolly-florist-66728
10/21/2024, 2:55 PMFlyteRemote
interface from the flytekit
library. Here's a general approach:
1. Set Up FlyteRemote: Initialize FlyteRemote
with your Flyte configuration.
2. Fetch Execution Details: Use FlyteRemote
to fetch the workflow execution details.
3. Inspect Execution: Check the execution metadata to identify the launch plan used.
4. Deactivate Launch Plan: If the workflow fails, use the FlyteRemote
to deactivate the launch plan.
Would you like a more detailed explanation or a code example?
Sources:
- FlyteCTL Feature 👍 0 button 👎 0 button 💡 Hint: Mention @runllm in the thread for followups.high-park-82026
high-park-82026
jolly-florist-66728
10/21/2024, 2:56 PMFlyteRemote
, you can follow these steps in Python:
from flytekit import FlyteRemote, Config
from flytekit.models.admin import Execution
# Initialize FlyteRemote with your Flyte configuration
remote = FlyteRemote(
config=Config.auto(config_file="path/to/your/config.yaml"),
default_project="your_project",
default_domain="your_domain"
)
# Fetch the execution details
execution_id = "your_execution_id" # Replace with your actual execution ID
execution = remote.fetch_execution(name=execution_id)
# Check if the execution failed
if execution.closure.phase == Execution.Phase.FAILED:
# Fetch the launch plan associated with the execution
launch_plan = remote.fetch_launch_plan(name=execution.spec.launch_plan.name)
# Deactivate the launch plan
remote.deactivate_launch_plan(launch_plan)
print(f"Launch plan {launch_plan.id.name} has been deactivated.")
else:
print("Execution did not fail, no action taken.")
This code snippet initializes a FlyteRemote
instance, fetches the execution details, checks if the execution has failed, and deactivates the associated launch plan if it has. Make sure to replace placeholders like path/to/your/config.yaml
, your_project
, your_domain
, and your_execution_id
with your actual configuration and execution details.
Would you like more information on any specific part of this process?
Sources:
- https://github.com/flyteorg/flyte/pull/4308
- https://github.com/flyteorg/flyte/issues/1506 👍 0 button 👎 0 button 💡 Hint: Mention @runllm in the thread for followups.high-park-82026
jolly-florist-66728
10/21/2024, 2:57 PMflytekit
library to access the current context. Here's how you can do it:
from flytekit import current_context
# Get the current execution ID
ctx = current_context()
execution_id = ctx.execution_id.name
print(f"Current execution ID: {execution_id}")
This code snippet retrieves the execution ID from the current Flyte context using flytekit.current_context()
and prints it.
Would you like more details on this process?
Sources:
- Flyte Community Discussion 👍 0 button 👎 0 button 💡 Hint: Mention @runllm in the thread for followups.high-kitchen-90454
10/21/2024, 2:58 PMdamp-lion-88352
10/21/2024, 3:06 PM