YSF
07/07/2023, 4:43 PM- 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'YSF
07/07/2023, 4:44 PMMarvin
07/07/2023, 4:44 PMcd
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:
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.Serina
07/07/2023, 4:50 PMset_working_directoy
pull step?
https://docs.prefect.io/2.10.18/concepts/deployments-ux/#the-pull-action
https://docs.prefect.io/2.10.18/api-ref/prefect/deployments/steps/pull/?h=set_working#prefect.deployments.steps.pull.set_working_directoryTaylor Curran
07/07/2023, 4:51 PMYSF
07/07/2023, 4:53 PMYSF
07/07/2023, 4:56 PM- prefect.deployments.steps.set_working_directory:
id: chdir
directory: my_working_dir
?Serina
07/07/2023, 4:57 PMYSF
07/07/2023, 4:57 PMSerina
07/07/2023, 4:57 PMid
field if you plan to use it in a downstream stepYSF
07/07/2023, 4:58 PMSerina
07/07/2023, 4:58 PMYSF
07/07/2023, 4:59 PMSerina
07/07/2023, 5:02 PMprefect.yaml
is in the same directory as myflow.py
, why do you want to change the directory?Serina
07/07/2023, 5:03 PMprefect.yaml
at the root of the myproject
dirTaylor Curran
07/07/2023, 5:03 PMYSF
07/07/2023, 5:04 PMYSF
07/07/2023, 5:05 PMTaylor Curran
07/07/2023, 5:06 PMSerina
07/07/2023, 5:08 PMChristopher Boyd
07/07/2023, 5:09 PMChristopher Boyd
07/07/2023, 5:10 PM