Does this PR only apply for Remote Storage blocks ...
# prefect-community
v
Does this PR only apply for Remote Storage blocks and not LocalFileSystem blocks? https://github.com/PrefectHQ/prefect/pull/6518
I ask because I’m trying to do something similar for LocalFileSystem in my deployments and it does not seem to be work (as in, only exact paths work)
@Anna Geller Would you happen to have an answer?
a
yes exactly, for local execution everything is on your computer so no need for blocks at all
v
We have an on-prem setup where the code is stored on a windows share in a mono-repo. Is there a convenient way to access sub-folders within the share for flow storage without creating blocks for every folder?
a
hmm I think you shouldn't have to worry about blocks at all when you leverage such local storage - those are likely displayed as anonymous blocks because they simply hold a reference to your flow path
v
when deploying the flow how do you reference storage?
a
when you create a deployment using local storage, you don't have to define any storage block at all, you can just do:
Copy code
# DEFAULT STORAGE & INFRASTRUCTURE: locally stored flow code + Local Process; -a stands for --apply; no upload is happening
prefect deployment build -n prod -q prod -a flows/healthcheck.py:healthcheck
prefect deployment build -n prod -q prod -a flows/parametrized.py:parametrized
prefect deployment build -n prod -q prod -a flows/hello.py:hello
v
thanks, maybe i was overcomplicating our setup
will try and get a simple version of this working and see if i run into any issues
just tried this and ran into the following error: "The system cannot find the path specified: 'G:\\ProjectsOnG\..."
When referencing the share it needs to be referenced in the following manner: "\\\\servername\\ProjectsOnG\\..."
Is there a way to let Prefect know that the path that the anonymous block should referrence should be something specific?
a
Interesting, there is nothing specific to this but I would encourage you to open a GitHub issue if this doesn't work for you as expected on a Windows Server.
The double slashes are expected and great you found it out
v
Ok, I think I’ve worked this out. You can explicitly set the path to the code location when building the deployment using the --path param or using the path variable in the build function (if using the python API). Now the anonymous block references “//servername/path/to/code/folder” and the entry point is something like “./flow.py:flow_name”
Thanks for pointing me in the right direction!
a
Great work!
v
It might help to add documentation under the build function of the Deployment class indicating that the path variable can be used to specify location of a locally stored flow as well. Currently it says this:
Copy code
path: str = typer.Option(
        None,
        "--path",
        help="An optional path to specify a subdirectory of remote storage to upload to."
👍 1
🙏 1
a
v
@Anna Geller Do you know why LocalFileStorage does not support relative paths like RemoteStorage?
a
because it's not a remote storage block and doesn't need to upload files - local storage assumes everything is local e.g. your laptop: your code is local, agent running locally, prefect installed locally, no need to upload anything to a remote location because the files are "in the computer" 😉
v
Maybe I’m missing a larger point. I understand the local nature of the block. I guess the question then is, why have a LocalFileStorage block at all if everything can be done strictly using local paths?
a
I'm AFK so can't check but don't treat local storage as block, ideally you shouldn't even have to use --path because you can specify the flow path in the build command i.e. the entrypoint