flytekit icon indicating copy to clipboard operation
flytekit copied to clipboard

[wip] Signaling

Open wild-endeavor opened this issue 3 years ago • 1 comments

TL;DR

This implements the signaling/human-in-the-loop feature of Flyte on the flytekit side.

Remaining tasks:

  • Support usage in conditionals (unclear what is required)
  • Ensure this works with pyflyte run. Failing currently because node is missing.
  • Flyte remote experience for entering
  • Support the full breadth of input types by using pyflyte run logic
  • Test a lot more:
    • What happens when a workflow starts with a signal node used as a subworkflow.
    • Test all the input types
  • Update flyteidl dependency after pr merged.

Type

  • [ ] Bug Fix
  • [x] Feature
  • [ ] Plugin

Are all requirements met?

  • [ ] Code completed
  • [ ] Smoke tested
  • [ ] Unit tests added
  • [ ] Code documentation added
  • [ ] Any pending items have an associated Issue

Complete description

Ported over the new flyteidl messages and created a new GateNode class.

Tracking Issue

https://github.com/flyteorg/flyte/issues/208

wild-endeavor avatar Aug 13 '22 00:08 wild-endeavor

cc @hamersaw this is the final approach we're going for.

from flytekit import task, workflow, approve, wait_for_input

@task
def t1(a: int) -> int: return a + 5

@task
def t2(a: int) -> int: return a + 6

# proposal
@workflow
def wf(a: int) -> typing.Tuple[int, int]:
    x = t2(a=wait_for_input(int, name="user_input_name", timeout=timedelta(hours=2)))
    
    # by default dan forgot to update the comments on this section
    y = t1(a=a)
    z = t1(a=approve(y, name="approval_name", timeout=timedelta(hours=1)))

    return x, z

wild-endeavor avatar Oct 03 '22 18:10 wild-endeavor

Codecov Report

Merging #1133 (d0706e7) into master (8181742) will increase coverage by 0.01%. The diff coverage is 69.15%.

@@            Coverage Diff             @@
##           master    #1133      +/-   ##
==========================================
+ Coverage   69.09%   69.10%   +0.01%     
==========================================
  Files         295      298       +3     
  Lines       26984    27399     +415     
  Branches     2538     2564      +26     
==========================================
+ Hits        18644    18934     +290     
- Misses       7843     7962     +119     
- Partials      497      503       +6     
Impacted Files Coverage Δ
flytekit/core/promise.py 52.70% <0.00%> (ø)
flytekit/exceptions/user.py 17.94% <0.00%> (-0.98%) :arrow_down:
setup.py 0.00% <ø> (ø)
flytekit/models/core/identifier.py 33.33% <20.00%> (-5.38%) :arrow_down:
flytekit/models/core/workflow.py 40.06% <30.00%> (-2.58%) :arrow_down:
flytekit/interaction/parse_stdin.py 36.00% <36.00%> (ø)
flytekit/core/gate.py 48.78% <48.78%> (ø)
tests/flytekit/unit/core/test_gate.py 99.05% <99.05%> (ø)
flytekit/tools/translator.py 85.71% <100.00%> (+0.62%) :arrow_up:

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

codecov[bot] avatar Nov 08 '22 22:11 codecov[bot]