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

Remove false error inside dynamic task in local executions #2675

Merged
merged 4 commits into from
Aug 14, 2024

Conversation

pingsutw
Copy link
Member

Tracking issue

NA

Why are the changes needed?

Got below error when running the dynamic task

{"asctime": "2024-06-24 17:21:38,715", "name": "flytekit", "levelname": "ERROR", "message": "You are not supposed to nest @Task/@Workflow inside a @Task!", "taskName": null}
{"asctime": "2024-06-24 17:21:38,716", "name": "flytekit", "levelname": "ERROR", "message": "You are not supposed to nest @Task/@Workflow inside a @Task!", "taskName": null}
{"asctime": "2024-06-24 17:21:38,716", "name": "flytekit", "levelname": "ERROR", "message": "You are not supposed to nest @Task/@Workflow inside a @Task!", "taskName": null}
{"asctime": "2024-06-24 17:21:38,716", "name": "flytekit", "levelname": "ERROR", "message": "You are not supposed to nest @Task/@Workflow inside a @Task!", "taskName": null}
{"asctime": "2024-06-24 17:21:38,717", "name": "flytekit", "levelname": "ERROR", "message": "You are not supposed to nest @Task/@Workflow inside a @Task!", "taskName": null}

What changes were proposed in this pull request?

update the execution mode to DYNAMIC_TASK_EXECUTION when running a dynamic task

How was this patch tested?

pyflyte -vv run flyte-example/improve_error/task_inside_dynamic.py d2
from click.testing import CliRunner

from flytekit import task, workflow, ImageSpec, dynamic
from flytekit.clis.sdk_in_container import pyflyte

image_spec = ImageSpec(registry="pingsutw", packages=["pandas", "mypy"], env={"FLYTE_SDK_LOGGING_LEVEL": "10"})


@task(container_image=image_spec)
def t1() -> int:
    return 3 + 2


@task(container_image=image_spec)
def t2(a: int) -> int:
    return a + 3


@dynamic(container_image=image_spec)
def d1() -> int:
    t1()
    return t2(a=1)


@dynamic(container_image=image_spec)
def d2() -> int:
    d1()
    return t2(a=1)


@workflow()
def wf() -> int:
    d2()
    return 1


if __name__ == '__main__':
    runner = CliRunner()
    result = runner.invoke(
        pyflyte.main,
        [
            "-vv",
            "run",
            "/Users/kevin/git/flytekit/flyte-example/improve_error/task_inside_dynamic.py",
            "d1"
        ]
    )
    print(result.stdout)

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

NA

Docs link

NA

Signed-off-by: Kevin Su <[email protected]>
Signed-off-by: Kevin Su <[email protected]>
@pingsutw pingsutw marked this pull request as ready for review August 11, 2024 09:53
Copy link

codecov bot commented Aug 11, 2024

Codecov Report

Attention: Patch coverage is 66.66667% with 3 lines in your changes missing coverage. Please review.

Project coverage is 78.85%. Comparing base (69445ff) to head (18475b5).
Report is 2 commits behind head on master.

Files Patch % Lines
flytekit/core/python_function_task.py 60.00% 1 Missing and 1 partial ⚠️
flytekit/core/node_creation.py 50.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2675      +/-   ##
==========================================
- Coverage   79.24%   78.85%   -0.39%     
==========================================
  Files         196      187       -9     
  Lines       19785    19191     -594     
  Branches     4008     4008              
==========================================
- Hits        15678    15133     -545     
+ Misses       3407     3358      -49     
  Partials      700      700              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Signed-off-by: Kevin Su <[email protected]>
@eapolinario
Copy link
Collaborator

This is just for local executions of dynamic tasks, right? If so, can you add that to the title/description?

@pingsutw pingsutw changed the title Remove false error inside dynamic task Remove false error inside dynamic task in local executions Aug 13, 2024
@pingsutw pingsutw merged commit 03d2301 into master Aug 14, 2024
99 checks passed
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.

2 participants