<#1636 Fetch task executions in dynamic > Pull req...
# flyte-github
a
#1636 Fetch task executions in dynamic Pull request opened by pingsutw TL;DR Fixes flyteorg/flyte#3639 Instead of fetching flyte task entity from admin, we should get task interface from DynamicWorkflowNodeMetadata. btw, the sub node data in the dynamic has been add into the
node_mapping
. we can directly get task interface from the node_mapping 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 Complete description
Copy code
from typing import Dict

from flytekit import task, workflow, dynamic
from flytekit.configuration import Config, SerializationSettings, ImageConfig
from flytekit.remote import FlyteRemote


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


@task
def t2(b: int) -> int:
    print(b)
    return b


@dynamic
def bayesopt(n_iter: int, concurrency: int) -> Dict:
    t1(a=n_iter)
    t2(b=concurrency)
    return {"a": n_iter, "b": concurrency}


@workflow
def wf(n_iter: int = 10, concurrency: int = 10) -> Dict:
    t1(a=n_iter)
    return bayesopt(n_iter=n_iter, concurrency=concurrency)


if __name__ == "__main__":
    remote = FlyteRemote(
        config=Config.auto("/Users/kevin/.flyte/config-remote.yaml"),
        default_project="flytesnacks",
        default_domain="development",
    )
    exe = remote.fetch_execution(project="flytesnacks", domain="development", name="fe8101d409e9b45c9b88")
    remote.wait(exe)
    print(exe.node_executions["n1"].task_executions)
Tracking Issue ^^^ Follow-up issue NA flyteorg/flytekit Codecov: 57.14% of diff hit (target 71.25%) 29 other checks have passed 29/30 successful checks