{"action":"created","comment":{"url":"https://api.github.com/repos/mlflow/mlflow/pulls/comments/223141735","pull_request_review_id":162207724,"id":223141735,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIyMzE0MTczNQ==","diff_hunk":"@@ -13,6 +14,25 @@\n RESOURCE_DOES_NOT_EXIST = 'RESOURCE_DOES_NOT_EXIST'\n \n \n+class RestException(MlflowException):","path":"mlflow/utils/rest_utils.py","position":11,"original_position":11,"commit_id":"c20e93bf6b92e1fcb26d72765a355f19c2884941","original_commit_id":"c20e93bf6b92e1fcb26d72765a355f19c2884941","user":{"login":"andrewmchen","id":4492809,"node_id":"MDQ6VXNlcjQ0OTI4MDk=","avatar_url":"https://avatars3.githubusercontent.com/u/4492809?v=4","gravatar_id":"","url":"https://api.github.com/users/andrewmchen","html_url":"https://github.com/andrewmchen","followers_url":"https://api.github.com/users/andrewmchen/followers","following_url":"https://api.github.com/users/andrewmchen/following{/other_user}","gists_url":"https://api.github.com/users/andrewmchen/gists{/gist_id}","starred_url":"https://api.github.com/users/andrewmchen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andrewmchen/subscriptions","organizations_url":"https://api.github.com/users/andrewmchen/orgs","repos_url":"https://api.github.com/users/andrewmchen/repos","events_url":"https://api.github.com/users/andrewmchen/events{/privacy}","received_events_url":"https://api.github.com/users/andrewmchen/received_events","type":"User","site_admin":false},"body":"Hm, maybe a merge conflict? Can we use the `RestException` in `mlflow.exceptions`?","created_at":"2018-10-05T21:20:41Z","updated_at":"2018-10-05T21:20:42Z","html_url":"https://github.com/mlflow/mlflow/pull/560#discussion_r223141735","pull_request_url":"https://api.github.com/repos/mlflow/mlflow/pulls/560","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/mlflow/mlflow/pulls/comments/223141735"},"html":{"href":"https://github.com/mlflow/mlflow/pull/560#discussion_r223141735"},"pull_request":{"href":"https://api.github.com/repos/mlflow/mlflow/pulls/560"}}},"pull_request":{"url":"https://api.github.com/repos/mlflow/mlflow/pulls/560","id":218538935,"node_id":"MDExOlB1bGxSZXF1ZXN0MjE4NTM4OTM1","html_url":"https://github.com/mlflow/mlflow/pull/560","diff_url":"https://github.com/mlflow/mlflow/pull/560.diff","patch_url":"https://github.com/mlflow/mlflow/pull/560.patch","issue_url":"https://api.github.com/repos/mlflow/mlflow/issues/560","number":560,"state":"open","locked":false,"title":"Properly handle HTTP request failures instead of raising JSON decode errors","user":{"login":"smurching","id":2358483,"node_id":"MDQ6VXNlcjIzNTg0ODM=","avatar_url":"https://avatars1.githubusercontent.com/u/2358483?v=4","gravatar_id":"","url":"https://api.github.com/users/smurching","html_url":"https://github.com/smurching","followers_url":"https://api.github.com/users/smurching/followers","following_url":"https://api.github.com/users/smurching/following{/other_user}","gists_url":"https://api.github.com/users/smurching/gists{/gist_id}","starred_url":"https://api.github.com/users/smurching/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/smurching/subscriptions","organizations_url":"https://api.github.com/users/smurching/orgs","repos_url":"https://api.github.com/users/smurching/repos","events_url":"https://api.github.com/users/smurching/events{/privacy}","received_events_url":"https://api.github.com/users/smurching/received_events","type":"User","site_admin":false},"body":"### Current state of the world\r\nWe make all HTTP requests in the Python client via a `mlflow.utils.rest_utils.http_request` helper that returns a Response object unless the request fails with a server-level (5xx) error. Callers of `http_request` are responsible for checking whether the request failed e.g. with an application-level error. Currently, we don't consistently perform this check (e.g. in `DbfsArtifactRepository` and the `RestStore`), and instead attempt to parse the response body of a failed request, which results in somewhat confusing JSON decode errors. When we do perform the check, it's through error-handling logic spread around different modules.\r\n\r\n### Updates in this PR\r\nThis PR consolidates exception-handling logic for HTTP requests into a single `http_request_safe` method, which wraps the old `http_request` helper but also verifies that the response status is 200. After this change, calling `log_artifact` or `log_param` against DBFS / a Databricks tracking server with bad auth will yield well-formed error messages instead of JsonDecodeErrors.\r\n\r\nThe goal of this PR is to make using `http_request_safe` (& by extension error-handling of failed requests) the default. A few methods (namely, listing files / getting the status of files on DBFS) still use `http_request` since non-200 responses are useful in indicating whether or nor files exist, but no other methods do. \r\n","created_at":"2018-09-27T06:35:27Z","updated_at":"2018-10-05T21:20:41Z","closed_at":null,"merged_at":null,"merge_commit_sha":"1eab0dd2388d86f112d5b4be76e1efa1d216a185","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/mlflow/mlflow/pulls/560/commits","review_comments_url":"https://api.github.com/repos/mlflow/mlflow/pulls/560/comments","review_comment_url":"https://api.github.com/repos/mlflow/mlflow/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mlflow/mlflow/issues/560/comments","statuses_url":"https://api.github.com/repos/mlflow/mlflow/statuses/c20e93bf6b92e1fcb26d72765a355f19c2884941","head":{"label":"smurching:fix-json-load-errors","ref":"fix-json-load-errors","sha":"c20e93bf6b92e1fcb26d72765a355f19c2884941","user":{"login":"smurching","id":2358483,"node_id":"MDQ6VXNlcjIzNTg0ODM=","avatar_url":"https://avatars1.githubusercontent.com/u/2358483?v=4","gravatar_id":"","url":"https://api.github.com/users/smurching","html_url":"https://github.com/smurching","followers_url":"https://api.github.com/users/smurching/followers","following_url":"https://api.github.com/users/smurching/following{/other_user}","gists_url":"https://api.github.com/users/smurching/gists{/gist_id}","starred_url":"https://api.github.com/users/smurching/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/smurching/subscriptions","organizations_url":"https://api.github.com/users/smurching/orgs","repos_url":"https://api.github.com/users/smurching/repos","events_url":"https://api.github.com/users/smurching/events{/privacy}","received_events_url":"https://api.github.com/users/smurching/received_events","type":"User","site_admin":false},"repo":{"id":136405291,"node_id":"MDEwOlJlcG9zaXRvcnkxMzY0MDUyOTE=","name":"mlflow","full_name":"smurching/mlflow","private":false,"owner":{"login":"smurching","id":2358483,"node_id":"MDQ6VXNlcjIzNTg0ODM=","avatar_url":"https://avatars1.githubusercontent.com/u/2358483?v=4","gravatar_id":"","url":"https://api.github.com/users/smurching","html_url":"https://github.com/smurching","followers_url":"https://api.github.com/users/smurching/followers","following_url":"https://api.github.com/users/smurching/following{/other_user}","gists_url":"https://api.github.com/users/smurching/gists{/gist_id}","starred_url":"https://api.github.com/users/smurching/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/smurching/subscriptions","organizations_url":"https://api.github.com/users/smurching/orgs","repos_url":"https://api.github.com/users/smurching/repos","events_url":"https://api.github.com/users/smurching/events{/privacy}","received_events_url":"https://api.github.com/users/smurching/received_events","type":"User","site_admin":false},"html_url":"https://github.com/smurching/mlflow","description":"Open source platform for the complete machine learning lifecycle","fork":true,"url":"https://api.github.com/repos/smurching/mlflow","forks_url":"https://api.github.com/repos/smurching/mlflow/forks","keys_url":"https://api.github.com/repos/smurching/mlflow/keys{/key_id}","collaborators_url":"https://api.github.com/repos/smurching/mlflow/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/smurching/mlflow/teams","hooks_url":"https://api.github.com/repos/smurching/mlflow/hooks","issue_events_url":"https://api.github.com/repos/smurching/mlflow/issues/events{/number}","events_url":"https://api.github.com/repos/smurching/mlflow/events","assignees_url":"https://api.github.com/repos/smurching/mlflow/assignees{/user}","branches_url":"https://api.github.com/repos/smurching/mlflow/branches{/branch}","tags_url":"https://api.github.com/repos/smurching/mlflow/tags","blobs_url":"https://api.github.com/repos/smurching/mlflow/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/smurching/mlflow/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/smurching/mlflow/git/refs{/sha}","trees_url":"https://api.github.com/repos/smurching/mlflow/git/trees{/sha}","statuses_url":"https://api.github.com/repos/smurching/mlflow/statuses/{sha}","languages_url":"https://api.github.com/repos/smurching/mlflow/languages","stargazers_url":"https://api.github.com/repos/smurching/mlflow/stargazers","contributors_url":"https://api.github.com/repos/smurching/mlflow/contributors","subscribers_url":"https://api.github.com/repos/smurching/mlflow/subscribers","subscription_url":"https://api.github.com/repos/smurching/mlflow/subscription","commits_url":"https://api.github.com/repos/smurching/mlflow/commits{/sha}","git_commits_url":"https://api.github.com/repos/smurching/mlflow/git/commits{/sha}","comments_url":"https://api.github.com/repos/smurching/mlflow/comments{/number}","issue_comment_url":"https://api.github.com/repos/smurching/mlflow/issues/comments{/number}","contents_url":"https://api.github.com/repos/smurching/mlflow/contents/{+path}","compare_url":"https://api.github.com/repos/smurching/mlflow/compare/{base}...{head}","merges_url":"https://api.github.com/repos/smurching/mlflow/merges","archive_url":"https://api.github.com/repos/smurching/mlflow/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/smurching/mlflow/downloads","issues_url":"https://api.github.com/repos/smurching/mlflow/issues{/number}","pulls_url":"https://api.github.com/repos/smurching/mlflow/pulls{/number}","milestones_url":"https://api.github.com/repos/smurching/mlflow/milestones{/number}","notifications_url":"https://api.github.com/repos/smurching/mlflow/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/smurching/mlflow/labels{/name}","releases_url":"https://api.github.com/repos/smurching/mlflow/releases{/id}","deployments_url":"https://api.github.com/repos/smurching/mlflow/deployments","created_at":"2018-06-07T01:31:16Z","updated_at":"2018-07-30T20:18:52Z","pushed_at":"2018-10-04T06:14:55Z","git_url":"git://github.com/smurching/mlflow.git","ssh_url":"git@github.com:smurching/mlflow.git","clone_url":"https://github.com/smurching/mlflow.git","svn_url":"https://github.com/smurching/mlflow","homepage":"https://mlflow.org","size":7719,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"other","name":"NOASSERTION","spdx_id":"NOASSERTION","url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"mlflow:master","ref":"master","sha":"a4386c3f87923e395ba8f523e1a90749e888a541","user":{"login":"mlflow","id":39938107,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM5OTM4MTA3","avatar_url":"https://avatars3.githubusercontent.com/u/39938107?v=4","gravatar_id":"","url":"https://api.github.com/users/mlflow","html_url":"https://github.com/mlflow","followers_url":"https://api.github.com/users/mlflow/followers","following_url":"https://api.github.com/users/mlflow/following{/other_user}","gists_url":"https://api.github.com/users/mlflow/gists{/gist_id}","starred_url":"https://api.github.com/users/mlflow/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mlflow/subscriptions","organizations_url":"https://api.github.com/users/mlflow/orgs","repos_url":"https://api.github.com/users/mlflow/repos","events_url":"https://api.github.com/users/mlflow/events{/privacy}","received_events_url":"https://api.github.com/users/mlflow/received_events","type":"Organization","site_admin":false},"repo":{"id":136202695,"node_id":"MDEwOlJlcG9zaXRvcnkxMzYyMDI2OTU=","name":"mlflow","full_name":"mlflow/mlflow","private":false,"owner":{"login":"mlflow","id":39938107,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM5OTM4MTA3","avatar_url":"https://avatars3.githubusercontent.com/u/39938107?v=4","gravatar_id":"","url":"https://api.github.com/users/mlflow","html_url":"https://github.com/mlflow","followers_url":"https://api.github.com/users/mlflow/followers","following_url":"https://api.github.com/users/mlflow/following{/other_user}","gists_url":"https://api.github.com/users/mlflow/gists{/gist_id}","starred_url":"https://api.github.com/users/mlflow/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mlflow/subscriptions","organizations_url":"https://api.github.com/users/mlflow/orgs","repos_url":"https://api.github.com/users/mlflow/repos","events_url":"https://api.github.com/users/mlflow/events{/privacy}","received_events_url":"https://api.github.com/users/mlflow/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/mlflow/mlflow","description":"Open source platform for the machine learning lifecycle","fork":false,"url":"https://api.github.com/repos/mlflow/mlflow","forks_url":"https://api.github.com/repos/mlflow/mlflow/forks","keys_url":"https://api.github.com/repos/mlflow/mlflow/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mlflow/mlflow/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mlflow/mlflow/teams","hooks_url":"https://api.github.com/repos/mlflow/mlflow/hooks","issue_events_url":"https://api.github.com/repos/mlflow/mlflow/issues/events{/number}","events_url":"https://api.github.com/repos/mlflow/mlflow/events","assignees_url":"https://api.github.com/repos/mlflow/mlflow/assignees{/user}","branches_url":"https://api.github.com/repos/mlflow/mlflow/branches{/branch}","tags_url":"https://api.github.com/repos/mlflow/mlflow/tags","blobs_url":"https://api.github.com/repos/mlflow/mlflow/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mlflow/mlflow/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mlflow/mlflow/git/refs{/sha}","trees_url":"https://api.github.com/repos/mlflow/mlflow/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mlflow/mlflow/statuses/{sha}","languages_url":"https://api.github.com/repos/mlflow/mlflow/languages","stargazers_url":"https://api.github.com/repos/mlflow/mlflow/stargazers","contributors_url":"https://api.github.com/repos/mlflow/mlflow/contributors","subscribers_url":"https://api.github.com/repos/mlflow/mlflow/subscribers","subscription_url":"https://api.github.com/repos/mlflow/mlflow/subscription","commits_url":"https://api.github.com/repos/mlflow/mlflow/commits{/sha}","git_commits_url":"https://api.github.com/repos/mlflow/mlflow/git/commits{/sha}","comments_url":"https://api.github.com/repos/mlflow/mlflow/comments{/number}","issue_comment_url":"https://api.github.com/repos/mlflow/mlflow/issues/comments{/number}","contents_url":"https://api.github.com/repos/mlflow/mlflow/contents/{+path}","compare_url":"https://api.github.com/repos/mlflow/mlflow/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mlflow/mlflow/merges","archive_url":"https://api.github.com/repos/mlflow/mlflow/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mlflow/mlflow/downloads","issues_url":"https://api.github.com/repos/mlflow/mlflow/issues{/number}","pulls_url":"https://api.github.com/repos/mlflow/mlflow/pulls{/number}","milestones_url":"https://api.github.com/repos/mlflow/mlflow/milestones{/number}","notifications_url":"https://api.github.com/repos/mlflow/mlflow/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mlflow/mlflow/labels{/name}","releases_url":"https://api.github.com/repos/mlflow/mlflow/releases{/id}","deployments_url":"https://api.github.com/repos/mlflow/mlflow/deployments","created_at":"2018-06-05T16:05:58Z","updated_at":"2018-10-05T19:43:53Z","pushed_at":"2018-10-05T21:13:30Z","git_url":"git://github.com/mlflow/mlflow.git","ssh_url":"git@github.com:mlflow/mlflow.git","clone_url":"https://github.com/mlflow/mlflow.git","svn_url":"https://github.com/mlflow/mlflow","homepage":"https://mlflow.org","size":6401,"stargazers_count":2306,"watchers_count":2306,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":369,"mirror_url":null,"archived":false,"open_issues_count":128,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":369,"open_issues":128,"watchers":2306,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mlflow/mlflow/pulls/560"},"html":{"href":"https://github.com/mlflow/mlflow/pull/560"},"issue":{"href":"https://api.github.com/repos/mlflow/mlflow/issues/560"},"comments":{"href":"https://api.github.com/repos/mlflow/mlflow/issues/560/comments"},"review_comments":{"href":"https://api.github.com/repos/mlflow/mlflow/pulls/560/comments"},"review_comment":{"href":"https://api.github.com/repos/mlflow/mlflow/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mlflow/mlflow/pulls/560/commits"},"statuses":{"href":"https://api.github.com/repos/mlflow/mlflow/statuses/c20e93bf6b92e1fcb26d72765a355f19c2884941"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"andrewmchen"}}