https://prefect.io logo
Title
c

Cody Frisby

04/24/2023, 8:05 PM
Hi! We are noticing that
build_from_flow
uploads the entire directory to storage rather than just the file that we want to deploy. Is there a workaround for this? We'd like to just upload the single file rather than the entire directory.... Thanks!
1
r

redsquare

04/24/2023, 8:32 PM
have you got a .prefectignore file
c

Cody Frisby

04/24/2023, 8:33 PM
Yes. We have that file.
r

redsquare

04/24/2023, 8:35 PM
as the root of this folder?
c

Cody Frisby

04/24/2023, 8:36 PM
The
.prefectignore
file is in the root of the project/folder, yes.
n

Nate

04/24/2023, 9:03 PM
sorry if this is a silly question @Cody Frisby but do you have the patterns you want to avoid uploading defined in the
.prefectignore
file?
c

Cody Frisby

04/24/2023, 9:05 PM
Maybe my question isn't clear. We are noticing that when we run something like
python /path/to/flow.py --deploy
that is uploads the entire directory to cloud storage. Whereas we would expect Prefect's
build_from_flow
to only upload the
flow.py
file to cloud storage and not the entire directory other than what is in the
.prefectignore
file.
n

Nate

04/24/2023, 9:07 PM
By default, Prefect uploads all files in the current folder to the configured storage location (local by default) when you build a deployment.
If you want to omit certain files or directories from your deployments, add a
.prefectignore
file to the root directory.
.prefectignore
enables users to omit certain files or directories from their deployments.
Similar to other
.ignore
files, the syntax supports pattern matching, so an entry of
*.pyc
will ensure all
.pyc
files are ignored by the deployment call when uploading to remote storage.
from the docs, all files in the current folder will be uploaded - so you have to define patterns (like gitignore) in the .prefectignore file that you do not want to be uploaded
does that answer your question?
c

Cody Frisby

04/24/2023, 9:09 PM
Yep. I guess there's not an option to ONLY upload the file in the command. Thanks for your help!
👍 1
n

Nate

04/24/2023, 9:10 PM
I see, i think you're right - don't believe there's an option for that right now