Skip to content
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

dbt --single-threaded rpc does not work #3211

Closed
1 of 5 tasks
drewbanin opened this issue Mar 30, 2021 · 2 comments
Closed
1 of 5 tasks

dbt --single-threaded rpc does not work #3211

drewbanin opened this issue Mar 30, 2021 · 2 comments
Assignees
Labels
bug Something isn't working rpc Issues related to dbt's RPC server

Comments

@drewbanin
Copy link
Contributor

Describe the bug

The dbt executable supports a flag called --single-threaded which is intended to bypass multithreading when building nodes (eg. models, seeds, whatever). The --single-threaded argument previously worked with the dbt rpc command, but it appears that there is now a regression!

Steps To Reproduce

Run the rpc server in single-threaded mode:

dbt --single-threaded rpc

Run a query against the server (this one does select 1 as id):

curl --location --request POST 'http://localhost:8580/jsonrpc' --header 'Content-Type: application/json' --data-raw '{
	"jsonrpc": "2.0",
	"method": "run_sql",
	"id": "123",
	"params": {
		"sql": "c2VsZWN0IDEgYXMgaWQ=",
        "name": "my_query"
	}
}'

This returns the following error:

{
    "error": {
        "code": -32000,
        "message": "Server Error",
        "data": {
            "type": "Exception",
            "message": "'Manifest' object has no attribute 'root_project'",
            "tags": null,
            "logs": [
                {
                    "timestamp": "2021-03-30T21:35:40.781048Z",
                    "message": "Acquiring new postgres connection \"rpc.debug.my_query\".",
                    "channel": "dbt",
                    "level": 10,
                    "levelname": "DEBUG",
                    "thread_name": "MainThread",
                    "process": 76144,
                    "extra": {
                        "request_id": "123",
                        "method": "run_sql",
                        "context": "request",
                        "addr": "127.0.0.1",
                        "http_method": "POST",
                        "run_state": "internal"
                    }
                },
                {
                    "timestamp": "2021-03-30T21:35:40.791030Z",
                    "message": "uncaught python exception",
                    "channel": "dbt",
                    "level": 14,
                    "levelname": "ERROR",
                    "thread_name": "MainThread",
                    "process": 76144,
                    "extra": {
                        "request_id": "123",
                        "method": "run_sql",
                        "context": "request",
                        "addr": "127.0.0.1",
                        "http_method": "POST",
                        "run_state": "internal"
                    },
                    "exc_info": "Traceback (most recent call last):\n  File \"/Users/drew/fishtown/dbt/core/dbt/rpc/task_handler.py\", line 94, in task_exec\n    result = self.task.handle_request()\n  File \"/Users/drew/fishtown/dbt/core/dbt/task/rpc/sql_commands.py\", line 162, in handle_request\n    node = self._get_exec_node()\n  File \"/Users/drew/fishtown/dbt/core/dbt/task/rpc/sql_commands.py\", line 123, in _get_exec_node\n    add_new_refs(\n  File \"/Users/drew/fishtown/dbt/core/dbt/task/rpc/sql_commands.py\", line 38, in add_new_refs\n    manifest = manifest.deepcopy()\n  File \"/Users/drew/fishtown/dbt/core/dbt/contracts/graph/manifest.py\", line 729, in deepcopy\n    selectors=self.root_project.manifest_selectors,\nAttributeError: 'Manifest' object has no attribute 'root_project'"
                }
            ]
        }
    },
    "id": "123",
    "jsonrpc": "2.0"
}

Expected behavior

I expect the request to succeed and return a successful response. I also expect the --single-threaded command to block until the query returns, then return a complete success response. This is (if I am recalling correctly) the intended behavior of the --single-threaded flag. This is a different behavior than the default which is to return a "task_id" immediately which can be polled for a response.

Screenshots and log output

Attached above

System information

Which database are you using dbt with?

  • postgres
  • redshift
  • bigquery
  • snowflake
  • other (specify: ____________)

The output of dbt --version:

0.19.0

Using current develop branch at commit 17e57f1e0b3

The operating system you're using: macOS

The output of python --version: 3.8.6

Additional context

Should this be a command-line flag (--single-threaded?) or should it be an option in the RPC request method like sync: true? Just a thought :)

@drewbanin drewbanin added bug Something isn't working triage labels Mar 30, 2021
@drewbanin drewbanin changed the title dbt --single-threaded rpc does not work dbt --single-threaded rpc does not work Mar 30, 2021
@gshank
Copy link
Contributor

gshank commented Mar 30, 2021

This is a regression due to changes for #2693. We don't have any test cases for the rpc single threaded option, and that's the only place that Manifest.deepcopy code is called.

@jtcohen6 jtcohen6 added rpc Issues related to dbt's RPC server and removed triage labels Mar 30, 2021
@gshank gshank self-assigned this Mar 31, 2021
@gshank
Copy link
Contributor

gshank commented Aug 20, 2021

This was fixed a few months back.

@gshank gshank closed this as completed Aug 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working rpc Issues related to dbt's RPC server
Projects
None yet
Development

No branches or pull requests

3 participants