{"action":"created","comment":{"url":"https://api.github.com/repos/airbnb/airflow/pulls/comments/53393438","id":53393438,"diff_hunk":"@@ -775,3 +786,33 @@ def logger(self):\n             self._logger = logging.root.getChild(self.__class__.__module__ + '.' +self.__class__.__name__)\n             return self._logger\n \n+\n+def get_sqla_engine(pool_size=5, pool_recycle=3600):\n+    \"\"\"\n+    Get a sqlalchemy engine object, pass pool_size=0 to get an engine\n+    without a connection pool.\n+    \"\"\"\n+    CONN = settings.SQL_ALCHEMY_CONN\n+    engine_args = {}\n+    if 'sqlite' not in CONN and pool_size:\n+        # Engine args not supported by sqlite","path":"airflow/utils.py","position":91,"original_position":91,"commit_id":"c28d9add6f54a6dad96e751e2a7137909e4c8abf","original_commit_id":"c28d9add6f54a6dad96e751e2a7137909e4c8abf","user":{"login":"aoen","id":1592778,"avatar_url":"https://avatars.githubusercontent.com/u/1592778?v=3","gravatar_id":"","url":"https://api.github.com/users/aoen","html_url":"https://github.com/aoen","followers_url":"https://api.github.com/users/aoen/followers","following_url":"https://api.github.com/users/aoen/following{/other_user}","gists_url":"https://api.github.com/users/aoen/gists{/gist_id}","starred_url":"https://api.github.com/users/aoen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aoen/subscriptions","organizations_url":"https://api.github.com/users/aoen/orgs","repos_url":"https://api.github.com/users/aoen/repos","events_url":"https://api.github.com/users/aoen/events{/privacy}","received_events_url":"https://api.github.com/users/aoen/received_events","type":"User","site_admin":false},"body":"I'm curious why NullPool for sqllite instead of the default SingletonThreadPool: http://docs.sqlalchemy.org/en/latest/dialects/sqlite.html","created_at":"2016-02-18T22:29:02Z","updated_at":"2016-02-18T22:29:02Z","html_url":"https://github.com/airbnb/airflow/pull/1021#discussion_r53393438","pull_request_url":"https://api.github.com/repos/airbnb/airflow/pulls/1021","_links":{"self":{"href":"https://api.github.com/repos/airbnb/airflow/pulls/comments/53393438"},"html":{"href":"https://github.com/airbnb/airflow/pull/1021#discussion_r53393438"},"pull_request":{"href":"https://api.github.com/repos/airbnb/airflow/pulls/1021"}}},"pull_request":{"url":"https://api.github.com/repos/airbnb/airflow/pulls/1021","id":59686468,"html_url":"https://github.com/airbnb/airflow/pull/1021","diff_url":"https://github.com/airbnb/airflow/pull/1021.diff","patch_url":"https://github.com/airbnb/airflow/pull/1021.patch","issue_url":"https://api.github.com/repos/airbnb/airflow/issues/1021","number":1021,"state":"open","locked":false,"title":"Making `airflow run` not use a db connection pool","user":{"login":"mistercrunch","id":487433,"avatar_url":"https://avatars.githubusercontent.com/u/487433?v=3","gravatar_id":"","url":"https://api.github.com/users/mistercrunch","html_url":"https://github.com/mistercrunch","followers_url":"https://api.github.com/users/mistercrunch/followers","following_url":"https://api.github.com/users/mistercrunch/following{/other_user}","gists_url":"https://api.github.com/users/mistercrunch/gists{/gist_id}","starred_url":"https://api.github.com/users/mistercrunch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mistercrunch/subscriptions","organizations_url":"https://api.github.com/users/mistercrunch/orgs","repos_url":"https://api.github.com/users/mistercrunch/repos","events_url":"https://api.github.com/users/mistercrunch/events{/privacy}","received_events_url":"https://api.github.com/users/mistercrunch/received_events","type":"User","site_admin":false},"body":"The goal here is to reduce the number of active database sessions on the metadata database. Note that sqla create database connection pools and that when we have thousands of tasks emitting heartbeats it can lead to way too many connections, ultimately maxing out on the MySQL side. #1002 describes the issue.\r\n\r\nThis PR includes:\r\n* A refactor where `Session` and `engine` sqla objects live in `airflow` instead of `airflow.settings` (those objects really aren't settings, they're just widely used objects)\r\n* Some `airflow.utils` functions to set a NullPool engine in place of the QueuePool engine\r\n* call for `airflow run` to use the NullPool\r\n* Fixing the unit tests to run with LocalExecutor (had to disable the timeout feature)","created_at":"2016-02-17T18:23:31Z","updated_at":"2016-02-18T22:29:02Z","closed_at":null,"merged_at":null,"merge_commit_sha":"75b50dc3020a0939fdad6987a847f8a14d04c167","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/airbnb/airflow/pulls/1021/commits","review_comments_url":"https://api.github.com/repos/airbnb/airflow/pulls/1021/comments","review_comment_url":"https://api.github.com/repos/airbnb/airflow/pulls/comments{/number}","comments_url":"https://api.github.com/repos/airbnb/airflow/issues/1021/comments","statuses_url":"https://api.github.com/repos/airbnb/airflow/statuses/c28d9add6f54a6dad96e751e2a7137909e4c8abf","head":{"label":"airbnb:nopool","ref":"nopool","sha":"c28d9add6f54a6dad96e751e2a7137909e4c8abf","user":{"login":"airbnb","id":698437,"avatar_url":"https://avatars.githubusercontent.com/u/698437?v=3","gravatar_id":"","url":"https://api.github.com/users/airbnb","html_url":"https://github.com/airbnb","followers_url":"https://api.github.com/users/airbnb/followers","following_url":"https://api.github.com/users/airbnb/following{/other_user}","gists_url":"https://api.github.com/users/airbnb/gists{/gist_id}","starred_url":"https://api.github.com/users/airbnb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/airbnb/subscriptions","organizations_url":"https://api.github.com/users/airbnb/orgs","repos_url":"https://api.github.com/users/airbnb/repos","events_url":"https://api.github.com/users/airbnb/events{/privacy}","received_events_url":"https://api.github.com/users/airbnb/received_events","type":"Organization","site_admin":false},"repo":{"id":33884891,"name":"airflow","full_name":"airbnb/airflow","owner":{"login":"airbnb","id":698437,"avatar_url":"https://avatars.githubusercontent.com/u/698437?v=3","gravatar_id":"","url":"https://api.github.com/users/airbnb","html_url":"https://github.com/airbnb","followers_url":"https://api.github.com/users/airbnb/followers","following_url":"https://api.github.com/users/airbnb/following{/other_user}","gists_url":"https://api.github.com/users/airbnb/gists{/gist_id}","starred_url":"https://api.github.com/users/airbnb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/airbnb/subscriptions","organizations_url":"https://api.github.com/users/airbnb/orgs","repos_url":"https://api.github.com/users/airbnb/repos","events_url":"https://api.github.com/users/airbnb/events{/privacy}","received_events_url":"https://api.github.com/users/airbnb/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/airbnb/airflow","description":"Airflow is a system to programmatically author, schedule and monitor data pipelines.","fork":false,"url":"https://api.github.com/repos/airbnb/airflow","forks_url":"https://api.github.com/repos/airbnb/airflow/forks","keys_url":"https://api.github.com/repos/airbnb/airflow/keys{/key_id}","collaborators_url":"https://api.github.com/repos/airbnb/airflow/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/airbnb/airflow/teams","hooks_url":"https://api.github.com/repos/airbnb/airflow/hooks","issue_events_url":"https://api.github.com/repos/airbnb/airflow/issues/events{/number}","events_url":"https://api.github.com/repos/airbnb/airflow/events","assignees_url":"https://api.github.com/repos/airbnb/airflow/assignees{/user}","branches_url":"https://api.github.com/repos/airbnb/airflow/branches{/branch}","tags_url":"https://api.github.com/repos/airbnb/airflow/tags","blobs_url":"https://api.github.com/repos/airbnb/airflow/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/airbnb/airflow/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/airbnb/airflow/git/refs{/sha}","trees_url":"https://api.github.com/repos/airbnb/airflow/git/trees{/sha}","statuses_url":"https://api.github.com/repos/airbnb/airflow/statuses/{sha}","languages_url":"https://api.github.com/repos/airbnb/airflow/languages","stargazers_url":"https://api.github.com/repos/airbnb/airflow/stargazers","contributors_url":"https://api.github.com/repos/airbnb/airflow/contributors","subscribers_url":"https://api.github.com/repos/airbnb/airflow/subscribers","subscription_url":"https://api.github.com/repos/airbnb/airflow/subscription","commits_url":"https://api.github.com/repos/airbnb/airflow/commits{/sha}","git_commits_url":"https://api.github.com/repos/airbnb/airflow/git/commits{/sha}","comments_url":"https://api.github.com/repos/airbnb/airflow/comments{/number}","issue_comment_url":"https://api.github.com/repos/airbnb/airflow/issues/comments{/number}","contents_url":"https://api.github.com/repos/airbnb/airflow/contents/{+path}","compare_url":"https://api.github.com/repos/airbnb/airflow/compare/{base}...{head}","merges_url":"https://api.github.com/repos/airbnb/airflow/merges","archive_url":"https://api.github.com/repos/airbnb/airflow/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/airbnb/airflow/downloads","issues_url":"https://api.github.com/repos/airbnb/airflow/issues{/number}","pulls_url":"https://api.github.com/repos/airbnb/airflow/pulls{/number}","milestones_url":"https://api.github.com/repos/airbnb/airflow/milestones{/number}","notifications_url":"https://api.github.com/repos/airbnb/airflow/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/airbnb/airflow/labels{/name}","releases_url":"https://api.github.com/repos/airbnb/airflow/releases{/id}","deployments_url":"https://api.github.com/repos/airbnb/airflow/deployments","created_at":"2015-04-13T18:04:58Z","updated_at":"2016-02-18T20:16:01Z","pushed_at":"2016-02-18T06:19:54Z","git_url":"git://github.com/airbnb/airflow.git","ssh_url":"git@github.com:airbnb/airflow.git","clone_url":"https://github.com/airbnb/airflow.git","svn_url":"https://github.com/airbnb/airflow","homepage":"","size":8925,"stargazers_count":1943,"watchers_count":1943,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":362,"mirror_url":null,"open_issues_count":169,"forks":362,"open_issues":169,"watchers":1943,"default_branch":"master"}},"base":{"label":"airbnb:master","ref":"master","sha":"5d3161506ff5632188d472d63581a9680d109100","user":{"login":"airbnb","id":698437,"avatar_url":"https://avatars.githubusercontent.com/u/698437?v=3","gravatar_id":"","url":"https://api.github.com/users/airbnb","html_url":"https://github.com/airbnb","followers_url":"https://api.github.com/users/airbnb/followers","following_url":"https://api.github.com/users/airbnb/following{/other_user}","gists_url":"https://api.github.com/users/airbnb/gists{/gist_id}","starred_url":"https://api.github.com/users/airbnb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/airbnb/subscriptions","organizations_url":"https://api.github.com/users/airbnb/orgs","repos_url":"https://api.github.com/users/airbnb/repos","events_url":"https://api.github.com/users/airbnb/events{/privacy}","received_events_url":"https://api.github.com/users/airbnb/received_events","type":"Organization","site_admin":false},"repo":{"id":33884891,"name":"airflow","full_name":"airbnb/airflow","owner":{"login":"airbnb","id":698437,"avatar_url":"https://avatars.githubusercontent.com/u/698437?v=3","gravatar_id":"","url":"https://api.github.com/users/airbnb","html_url":"https://github.com/airbnb","followers_url":"https://api.github.com/users/airbnb/followers","following_url":"https://api.github.com/users/airbnb/following{/other_user}","gists_url":"https://api.github.com/users/airbnb/gists{/gist_id}","starred_url":"https://api.github.com/users/airbnb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/airbnb/subscriptions","organizations_url":"https://api.github.com/users/airbnb/orgs","repos_url":"https://api.github.com/users/airbnb/repos","events_url":"https://api.github.com/users/airbnb/events{/privacy}","received_events_url":"https://api.github.com/users/airbnb/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/airbnb/airflow","description":"Airflow is a system to programmatically author, schedule and monitor data pipelines.","fork":false,"url":"https://api.github.com/repos/airbnb/airflow","forks_url":"https://api.github.com/repos/airbnb/airflow/forks","keys_url":"https://api.github.com/repos/airbnb/airflow/keys{/key_id}","collaborators_url":"https://api.github.com/repos/airbnb/airflow/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/airbnb/airflow/teams","hooks_url":"https://api.github.com/repos/airbnb/airflow/hooks","issue_events_url":"https://api.github.com/repos/airbnb/airflow/issues/events{/number}","events_url":"https://api.github.com/repos/airbnb/airflow/events","assignees_url":"https://api.github.com/repos/airbnb/airflow/assignees{/user}","branches_url":"https://api.github.com/repos/airbnb/airflow/branches{/branch}","tags_url":"https://api.github.com/repos/airbnb/airflow/tags","blobs_url":"https://api.github.com/repos/airbnb/airflow/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/airbnb/airflow/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/airbnb/airflow/git/refs{/sha}","trees_url":"https://api.github.com/repos/airbnb/airflow/git/trees{/sha}","statuses_url":"https://api.github.com/repos/airbnb/airflow/statuses/{sha}","languages_url":"https://api.github.com/repos/airbnb/airflow/languages","stargazers_url":"https://api.github.com/repos/airbnb/airflow/stargazers","contributors_url":"https://api.github.com/repos/airbnb/airflow/contributors","subscribers_url":"https://api.github.com/repos/airbnb/airflow/subscribers","subscription_url":"https://api.github.com/repos/airbnb/airflow/subscription","commits_url":"https://api.github.com/repos/airbnb/airflow/commits{/sha}","git_commits_url":"https://api.github.com/repos/airbnb/airflow/git/commits{/sha}","comments_url":"https://api.github.com/repos/airbnb/airflow/comments{/number}","issue_comment_url":"https://api.github.com/repos/airbnb/airflow/issues/comments{/number}","contents_url":"https://api.github.com/repos/airbnb/airflow/contents/{+path}","compare_url":"https://api.github.com/repos/airbnb/airflow/compare/{base}...{head}","merges_url":"https://api.github.com/repos/airbnb/airflow/merges","archive_url":"https://api.github.com/repos/airbnb/airflow/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/airbnb/airflow/downloads","issues_url":"https://api.github.com/repos/airbnb/airflow/issues{/number}","pulls_url":"https://api.github.com/repos/airbnb/airflow/pulls{/number}","milestones_url":"https://api.github.com/repos/airbnb/airflow/milestones{/number}","notifications_url":"https://api.github.com/repos/airbnb/airflow/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/airbnb/airflow/labels{/name}","releases_url":"https://api.github.com/repos/airbnb/airflow/releases{/id}","deployments_url":"https://api.github.com/repos/airbnb/airflow/deployments","created_at":"2015-04-13T18:04:58Z","updated_at":"2016-02-18T20:16:01Z","pushed_at":"2016-02-18T06:19:54Z","git_url":"git://github.com/airbnb/airflow.git","ssh_url":"git@github.com:airbnb/airflow.git","clone_url":"https://github.com/airbnb/airflow.git","svn_url":"https://github.com/airbnb/airflow","homepage":"","size":8925,"stargazers_count":1943,"watchers_count":1943,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":362,"mirror_url":null,"open_issues_count":169,"forks":362,"open_issues":169,"watchers":1943,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/airbnb/airflow/pulls/1021"},"html":{"href":"https://github.com/airbnb/airflow/pull/1021"},"issue":{"href":"https://api.github.com/repos/airbnb/airflow/issues/1021"},"comments":{"href":"https://api.github.com/repos/airbnb/airflow/issues/1021/comments"},"review_comments":{"href":"https://api.github.com/repos/airbnb/airflow/pulls/1021/comments"},"review_comment":{"href":"https://api.github.com/repos/airbnb/airflow/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/airbnb/airflow/pulls/1021/commits"},"statuses":{"href":"https://api.github.com/repos/airbnb/airflow/statuses/c28d9add6f54a6dad96e751e2a7137909e4c8abf"}}}}