Hi! Perhaps silly question - I was so excited to s...
# ask-community
m
Hi! Perhaps silly question - I was so excited to see my first flow work out very well on Prefect Cloud, that I went on to register a second one - what I found is, it archives and overwrites the first flow. When I try to register the first flow, it again archives and overwrites. What am I doing wrong? I am creating flows using the with: context manager, I am calling them different names and even separate "projects". The flows come from different files. I went through the docs and couldn't find any note on that
e
That is weird, a flow should only be archived if a new flow with the same name and project is registered, maybe you are setting flow name or project wrong? I never heard of any problem where flow registers archive unrelated flows. Can you share some code, maybe we can spot an issue there.
upvote 1
m
Thanks, I thought that was weird too!
here goes, I changed the variables representing flows to
flow1
and
flow2
but they are in two separate files:
Flow 1
Copy code
VERSION = '1'

with Flow('RunScreen', schedule=schedule) as flow1:
    saved_screen_path = t_download_screen()
    final = t_upload_screen_to_onedrive(saved_screen_path)


if __name__ == "__main__":
    flow1.register(project_name="anonymous-automation", version_group_id=VERSION)
Flow 2
Copy code
VERSION = '1'

with Flow('EmailReports', schedule=schedule) as flow2:
    for l in labels:
        attachments_paths = t_download_attachments(l)
        t_upload_report_to_onedrive(l, attachments_paths)

if __name__ == "__main__":
    flow2.register(project_name="anonymous-automation", version_group_id=VERSION)
i've logged in to prefect cloud with my user token
running both of those scripts results in the same flow being overwritten, with a new version created in the cloud database. So the flow uuid shows as the same, but the name changes and the version bumps by 1, and the tasks get replaced.
z
version_group_id
is the unique id for a single ‘group’ of flows (that would generally be expected to be of the same name)
By setting that manually, you are forcing your flows into the same group so they’ll override
m
Thanks, I thought flows with different names would not get bundled together. So how does releasing a new version of a flow occur? Just by registering a new flow with the same name?
Thanks for solving my problem!
z
Yep that’s correct
1