Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pyflyte run can now execute a task either locally or remote #995

Merged
merged 3 commits into from
May 13, 2022

Conversation

kumare3
Copy link
Contributor

@kumare3 kumare3 commented May 10, 2022

Signed-off-by: Ketan Umare [email protected]

TL;DR

It is now possible to execute a single task from the command line

Example

from flytekit import workflow, task
from typing import List, Dict

@task
def t1(l: str) -> List[str]:
    return [l]


@workflow
def wf(l: str = "") -> List[str]:
    return t1(l=l)


@task
def t2(i: Dict[str, int]) -> Dict[str, int]:
    return i

@workflow
def wf2m(i: Dict[str, int]) -> Dict[str, int]:
    return t2(i=i)

To Execute

pyflyte run --remote test2.py t1 --l hello

and help should show

➜ pyflyte run test2.py --help

Usage: pyflyte run test2.py [OPTIONS] COMMAND [ARGS]...

  Run a [workflow|task] in a file using script mode

Options:
  --help  Show this message and exit.

Commands:
  wf    Run test2.wf in script mode
  wf2m  Run test2.wf2m in script mode
  t1    Run test2.t1 in script mode
  t2    Run test2.t2 in script mode

Type

  • Bug Fix
  • Feature
  • Plugin

Are all requirements met?

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

Tracking Issue

flyteorg/flyte#2471

Follow-up issue

NA

@codecov
Copy link

codecov bot commented May 10, 2022

Codecov Report

Merging #995 (79d9465) into master (c011ef7) will increase coverage by 0.05%.
The diff coverage is 87.17%.

@@            Coverage Diff             @@
##           master     #995      +/-   ##
==========================================
+ Coverage   86.29%   86.34%   +0.05%     
==========================================
  Files         255      255              
  Lines       24284    24306      +22     
  Branches     2768     2771       +3     
==========================================
+ Hits        20955    20988      +33     
+ Misses       2856     2845      -11     
  Partials      473      473              
Impacted Files Coverage Δ
flytekit/remote/remote.py 35.68% <0.00%> (-0.16%) ⬇️
flytekit/clis/sdk_in_container/run.py 76.25% <89.65%> (+6.07%) ⬆️
tests/flytekit/unit/cli/pyflyte/test_run.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c011ef7...79d9465. Read the comment docs.

Signed-off-by: Ketan Umare <[email protected]>

def get_command(self, ctx, workflow):
def get_command(self, ctx, exe_entity):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what's exe_entity?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

executable

@kumare3 kumare3 merged commit 06c1371 into master May 13, 2022
eapolinario pushed a commit that referenced this pull request Jun 17, 2022
* pyflyte run can now execute a task either locally or remote

Signed-off-by: Ketan Umare <[email protected]>

* Fix namedtuple and test

Signed-off-by: Ketan Umare <[email protected]>
@eapolinario eapolinario mentioned this pull request Jun 17, 2022
8 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants