https://dagster.io/ logo
#ask-community
Title
# ask-community
l

Lewis Baker

02/07/2023, 2:16 PM
Running dbt-deps in Dagster Cloud 🧵
Hello, I’m currently running a PoC for dagster cloud. I’m running into an issue running dbt deps before a build.
Considerations: 1. I’m not using Docker 2. I’m running Serverless
It doesn’t seem like there’s an obvious way to call dbt deps before the build. I have looked into creating a .sh script to run dbt deps using lifecycle-hooks without any success (https://docs.dagster.io/dagster-cloud/deployment/serverless#lifecycle-hooks)
a

Adam Bloom

02/07/2023, 2:25 PM
You’re definitely thinking along the right track! Skimming those docs, you’d want the post install hook.
l

Lewis Baker

02/07/2023, 2:57 PM
No luck with post_install / pre_install shell scripts. I’m running it similarly to how you would within Docker without the same success. I just have a dagster_cloud_post_install.sh file with the following command:
Copy code
RUN (cd ./dbt_project/; dbt deps --profiles-dir ./dbt_project/config/profiles.yml)
I’m also finding the error logs in Dagster Cloud quite ambiguous which is making it hard to debug
a

Adam Bloom

02/07/2023, 3:16 PM
those are just shell scripts, so you'd want to follow normal shell/bash semantics - what you have inside your RUN () block would probably work.
cd ./dbt_project/; dbt deps --profiles-dir ./dbt_project/config/profiles.yml
l

Lewis Baker

02/07/2023, 4:33 PM
Still no luck, unfortunately. Even if I just try and echo using a hook, it doesn’t echo it in the cloud log
image.png
It’d be great if the cloud provided richer error logs. Adam, have you had success using hook before?
Mine are in the root of the repo
a

Adam Bloom

02/07/2023, 4:35 PM
I'm not using dagster cloud - using dagster and dbt in a k8s deployment
l

Lewis Baker

02/07/2023, 4:38 PM
Okay, thanks for that. I’ll wait to see if Dagster support get back to me and in the meantime look into an alternative approach
a

Adam Bloom

02/07/2023, 4:51 PM
only other suggestion is to run
chmod +x dagster_cloud_post_install.sh
and try running it locally
./dagster_cloud_post_install.sh
to make sure it runs as you expect
s

Sean Lopp

02/08/2023, 4:55 AM
I’d echo Adam’s suggestions. This command is run in the GitHub build so you’d see the echo or other command output there (in the actions tab) not in dagster cloud. A couple other things jump out: 1. Be sure you have disabled fast deploys by modifying the setting within the .github/workflows/deploy.yaml file 2. You don’t need the RUN bit, the lifecycle hook is just a shell script that we execute and add the RUN command too. So you can just have the command itself 3. The —profiles-dir flag should point to the config directory not the profiles file within it definitely do the chmod command Adam listed before committing that script Let us know if this doesn’t resolve the issue, and it’d be great to see the logs from the github actions side
l

Lewis Baker

02/08/2023, 10:26 AM
I disabled the fast deploy which has resolve the first error in github actions
I now get this error
It even occurs when just running a echo as a test
@Sean Lopp Tracing the error back, there’s a permission denied error that’s interesting
a

Adam Bloom

02/08/2023, 2:05 PM
Did you run
chmod +x
on that file? You’ll need to commit the change afterwards
1
(That modifies permissions on the file to make it executable, if you aren’t familiar with that command)
l

Lewis Baker

02/08/2023, 3:35 PM
@Adam Bloom That worked in a local set-up 👍 Thanks @Sean Lopp Any guidance on how I could mirror this in the cloud set-up and run
chmod +x
before the post install hook?
a

Adam Bloom

02/08/2023, 3:36 PM
Did you commit and push? You shouldn’t need to run that in actions - it’s part of the file metadata stored in git
👆 1
s

Sean Lopp

02/08/2023, 3:41 PM
If took me a hot minute the first time too. But as Adam says, if you do
Copy code
git status
After running the
chmod
command you'll see that the shell script has been updated (even though the contents are the same). You'll want to add that file, commit, and push the result. Then the action should be happy. Unfortunately some git clients don't show this change as a file modification, but the manual git commands will work
Added https://github.com/dagster-io/dagster/discussions/12180 to hopefully make this resolution more Google-able
l

Lewis Baker

02/08/2023, 4:26 PM
@Adam Bloom @Sean Lopp That’s worked perfectly, thank you. The time you have spent on this is very much appreciated, thanks again
🙌 1
3 Views