https://prefect.io logo
v

Vu

06/27/2023, 7:24 PM
Hi, I am stuck with an issue when running
dbt test
with
trigger_dbt_cli_command
. Hope someone can share some insights. In prefect 1, I used
DbtShellTask
to run
dbt test
, it always returns a full log even when some tests fail. This log is used to populate a performance tracking table, which is important to us. Now in prefect 2, we have to switch to
trigger_dbt_cli_command
, and this, when any test fails, return RuntimeError (a snippet in comment section). If I put the task in a try/except block, the flow can continue, but still, I am not able to get the log.
Copy code
12:21:06.738 | ERROR   | Task run 'trigger_dbt_cli_command-1' - Encountered exception during execution:
Traceback (most recent call last):
  File "/Users/vu/codes/prefect2-env/lib/python3.9/site-packages/prefect/engine.py", line 1655, in orchestrate_task_run
    result = await call.aresult()
  File "/Users/vu/codes/prefect2-env/lib/python3.9/site-packages/prefect/_internal/concurrency/calls.py", line 292, in aresult
    return await asyncio.wrap_future(self.future)
  File "/Users/vu/codes/prefect2-env/lib/python3.9/site-packages/prefect/_internal/concurrency/calls.py", line 346, in _run_async
    result = await coro
  File "/Users/vu/codes/prefect2-env/lib/python3.9/site-packages/prefect_dbt/cli/commands.py", line 154, in trigger_dbt_cli_command
    result = await shell_run_command.fn(command=command, **shell_run_command_kwargs)
  File "/Users/vu/codes/prefect2-env/lib/python3.9/site-packages/prefect_shell/commands.py", line 114, in shell_run_command
    raise RuntimeError(msg)
RuntimeError: Command failed with exit code 1:
19:21:05  Done. PASS=2 WARN=1 ERROR=1 SKIP=0 TOTAL=4
3 Views