Hi, I am very new to the Flyte and trying to learn...
# ask-the-community
p
Hi, I am very new to the Flyte and trying to learn how flyte compiles its workflow and there’s a cli: pyflyte serialize, but I would not get it work with an example project, created via pyflyte init. It will be great if anyone can share some insights. Here is my question in the SO: https://stackoverflow.com/questions/76298549/how-to-run-pyflyte-serialize-workflows
e
Hi Ping! If you want to get workflows running on Flyte, I would recommend. using the following commands instead of seralize. This work for a single file
Copy code
# run locally
pyflyte --config ~/.flyte/config.yaml run ./workflows/example.py wf

# run remote
pyflyte --config ~/.flyte/config.yaml run -i [image] /workflows/example.py wf
This works for an entire python module. Flyte will serialize tasks, package your entire module, and send code to Flyte.
Copy code
# register
pyflyte --config ~/.flyte/config.yaml register -i [image] /workflows/example.py wf
^ Kick off from the UI or use flyte remote If you are using the demo cluster.... Also, the demo cluster sets ups a container registry at
localhost:3000
. You can use new images with the following commands:
Copy code
docker build -t localhost:30000/imagname:tag
docker push localhost:30000/imagname:tag
p
Thanks a lot @Evan Sadler I am wondering if I use pyflyte run, where can I see the serialized task/workflow?
e
I am not 100% sure, but I am pretty sure pyflyte automatically saves them to a local directory. You might be able to inspect the local dir? Pyflyte manages sending the serialized tasks / workflows to a flyte cluster, which I imagine is the demo cluster in your case?
Copy code
flytectl demo start
I usually skip looking at the serialized workflows since running workflows locally doesn't require serialization and pyflyte manages pushing workflows / code to flyte cluster for you.. If the
pyflyte run --remote
doesn't print out the local dir where the workflows are serialized. Then I think someone from the open-source team who know the internals better can help you tomorrow + this week.
p
Thank you so much. Let me also play around the —remote flag.
y
Hi Evan, does this mean to run it remotely people need to push the code to a container registry first ? Thanks .
e
Both Pyflyte run —remote and pyflyte register will manage packaging your code and sending it to a flyte cluster independent of a container registry. Then flyte will manage inject your code into the container that you specify at runtime. That way you iterate on code independently of docker. Pyflyte package will bundle your docker image and code together so flyte isn’t injecting your code into the image at runtime. It’s supposed to be “safer”, but I don’t really care. I just do the easy the fast version.
y
Thank you so much for your explanation! Very very helpful!
116 Views