Skip to content

Commit

Permalink
Expose error handler in workflow panel
Browse files Browse the repository at this point in the history
  • Loading branch information
daryllimyt committed Jan 8, 2025
1 parent 1226f81 commit e0c3b9f
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 5 deletions.
36 changes: 36 additions & 0 deletions frontend/src/components/workbench/panel/workflow-panel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@ const workflowUpdateFormSchema = z.object({
return z.NEVER
}
}),
/* Error Handler */
error_handler: z.string().nullish(),
})

type WorkflowUpdateForm = z.infer<typeof workflowUpdateFormSchema>
Expand Down Expand Up @@ -138,6 +140,7 @@ export function WorkflowPanel({
returns: isEmptyObjectOrNullish(workflow.returns)
? ""
: YAML.stringify(workflow.returns),
error_handler: workflow.error_handler || "",
},
})
console.log("workflow alias", workflow.alias)
Expand Down Expand Up @@ -293,6 +296,39 @@ export function WorkflowPanel({
</FormItem>
)}
/>
<FormField
control={methods.control}
name="error_handler"
render={({ field }) => (
<FormItem>
<div className="flex items-center gap-2">
<FormLabel className="text-xs">
<span>Error Handler</span>
</FormLabel>
{field.value && (
<CopyButton
value={field.value}
toastMessage="Copied workflow error handler to clipboard"
/>
)}
</div>
<FormDescription className="text-xs">
The workflow ID or alias of the error handler
workflow.
</FormDescription>
<FormControl>
<Input
className="text-xs"
placeholder="The workflow ID or alias of the error handler workflow"
{...field}
value={field.value || ""}
onChange={field.onChange}
/>
</FormControl>
<FormMessage />
</FormItem>
)}
/>
<div className="space-y-2">
<FormLabel className="flex items-center gap-2 text-xs">
<span>Workflow ID</span>
Expand Down
7 changes: 2 additions & 5 deletions tests/unit/test_workflows.py
Original file line number Diff line number Diff line change
Expand Up @@ -2447,11 +2447,11 @@ def assert_erroneous_task_failed_correctly(
)
assert evt is not None, "No failing task event found"

# Check fail_evt group exists and type
# Check event group exists and type
assert evt.event_group is not None
assert isinstance(evt.event_group, EventGroup)

# Check fail_evt group attributes
# Check event group attributes
group = evt.event_group
assert group.udf_namespace == "core.transform"
assert group.udf_name == "reshape"
Expand Down Expand Up @@ -2507,9 +2507,6 @@ def assert_error_handler_initiated_correctly(
# Check that the error handler DSL was passed correctly
assert group.action_input.dsl == handler_dsl

# # This would be the actual error handler workflow execution
# assert group.related_wf_exec_id == failing_wf_exec_id

# Check that the error handler's parent is the failing workflow
assert (
group.action_input.parent_run_context
Expand Down

0 comments on commit e0c3b9f

Please sign in to comment.