Hi, I have a question regarding reusing inputs fro...
# flyte-support
h
Hi, I have a question regarding reusing inputs from earlier runs. I tried using
remote.client.create_execution()
with the output of
remote.get()
wrapped as a
LiteralMap
but it fails in some cases. Should I be doing this differently? Full code in reply.
Here's the full code:
Copy code
import uuid
from dataclasses import dataclass

from flytekit import task, workflow
from flytekit.configuration import Config
from flytekit.models.execution import ExecutionSpec, ExecutionMetadata
from flytekit.models.literals import LiteralMap
from flytekit.remote import FlyteRemote


@dataclass
class Data:
    f: int


@task
def example_task1() -> Data:
    return Data(f=5)


@task
def example_task2(f: int) -> None:
    print(f)


@workflow
def example_wf() -> None:
    d = example_task1()
    example_task2(f=d.f)


def main():
    remote = FlyteRemote(
        config=Config.auto(config_file="config.yaml"),
        default_project="flytesnacks",
        default_domain="development",
    )

    uri = "<flyte://v1/flytesnacks/development/atsmkk2lbr7xzn9vl8zr/n1/i>"
    task_name = "rerun.example_task2"
    inputs = remote.get(uri)

    t = remote.fetch_task(name=task_name)
    remote.client.create_execution(
        project="flytesnacks",
        domain="development",
        name=f"r{uuid.uuid4()}",
        execution_spec=ExecutionSpec(
            t.id,
            ExecutionMetadata(
                ExecutionMetadata.ExecutionMode.MANUAL,
                "placeholder",
                0,
            ),
        ),
        inputs=LiteralMap(inputs.literals),
    )


if __name__ == "__main__":
    main()
giving the error
Copy code
FlyteInvalidInputException: USER:BadInputToAPI: error=None, 
cause=<_InactiveRpcError of RPC that terminated with:
        status = StatusCode.INVALID_ARGUMENT
        details = "invalid f input wrong type. Expected simple:INTEGER, but got 
simple:STRUCT"
        debug_error_string = "UNKNOWN:Error received from peer  
{created_time:"2024-12-19T03:33:36.632958572+01:00", grpc_status:3, 
grpc_message:"invalid f input wrong type. Expected simple:INTEGER, but got 
simple:STRUCT"}"
t
remote.execute is supposed to be a nicer wrapper than using the underlying client directly.
if you just do
Copy code
exec = remote.execute(<entity>, project=..., domain=..., inputs=inputs.literals)
you should be good
h
Unfortunately, I get the same error.
t
what are the versions of flytekit locally and flyte in the backend?
h
flytekit==1.14.2 and 1.14.1 in the backend