{"action":"created","comment":{"url":"https://api.github.com/repos/mlflow/mlflow/pulls/comments/217475598","pull_request_review_id":155196751,"id":217475598,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIxNzQ3NTU5OA==","diff_hunk":"@@ -189,6 +194,31 @@ def _is_local_uri(uri):\n     return not _GIT_URI_REGEX.match(uri)\n \n \n+def _is_valid_version(repo, version):\n+    \"\"\"Verify the commit version of branch name is valid, raise exception if otherwise.\"\"\"\n+    from git.exc import GitCommandError\n+    try:\n+        return repo.git.rev_parse(\"--verify\", version)\n+    except GitCommandError:\n+        # Second attempt to see if this is a branch\n+        try:\n+            return repo.git.rev_parse(\"--verify\", \"refs/remotes/origin/%s\" % version)\n+        except GitCommandError as e:\n+            raise ExecutionException(\"Got exception when validating git version '%s' \"\n+                                     \"- please ensure that the version exists in the repo. \"\n+                                     \"Error: %s\" % (version, e))\n+\n+\n+def _is_valid_branch_name(uri, work_dir, branch):\n+    \"\"\"Returns True if the branch exists in the Git project.\"\"\"\n+    if branch is not None:\n+        sub_directory = _parse_subdirectory(uri)[1]\n+        from git import Repo\n+        repo = Repo(work_dir.replace(sub_directory, ''), search_parent_directories=True)\n+        return repo.git.rev_parse(\"--verify\", \"refs/heads/%s\" % branch)","path":"mlflow/projects/__init__.py","position":null,"original_position":53,"commit_id":"f34203cb51fc43a51739346d6012383dc895c88a","original_commit_id":"c76f9c564e25cbb0e236af0811127a2fda682e61","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":"Gotcha - I think actually the previous `git.checkout(version)` will verify that `version` is a valid git ref (commit hash, tag name, or branch name). Thus when we call `_is_valid_branch_name`, the `branch` argument here could actually be a commit hash or tag name, which won't exist in refs/heads & raise an exception here. You can see this experimentally by running `mlflow run git@github.com:databricks/mlflow-example.git -P alpha=0.1 --no-conda --version 7193f0c`. ","created_at":"2018-09-13T17:47:17Z","updated_at":"2018-09-13T17:47:18Z","html_url":"https://github.com/mlflow/mlflow/pull/469#discussion_r217475598","pull_request_url":"https://api.github.com/repos/mlflow/mlflow/pulls/469","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/mlflow/mlflow/pulls/comments/217475598"},"html":{"href":"https://github.com/mlflow/mlflow/pull/469#discussion_r217475598"},"pull_request":{"href":"https://api.github.com/repos/mlflow/mlflow/pulls/469"}},"in_reply_to_id":217254673},"pull_request":{"url":"https://api.github.com/repos/mlflow/mlflow/pulls/469","id":214755028,"node_id":"MDExOlB1bGxSZXF1ZXN0MjE0NzU1MDI4","html_url":"https://github.com/mlflow/mlflow/pull/469","diff_url":"https://github.com/mlflow/mlflow/pull/469.diff","patch_url":"https://github.com/mlflow/mlflow/pull/469.patch","issue_url":"https://api.github.com/repos/mlflow/mlflow/issues/469","number":469,"state":"open","locked":false,"title":"Add gitBranchName run tag when a project is a git project specified with branch name","user":{"login":"adrian555","id":10642337,"node_id":"MDQ6VXNlcjEwNjQyMzM3","avatar_url":"https://avatars2.githubusercontent.com/u/10642337?v=4","gravatar_id":"","url":"https://api.github.com/users/adrian555","html_url":"https://github.com/adrian555","followers_url":"https://api.github.com/users/adrian555/followers","following_url":"https://api.github.com/users/adrian555/following{/other_user}","gists_url":"https://api.github.com/users/adrian555/gists{/gist_id}","starred_url":"https://api.github.com/users/adrian555/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adrian555/subscriptions","organizations_url":"https://api.github.com/users/adrian555/orgs","repos_url":"https://api.github.com/users/adrian555/repos","events_url":"https://api.github.com/users/adrian555/events{/privacy}","received_events_url":"https://api.github.com/users/adrian555/received_events","type":"User","site_admin":false},"body":"Followup of #427.\r\n\r\n1) add the `gitBranchName` run tag for the git project\r\n2) update the doc of `-version` option to include branch name of a git project\r\n3) verify `version` value before checkout\r\n","created_at":"2018-09-11T20:23:15Z","updated_at":"2018-09-13T17:47:18Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a3619b63dac1bd9695ccdb4ee6df3396e0a7a069","assignee":{"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},"assignees":[{"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}],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/mlflow/mlflow/pulls/469/commits","review_comments_url":"https://api.github.com/repos/mlflow/mlflow/pulls/469/comments","review_comment_url":"https://api.github.com/repos/mlflow/mlflow/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mlflow/mlflow/issues/469/comments","statuses_url":"https://api.github.com/repos/mlflow/mlflow/statuses/f34203cb51fc43a51739346d6012383dc895c88a","head":{"label":"adrian555:branch_tag","ref":"branch_tag","sha":"f34203cb51fc43a51739346d6012383dc895c88a","user":{"login":"adrian555","id":10642337,"node_id":"MDQ6VXNlcjEwNjQyMzM3","avatar_url":"https://avatars2.githubusercontent.com/u/10642337?v=4","gravatar_id":"","url":"https://api.github.com/users/adrian555","html_url":"https://github.com/adrian555","followers_url":"https://api.github.com/users/adrian555/followers","following_url":"https://api.github.com/users/adrian555/following{/other_user}","gists_url":"https://api.github.com/users/adrian555/gists{/gist_id}","starred_url":"https://api.github.com/users/adrian555/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adrian555/subscriptions","organizations_url":"https://api.github.com/users/adrian555/orgs","repos_url":"https://api.github.com/users/adrian555/repos","events_url":"https://api.github.com/users/adrian555/events{/privacy}","received_events_url":"https://api.github.com/users/adrian555/received_events","type":"User","site_admin":false},"repo":{"id":144613799,"node_id":"MDEwOlJlcG9zaXRvcnkxNDQ2MTM3OTk=","name":"mlflow","full_name":"adrian555/mlflow","owner":{"login":"adrian555","id":10642337,"node_id":"MDQ6VXNlcjEwNjQyMzM3","avatar_url":"https://avatars2.githubusercontent.com/u/10642337?v=4","gravatar_id":"","url":"https://api.github.com/users/adrian555","html_url":"https://github.com/adrian555","followers_url":"https://api.github.com/users/adrian555/followers","following_url":"https://api.github.com/users/adrian555/following{/other_user}","gists_url":"https://api.github.com/users/adrian555/gists{/gist_id}","starred_url":"https://api.github.com/users/adrian555/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adrian555/subscriptions","organizations_url":"https://api.github.com/users/adrian555/orgs","repos_url":"https://api.github.com/users/adrian555/repos","events_url":"https://api.github.com/users/adrian555/events{/privacy}","received_events_url":"https://api.github.com/users/adrian555/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/adrian555/mlflow","description":"Open source platform for the machine learning lifecycle","fork":true,"url":"https://api.github.com/repos/adrian555/mlflow","forks_url":"https://api.github.com/repos/adrian555/mlflow/forks","keys_url":"https://api.github.com/repos/adrian555/mlflow/keys{/key_id}","collaborators_url":"https://api.github.com/repos/adrian555/mlflow/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/adrian555/mlflow/teams","hooks_url":"https://api.github.com/repos/adrian555/mlflow/hooks","issue_events_url":"https://api.github.com/repos/adrian555/mlflow/issues/events{/number}","events_url":"https://api.github.com/repos/adrian555/mlflow/events","assignees_url":"https://api.github.com/repos/adrian555/mlflow/assignees{/user}","branches_url":"https://api.github.com/repos/adrian555/mlflow/branches{/branch}","tags_url":"https://api.github.com/repos/adrian555/mlflow/tags","blobs_url":"https://api.github.com/repos/adrian555/mlflow/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/adrian555/mlflow/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/adrian555/mlflow/git/refs{/sha}","trees_url":"https://api.github.com/repos/adrian555/mlflow/git/trees{/sha}","statuses_url":"https://api.github.com/repos/adrian555/mlflow/statuses/{sha}","languages_url":"https://api.github.com/repos/adrian555/mlflow/languages","stargazers_url":"https://api.github.com/repos/adrian555/mlflow/stargazers","contributors_url":"https://api.github.com/repos/adrian555/mlflow/contributors","subscribers_url":"https://api.github.com/repos/adrian555/mlflow/subscribers","subscription_url":"https://api.github.com/repos/adrian555/mlflow/subscription","commits_url":"https://api.github.com/repos/adrian555/mlflow/commits{/sha}","git_commits_url":"https://api.github.com/repos/adrian555/mlflow/git/commits{/sha}","comments_url":"https://api.github.com/repos/adrian555/mlflow/comments{/number}","issue_comment_url":"https://api.github.com/repos/adrian555/mlflow/issues/comments{/number}","contents_url":"https://api.github.com/repos/adrian555/mlflow/contents/{+path}","compare_url":"https://api.github.com/repos/adrian555/mlflow/compare/{base}...{head}","merges_url":"https://api.github.com/repos/adrian555/mlflow/merges","archive_url":"https://api.github.com/repos/adrian555/mlflow/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/adrian555/mlflow/downloads","issues_url":"https://api.github.com/repos/adrian555/mlflow/issues{/number}","pulls_url":"https://api.github.com/repos/adrian555/mlflow/pulls{/number}","milestones_url":"https://api.github.com/repos/adrian555/mlflow/milestones{/number}","notifications_url":"https://api.github.com/repos/adrian555/mlflow/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/adrian555/mlflow/labels{/name}","releases_url":"https://api.github.com/repos/adrian555/mlflow/releases{/id}","deployments_url":"https://api.github.com/repos/adrian555/mlflow/deployments","created_at":"2018-08-13T17:44:16Z","updated_at":"2018-09-11T20:15:34Z","pushed_at":"2018-09-13T05:09:45Z","git_url":"git://github.com/adrian555/mlflow.git","ssh_url":"git@github.com:adrian555/mlflow.git","clone_url":"https://github.com/adrian555/mlflow.git","svn_url":"https://github.com/adrian555/mlflow","homepage":"https://mlflow.org","size":5850,"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":"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":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"mlflow:master","ref":"master","sha":"494096998444073f8bbea3afb8b985d040d78e49","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","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},"private":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-09-13T16:57:29Z","pushed_at":"2018-09-13T17:46:59Z","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":5977,"stargazers_count":2152,"watchers_count":2152,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":335,"mirror_url":null,"archived":false,"open_issues_count":104,"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":335,"open_issues":104,"watchers":2152,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mlflow/mlflow/pulls/469"},"html":{"href":"https://github.com/mlflow/mlflow/pull/469"},"issue":{"href":"https://api.github.com/repos/mlflow/mlflow/issues/469"},"comments":{"href":"https://api.github.com/repos/mlflow/mlflow/issues/469/comments"},"review_comments":{"href":"https://api.github.com/repos/mlflow/mlflow/pulls/469/comments"},"review_comment":{"href":"https://api.github.com/repos/mlflow/mlflow/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mlflow/mlflow/pulls/469/commits"},"statuses":{"href":"https://api.github.com/repos/mlflow/mlflow/statuses/f34203cb51fc43a51739346d6012383dc895c88a"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"smurching"}}