powerful-australia-73346
06/09/2025, 6:53 AMtry/except
block is used inside workflow
, which should not be possible as it is straight up python in workflow, no? It should only work when executed locally but on remote should not work. At least I don't get it to work.
notification_task = WebhookTask(
name="failure-notification",
url="<https://hooks.slack.com/services/xyz>", #your Slack webhook
method=http.HTTPMethod.POST,
headers={"Content-Type": "application/json"},
data={"text": "Workflow failed: {inputs.error_message}"},
dynamic_inputs={"error_message": str},
show_data=True,
show_url=True,
description="Send notification on workflow failure"
)
...
@fl.workflow
def ml_workflow_with_failure_handling() -> float:
try:
X, y = load_and_preprocess_data()
model = train_model(X=X, y=y)
accuracy = evaluate_model(model=model, X=X, y=y)
return accuracy
except Exception as e:
# Trigger the notification task on failure
notification_task(error_message=str(e))
raise
freezing-airport-6809
freezing-airport-6809
freezing-airport-6809
try - catch
let me know - i have something cookingpowerful-australia-73346
06/10/2025, 6:13 AMtry/except
inside a task
with the WebhookTask