<#7626 oss hitl> Pull request opened by <machichim...
# flyte-github
a
#7626 oss hitl Pull request opened by machichima Tracking issue Why are the changes needed? Support native condition (HITL; human in the loop) in Flyte What changes were proposed in this pull request? A condition is a TaskAction CR with no plugin and no pod. It will transit from
Paused
to
Signaled
(Succeeded) on signal, or
TimedOut
(Failed) past the deadline. • Proto changes: add `output`/`principal`/`abort_reason` to
UpdateActionStatusRequest
and `condition`/`output`/`principal` to
RunInfo
• New condition reasone:
Paused
,
Signaled
, and
TimedOut
. • Add `actionType`/`conditionSpec` (spec) and
signalValue/signalledBy/signalledAt
(status) to the TaskAction CRD; new
reconcileCondition
drives the reconcile process. • Implement `ActionsService.Signal`: validates and writes the value onto the CR status;
Enqueue
now creates condition CRs;
WatchForUpdates
carries the resolved value inline so the awaiting parent SDK resumes. • Implement
RunService.SignalEvent
to record conditions and persist the resolved value/actor into the runs DB How was this patch tested? Test with devbox and run flyte-sdk example: 1. Start devbox (
make devbox-build
->
make devbox-run
) 2. Run example with
python examples/apps/hitl_condition.py
import flyte env = flyte.TaskEnvironment( name="hitl-condition", resources=flyte.Resources(cpu=1, memory="512Mi"), ) @env.task async def task1() -> int: return 42 @env.task async def main() -> int: x = await task1() print(f"task1 completed: x = {x}") condition = await flyte.new_condition.aio( "integer_input", prompt="What should I add to x?", data_type=int, timeout=600, ) y = await condition.wait.aio() print(f"condition signaled: y = {y}") return x + y if name == "__main__": flyte.init_from_config() run = flyte.with_runcontext(disable_run_cache=True).run(main) print(f"Run name: {run.name}") print("Signal with: flyte signal condition", run.name, "<action-name> 8") run.wait() print(f"Result: {run.outputs()}") 1.
flyte get action <run-name>
to get the paused action name, set input for the condition action through
flyte signal condition <run-name> <action-name> 8
image NOTE: OSS UI does not support HITL now (cannot render phase "Paused" and cannot type input in UI directly) Labels Please add one or more of the following labels to categorize your PR: • added: For new features. • changed: For changes in existing functionality. • deprecated: For soon-to-be-removed features. • removed: For features being removed. • fixed: For any bug fixed. • security: In case of vulnerabilities This is important to improve the readability of release notes. Setup process Screenshots Check all the applicable boxes • I updated the documentation accordingly. • All new and existing tests passed. • All commits are signed-off. Related PRs Stack If you do use
git town
to manage PR Stacks, the stack relevant to this PR will show below. Otherwise, you can ignore this section. Docs link flyteorg/flyte
#7626 oss hitl Pull request merged by pingsutw flyteorg/flyte