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

Jenny Yang

03/14/2024, 12:06 AM
I'm new to flyte and am planning to migrate code for a few different projects onto flyte. There are a few different workflows, but i want them to share some tasks. Is there a way to set up my flyte project to make this possible? I'm planning to make a common/ folder for the shared tasks, and then project1/, project2/, etc. I'm assuming that the entire directory would be packaged and registered when I want to execute a run. Which folders would I run pyflyte init and pyflyte create in?
k

Ketan (kumare3)

03/14/2024, 12:13 AM
you do not need to run pyflyte init if you dont want to
if you want multiple workflows to share tasks and the code to be co-located then
Copy code
src/ 
   __init__.py
   proj1/
       __init__.py
   proj2/
       __init__.py
   common/
       __init__.py
And then you can register in
Copy code
root/src> pyflyte register proj1 common
and then proj2 .. Another option is to use https://docs.flyte.org/en/latest/user_guide/productionizing/reference_tasks.html#reference-tasks
j

Jenny Yang

03/14/2024, 12:25 AM
Thats super helpful thanks! Is pyflyte create a required command? Also to use a reference_task, I would just write the function definition and leave the function itself empty?
k

Ketan (kumare3)

03/14/2024, 1:26 AM
Yup
You can also use flyteremote.fetch to retrieve the entity and not even create a rep
Requirements though is that you will need network access
2 Views