happy-nail-3734
12/19/2024, 2:44 AMremote.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.happy-nail-3734
12/19/2024, 2:46 AMimport 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
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"}"
thankful-minister-83577
thankful-minister-83577
exec = remote.execute(<entity>, project=..., domain=..., inputs=inputs.literals)
you should be goodhappy-nail-3734
12/19/2024, 6:29 PMthankful-minister-83577
happy-nail-3734
12/19/2024, 7:43 PM