Hi. I'm having an issue using a `LocalRun` flow's ...
# ask-community
c
Hi. I'm having an issue using a
LocalRun
flow's
working_dir
parameter. Whenever I specify the following:
flow.run_config = LocalRun(_working_dir_='C:/scripts/GetADUsers', _labels_=["SVRBIPTH01"])
Whenever I register the flow (I'm using Prefect 1.2.0 on MacOS python 3.10) I get the following working_dir on the UI of Prefect Cloud:
/Users/carloscueto/Documents/Python_Scripts/Prefect-Flows/PowerShell/GetADUsers/C:/scripts/GetADUsers
It seems to be adding the path from where I register the script from (on the local machine) to the working_dir string I specified on the run_config. Has anybody encountered this before? Everything works fine when I register the flow from a Windows computer.
1
k
This path is more related to storage than RunConfig. Did you define a storage?
Have you seen this ? It’s a bit related. You can also used
stored_as_script=True
and point to the
path
with LocalStorage
a
Kevin is right, it's mainly about storage. When you register via CLI, you don't even need to specify storage and local run label, you can just do:
Copy code
from prefect import task, Flow


@task(log_stdout=True)
def hello_world():
    print("hello world")


with Flow("hello") as flow:
    hw = hello_world()
then register via CLI:
Copy code
prefect register --project xxx -p hw.py
this will automatically add storage and run config host name labels
c
I also specified storage, just didn't include that line of code in my question. I am using Git storage with stored_as_script=true. Either way, what is really weird is how registering on MacOS causes this issue and when registering in Windows it's all fine.
k
I don’t think it’s right to say “registering on MacOS causes the issue”. I think you’ll run into it the other way around as well if you register on Windows and try to run on MacOS
s
I encounter similar issue. I register my flow in linux and run in Windows as LocalRun. Working directory path value override my default working_dir value.
k
Is it the working directory that is overriden or storage? Can I see your storage definition?
s
flow_storage = Git( repo="MYORG/DataBI/_git/ProcessTabular", flow_path="./tabular_flow.py", repo_host="MYORG@dev.azure.com", branch_name="main", git_clone_url_secret_name="processtabular_git_url" ) with Flow("ProcessTabular", executor=LocalDaskExecutor(scheduler="threads"), result=LocalResult(), storage=flow_storage, run_config=LocalRun(working_dir="C:/prefect/agent") ) as flow:
k
Ah and then what your working dir become?
s
k
Ah man I see yes this is an issue. Could you open one on Github with what you’ve showed me?
s
Issue#5810
k
Thank you so much!
101 Views