https://flyte.org logo
#ask-the-community
Title
# ask-the-community
k

Klemens Kasseroller

05/04/2023, 9:58 AM
Is there a way to locally execute a task or workflow using the inputs from a remote execution, ideally diretly using the Json string from the UI? The dispatch_execute (https://github.com/flyteorg/flytekit/blob/master/flytekit/bin/entrypoint.py#L63) function seems to do what I am looking for, but expects a pb as input. Does this work at all (either with pb or with json)? If yes, is there a way to directly use the Json from the UI or how can I easily find the inputs.pb for a remote task execution?
s

Samhita Alla

05/04/2023, 10:33 AM
Hi @Klemens Kasseroller! What json string are you referring to?
k

Klemens Kasseroller

05/04/2023, 10:46 AM
I am referring to the inputs from here:
So the idea would be to copy these inputs, paste them into my local python script and somehow start a local execution of a task or a workflow with these inputs
s

Samhita Alla

05/04/2023, 11:17 AM
k

Klemens Kasseroller

05/04/2023, 1:40 PM
Thank you! I was able to execute a local task with the following code:
Copy code
remote = FlyteRemote(config=config)
execution = remote.fetch_execution(name="myexecutionid", project="myproject", domain="development")
remote.sync(execution, sync_nodes=True)
inputs = execution.node_executions["n0"].executions[0].inputs
my_local_task.dispatch_execute(flytekit.FlyteContextManager.current_context(), inputs)
Do you know, how I could execute a (sub-)workflow in a similar way?
s

Samhita Alla

05/05/2023, 1:11 PM
k

Klemens Kasseroller

05/05/2023, 2:12 PM
Thanks for your reply. I understand that I can execute workflows remotely using FlyteRemote, but I would like to execute the workflow locally, using the inputs from a previous remote execution. So the question is if there is something similar to the dispatch_execute function for the workflow object?
5 Views