Tomohiro Nakagawa

08/10/2022, 10:22 PM
Hi everyone! I have a question to run
in prefect task. My flow runs in ECS cluster in prefect 1.2.0. I tried ShellTask and I got
Command failed with exit code 127
. The command I’m trying to run is something like this.
redis-cli -h myhost --scan --pattern "mypattern" | | xargs redis-cli -h myhost unlink
Is it possible to run this command using ShellTask? I tried to use `RedisExecute`as well but it complains about Secret, and i do not think my redis has password…Any help would be appreciated

Matt Conger

08/10/2022, 10:46 PM
Hi @Tomohiro Nakagawa The 127 error code indicates “command not found”. This occurs when any given command within your Bash script or on Bash command line is not found in any of the paths defined by PATH system environment variable. The solution is to make sure that the command your are using can be found within your $PATH. If the command is not in your path either include it or use absolute full path to it.
💯 1

Tomohiro Nakagawa

08/10/2022, 10:48 PM
hi matt, thank you. how do i set $PATH in ecs? do you have any example?

Khuyen Tran

08/10/2022, 10:52 PM
Does running
command on your terminal work?

Tomohiro Nakagawa

08/10/2022, 10:53 PM
command works on my terminal.
works too on my terminal

Anna Geller

08/11/2022, 12:02 AM
why do you run it as CLI commands rather than redis Python library? this tutorial showing how to use Redis might be helpful
If you run things on ECS, then they run within a container, from where you likely have no access to your Redis instance you can try running it without Prefect first on ECS to ensure the base setup works fine in a container and then move to Prefect to orchestrate
👍 1

Tomohiro Nakagawa

08/11/2022, 1:18 PM
i see thank you!
🙌 1