-
Notifications
You must be signed in to change notification settings - Fork 119
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
Long sessions #517
Long sessions #517
Conversation
Added USE_LONG_SESSIONS flag. Extended Connection with DatabricksDBTConnection. Added properties acquire_release_count and last_used_time. Updated DatabricksConnectionManager.set_connection_name to create instance of DatabricksDBTConnection and update new properties. Override ConnectionManager.release to not close the session and to update the new connection properties. Signed-off-by: Raymond Cypher <[email protected]>
Added new connection pool (threads_compute_connections) to DatabricksConnectionManager. It is a map of thread ID to map of compute name to DatabricksDBTConnection. Updated DatabricksConnectionManager.set_connection_name() to look for existing connections in the new pool and then update the existing thread_connections connection pool. Overrode cleanup_all in DatabricksConnectionManager to fire events based on the connection acquire/release count, rather than the connection state. Signed-off-by: Raymond Cypher <[email protected]>
Added _start_using and _stop_using to DatabricksDBTConnection. These handle logging, last_used_time, and acquire_release_count. Moved long session specific code from DatabricksConnectionManager.set_connection_name to its own method. Refactoring and renaming of the long session code. Signed-off-by: Raymond Cypher <[email protected]>
Signed-off-by: Raymond Cypher <[email protected]>
Signed-off-by: Raymond Cypher <[email protected]>
Signed-off-by: Raymond Cypher <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor comments, overall looks good.
Use ConnectionState constants instead of string literals. Use assert instead of throwing an exception if in unexpected code path when USE_LONG_SESSIONS=False Added long session test with warehouse per model Signed-off-by: Raymond Cypher <[email protected]>
Added default max idle time of 600 seconds. Added code to read user specified max idle time from profile or from alternate compute definitions. Updated DatabricksDBTConnection with connect_max_idle property and helper functions to determine if the connection should be cleaned up. In DatabricksConnectionManager added _cleanup_idle_connections(). This is called whenever a connection is acquired for use. Added a new class method _open2() to DatabricksConnectionManager. This is used with USE_LONG_SESSIONS is true and uses the http_path property of DatabricksDBTConnection. Signed-off-by: Raymond Cypher <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please review comments. Overall looks good, but would like clarification on the counter, and consider refactor the open functionality to be injectable.
Resolves #
Description
Checklist
CHANGELOG.md
and added information about my change to the "dbt-databricks next" section.