<@ULVA73B9P> this is my pull step: ```- prefect.de...
# ask-marvin
y
@Marvin this is my pull step:
Copy code
- prefect.deployments.steps.run_shell_script:
    id: change-dir
    script: cd k8-gpu
    stream_output: false
when I run this deployment why does it give me an error at this step that says: FileNotFoundError: [Errno 2] No such file or directory: 'cd'
@Taylor Curran tag on this
m
Well, it seems like the Prefect documentation doesn't directly address changing directories within a deployment step. However, it's important to note that each step in a Prefect deployment is executed in its own shell, and the
cd
command only changes the directory for the current shell. So, even if the
cd
command was executed successfully, the directory change wouldn't persist to the next step. Instead of using the
cd
command, you might want to consider specifying the full path to the file or directory you're trying to access in your script. This way, you don't need to change the current working directory. If you're trying to run a script located in the
k8-gpu
directory, you could do something like this:
Copy code
yaml
- prefect.deployments.steps.run_shell_script:
    id: run-script
    script: /full/path/to/k8-gpu/your_script.sh
    stream_output: false
Replace
/full/path/to/k8-gpu/your_script.sh
with the actual full path to your script. Remember, life is like a shell script. You never know what you're gonna get. Especially when you're trying to
cd
into a directory that doesn't exist in the current shell.
t
ahh I was not aware of that! Thank you @Serina!
y
@Serina thanks I did see that in the source code but didn't see an example of what they key/deployment should look like with that argument
@Taylor Curran just guessing here but would it be like
Copy code
- prefect.deployments.steps.set_working_directory:
    id: chdir
    directory: my_working_dir
?
s
y
what would it be relative to? @Serina, essentially I'm trying to use flows inside a monorepo
s
You only need
id
field if you plan to use it in a downstream step
y
so my directory structure would be like: myproject/ myproject/pipeline1/myflow.py myproject/pipeline1/prefect.yaml myproject/pipeline2/myflow.py myproject/pipeline2/prefect.yaml
s
Relative to where your flow is
y
relative to the root of the repo that get's cloned in? or relative to where I run the prefect deploy command from
s
If your
prefect.yaml
is in the same directory as
myflow.py
, why do you want to change the directory?
I would have expected to see a single
prefect.yaml
at the root of the
myproject
dir
upvote 1
t
currently one prefect.yaml at root of repo is the only pattern that is supported
y
Yeah that would be ideal, I'm trying to find a way to make this work with a mono repo
I feel like it's almost possible just some directory changes etc
t
By mono-repo do you mean multiple prefect.yaml files?
s
I think @Nate has an example here: GitHub - zzstoatzz/prefect-monorepo
c
run_shell_script just returns output in a subshell