https://prefect.io logo
Title
s

Scott McCallen

11/09/2022, 10:25 PM
Hello! I am using Prefect 1.x and store my flows using the Git storage option. I’m trying to “load additional files” from the repo using the steps from the storage docs under Loading Additional Files with Git Storage. However, the file I am looking for isn’t on the file system and I get a “FileNotFoundError: [Errno 2] No such file or directory” error. Looking at the source code for Prefect 1.4.0, the Git storage implementation uses a ‘TemporaryGitRepo’ object to get the flow definition - see line 148 here https://github.com/PrefectHQ/prefect/blob/1.4.0/src/prefect/storage/git.py#L148) which seems like it deletes the repo contents from the file system after reading the flow definition file. I think I’m following the docs correctly, but I might be missing something. I’d appreciate any help and/or suggestions on what to try. Thanks in advance!
1
r

Rob Freedy

11/10/2022, 3:44 PM
Hey @Scott McCallen!! Would you be able to share a minimal example of how you are configuring the Git storage as well as how you are retrieving the file path for the additional file?
b

Bradley Hurley

11/10/2022, 7:33 PM
Scott and I worked together and figured out what was going on. The content of the cloned repo is only available while the flow object is being created, and not at flow runtime. If you want to use an additional file from a repo you have to read the file contents and store it as a variable, and then use that variable in a task.
👍 1