-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error on running on parallel #3
Comments
Hi @jrpereirajr ! can you share a little more about the transformations envisaged by your dbt project? |
Hi Benjamin! I didn't created that table. I think it was created by the dbt-iris plugin because I found this file in the directory /* create_view_as */
create table "customer1_dbt"."stg_ordem_servico__dbt_tmp" as
with
source as (
select
OriginalId,
... Note that the name of the table is the same presented in the error message - This is the model SQL file that generated the statement mentioned early: {{
config(
materialized='view'
)
}}
with
source as (
select
OriginalId,
SessionId,
Codigo
from {{source('shift_lis', 'Order')}}
),
renamed as (
select
OriginalId as EntityId,
SessionId,
Codigo
current_timestamp(3) as LastModified
from source
)
select * from renamed Thank you! |
Hi, it looks like running multiple jobs concurrently may not be an intended pattern, at least from (not finding much in the dbt docs) this thread: dbt-labs/dbt-core#2881 |
Yes, I think we can make this too |
Hi @daimor , do you have any news about this issue? |
Sorry, I did not have a chance to look yet. |
Hi guys! Do you have any updates? |
I've released a new version, also with upgrade to the latest dbt |
Hi @daimor. Thank you for your response. After installing version v1.8.17, bash was not able to find dbt command. By issuing a dbt command, I've getting this error: This was I used to test it into a container:
requirements.txt:
After downgrading to version v1.5.7, it went back to work:
Did I miss something? |
dbt-core, in the latest version not a functional requirement for dbt-iris itself |
Hi @daimor. Thank you for installing instructions. By installing dbt-core first and then dbt-iris I was able to run dbt again. However, after installing dbt 1.8.18 I'm now getting the following error on concurrent executions: As you can see, I opened two shell sessions and tried to execute the same |
any chance you'd be able to show more of the generated SQL? You can use |
Hi @bdeboe, Sorry for the delay, I was on PTO. |
I think it would be helpful to verify if the generated SQL uses different table names for both invocations, as I believe @daimor intended with his change. If not, we need to look into the model file to see if perhaps the materialization option isn't what the code expects it to be (could well be the code that needs to change, of course). |
Hi @bdeboe I sent you the files into your e-mail. Thanks! |
Hi @jrpereirajr , My apologies for the long delay in responding. I received this while traveling and had forgotten about it by the time I got back. Now having taken a closer look I’m wondering what the actual table name is that is referenced in the error message (scrubbed from your screenshot). Any modules with materialized=’view’ will in practice result in the following sequence of statements, in which “tab” is the name of the table (module) being created and 122334 is a hash to avoid collisions between processes: DROP TABLE IF EXISTS tab_122334;
CREATE TABLE tab_122334 AS SELECT … ;
DROP TABLE IF EXISTS tab__dbt_backup;
ALTER TABLE tab RENAME tab__dbt_backup;
DROP TABLE IF EXISTS tab;
ALTER TABLE tab_122334 RENAME tab;
DROP TABLE IF EXISTS tab__dbt_backup; Because there is no Either way, I think eventually you'll want to build some concurrency control into your flow, for example using the Thanks, |
Hi @bdeboe! No need to apologies. :) As "full error message", I understood running the same test again (as described here), but this time with --debug flag. So, I ran it again and sent you the outputs. Please, let me know if I was correct. In the meanwhile I'll try your suggestion regarding the macro with LOCK command. Thanks! |
Hi @jrpereirajr , Thanks for your prompt reply.
This might be another manifestation of the same thing: that the two processes are trying to swap the tables at the same time. You'd get this error when the ALTER TABLE statements happen at the same time, and the earlier "Table not found" error when one process' ALTER TABLE or DROP TABLE already completed right when the second process gets to it. I suppose there's no developers accessing the system while dbt is running? Either way, using locking in a macro should help avoid the error and offer some level of control. I think we can also consider adding locking in the dbt-iris implementation, and automatically taking and releasing locks at the start/end of a model's execution. It's not a silver bullet though, because in a view or table materialization, you risk replacing your table with one that's slightly older when two processes overtake one another. Say you have a model A that builds a staging table and a model B that uses table materialization to build the final result. Even if you use locking within the model, there's a risk:
Some form of incremental logic is likely safer when you risk having concurrent processes. |
Hi!
I have set up a Proof of Concept (PoC) that calls the dbt run command after ingesting some data. The ingestion process is executed using an IRIS Interoperability Production. Since this production invokes its hosts asynchronously, multiple dbt run commands are issued concurrently.
To provide a visual representation of this production, please refer to the following image:
In order to increase throughput, I have adjusted the pool size of the host that issues the dbt run command to allow concurrent calls. However, after making this adjustment, dbt-iris started logging error messages like the following:
I think the cause is dbt-iris always try to create a new table with the same name, because there are many dbt process running in parallel due serveral interoperability BOs running in parallel as well.
I would like to know if this indicates a misuse of dbt and dbt-iris or if there is an underlying issue.
Thanks!
The text was updated successfully, but these errors were encountered: