Robin
04/15/2021, 4:48 PMERROR - prefect.DbtShellTask | Command failed with exit code 1
Any thoughts on what could be wrong or how to get further information and debug the flow are appreciated! 🙂Kevin Kho
log_stderr=True
to get the error?Robin
04/15/2021, 4:54 PMdbt run
works locally
• with prefect, dbt run
works neither locally nor in cloudKevin Kho
DbtShellTask
? Also try the log_stderr
.Robin
04/15/2021, 4:57 PMfrom prefect import Flow
from prefect.tasks.dbt import DbtShellTask
PROFILES = "."
with Flow("dbt_flow") as flow:
task = DbtShellTask(
environment="Deployment",
profiles_dir=PROFILES,
)(command="dbt debug")
flow.run()
where the dbt_flow.py
is in the dbt project folder where the dbt_project.yml
lies and profiles.yml
is in the same folderRobin
04/15/2021, 5:02 PMdbt_flow.py
from another folder by specifying --profiles-dir ../dbt_project
Kevin Kho
dbt_flow.py
is written in the FlowKevin Kho
Kevin Kho
flow.run()
? The task usage looks good to me. Let’s try the log_stderr=True
Robin
04/15/2021, 5:07 PMINFO - prefect.TaskRunner | FAIL signal raised: FAIL('Command failed with exit code 1')
Robin
04/15/2021, 5:09 PMUserWarning: Tasks were created but not added to the flow: {<Task: Task>}. This can occur when `Task` classes, including `Parameters`, are instantiated inside a `with flow:` block but not added to the flow either explicitly or as the input to another task. For more information, see <https://docs.prefect.io/core/advanced_tutorials/task-guide.html#adding-tasks-to-flows>.
next(self.gen)
Kevin Kho
profiles_dir
blank and use dbt debug
to see if that’ll work. It will create a profiles.yml
for you. We can try this and see if it works?Kevin Kho
Robin
04/15/2021, 5:25 PMKevin Kho
Robin
04/15/2021, 5:26 PMRobin
04/15/2021, 5:26 PMRobin
04/15/2021, 5:26 PMKevin Kho
task = DbtShellTask(
profile_name='default',
environment="Deployment",
profiles_dir="/tmp/",
return_all=True,
log_stderr=True
)
Kevin Kho
Robin
04/15/2021, 5:31 PMKevin Kho
dbbtt debug
? Just to see if you’ll get an error like dbbtt not found
Robin
04/15/2021, 5:33 PMRobin
04/15/2021, 5:33 PMRobin
04/15/2021, 5:33 PMShellTask
goes wrong? 🤔Kevin Kho
Kevin Kho
stream_output=True
Robin
04/15/2021, 5:43 PMRobin
04/15/2021, 5:44 PMcommand="ls"
or "dir" but not outputRobin
04/15/2021, 5:44 PMKevin Kho
ls
. I’m thinking the same. I’m on a mac. Are you on a linux or mac? There were changes to the ShellTask in 0.14.15 and 0.14.16 but I don’t think they should be relevant for this. Just checking, what Prefect version are you on?Kevin Kho
ls
?Robin
04/15/2021, 5:49 PMRobin
04/15/2021, 5:49 PMRobin
04/15/2021, 5:49 PMRobin
04/15/2021, 5:49 PMKevin Kho
Robin
04/15/2021, 5:51 PMKevin Kho
Robin
04/15/2021, 5:51 PMRobin
04/15/2021, 5:52 PMRobin
04/15/2021, 5:52 PMKevin Kho
Kevin Kho
bash
in PATH
on windowsRobin
04/15/2021, 5:53 PMRobin
04/15/2021, 5:54 PMKevin Kho
Kevin Kho
Robin
04/15/2021, 6:26 PMMichael Wedekindt
06/09/2021, 2:19 PMwith Flow(name="dbt_flow") as f:
task = DbtShellTask(
log_stderr=True,
log_stdout=True,
return_all=True,
stream_output=True,
profiles_dir=profile_path
)(command='dbt run --models myModel')
out = f.run()
That's the output
[2021-06-09 16:06:15+0200] INFO - prefect.FlowRunner | Beginning Flow run for 'dbt_flow'
[2021-06-09 16:06:15+0200] INFO - prefect.TaskRunner | Task 'DbtShellTask': Starting task run...
[2021-06-09 16:06:15+0200] INFO - prefect.DbtShellTask | /bin/bash: C:\Users\M7856~1.\AppData\Local\Temp\prefect-5yoqhqg_: No such file or directory
[2021-06-09 16:06:15+0200] ERROR - prefect.DbtShellTask | Command failed with exit code 127
[2021-06-09 16:06:15+0200] INFO - prefect.TaskRunner | FAIL signal raised: FAIL('Command failed with exit code 127')
[2021-06-09 16:06:15+0200] INFO - prefect.TaskRunner | Task 'DbtShellTask': Finished task run for task with final state: 'Failed'
[2021-06-09 16:06:15+0200] INFO - prefect.FlowRunner | Flow run FAILED: some reference tasks failed.
What I did wrong?
Thanks for help
Best MichaelKevin Kho
Kevin Kho
Michael Wedekindt
06/09/2021, 3:28 PMKevin Kho
Michael Wedekindt
06/09/2021, 3:32 PMMichael Wedekindt
06/09/2021, 3:32 PMKevin Kho
Michael Wedekindt
06/09/2021, 3:43 PMKevin Kho
Michael Wedekindt
06/09/2021, 4:26 PMMichael Wedekindt
06/09/2021, 4:26 PM