Is there a way to locally execute a task or workfl...
# ask-the-community
k
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
Hi @Klemens Kasseroller! What json string are you referring to?
k
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
k
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
k
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?
169 Views