{"action":"created","comment":{"url":"https://api.github.com/repos/pfnet/optuna/pulls/comments/238958218","pull_request_review_id":181623700,"id":238958218,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIzODk1ODIxOA==","diff_hunk":"@@ -472,14 +473,34 @@ def create_study(\n         direction:\n             Direction of optimization. Set ``minimize`` for minimization and ``maximize`` for\n             maximization. Note that ``maximize`` is currently unsupported.\n+        exist_ok:\n+            Flag for controlling the behavior when study names conflict.\n+            If a study named ``study_name`` already exists in the ``storage``,\n+            a :class:`~optuna.structs.DuplicatedStudyError` is raised if ``exist_ok`` is\n+            set to :obj:`False`.\n+            Otherwise the creation of the study is skipped and no exception is raised.\n \n     Returns:\n         A :class:`~optuna.study.Study` object.\n \n     \"\"\"\n \n     storage = storages.get_storage(storage)\n-    study_name = storage.get_study_name_from_id(storage.create_new_study_id(study_name))\n+    try:\n+        study_id = storage.create_new_study_id(study_name)\n+    except structs.DuplicatedStudyError:\n+        if exist_ok:\n+            assert study_name is not None","path":"optuna/study.py","position":30,"original_position":30,"commit_id":"2988e6fa8dadbbd95e799464e5b785265fee98ac","original_commit_id":"0448f096bd6c40c0089f013d90131fad887cd1e3","user":{"login":"toshihikoyanase","id":3255979,"node_id":"MDQ6VXNlcjMyNTU5Nzk=","avatar_url":"https://avatars2.githubusercontent.com/u/3255979?v=4","gravatar_id":"","url":"https://api.github.com/users/toshihikoyanase","html_url":"https://github.com/toshihikoyanase","followers_url":"https://api.github.com/users/toshihikoyanase/followers","following_url":"https://api.github.com/users/toshihikoyanase/following{/other_user}","gists_url":"https://api.github.com/users/toshihikoyanase/gists{/gist_id}","starred_url":"https://api.github.com/users/toshihikoyanase/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/toshihikoyanase/subscriptions","organizations_url":"https://api.github.com/users/toshihikoyanase/orgs","repos_url":"https://api.github.com/users/toshihikoyanase/repos","events_url":"https://api.github.com/users/toshihikoyanase/events{/privacy}","received_events_url":"https://api.github.com/users/toshihikoyanase/received_events","type":"User","site_admin":false},"body":"That makes sense. If a name generated automatically is duplicated, this condition (`study_name=None, exist_ok=True`) will be satisfied. In this case, I don't think `ValueError(NOT_FOUND_MSG)` is an appropriate message.\r\nThank you for your kind explanation.","created_at":"2018-12-05T07:44:52Z","updated_at":"2018-12-05T07:44:52Z","html_url":"https://github.com/pfnet/optuna/pull/242#discussion_r238958218","pull_request_url":"https://api.github.com/repos/pfnet/optuna/pulls/242","author_association":"COLLABORATOR","_links":{"self":{"href":"https://api.github.com/repos/pfnet/optuna/pulls/comments/238958218"},"html":{"href":"https://github.com/pfnet/optuna/pull/242#discussion_r238958218"},"pull_request":{"href":"https://api.github.com/repos/pfnet/optuna/pulls/242"}},"in_reply_to_id":238195852},"pull_request":{"url":"https://api.github.com/repos/pfnet/optuna/pulls/242","id":234538082,"node_id":"MDExOlB1bGxSZXF1ZXN0MjM0NTM4MDgy","html_url":"https://github.com/pfnet/optuna/pull/242","diff_url":"https://github.com/pfnet/optuna/pull/242.diff","patch_url":"https://github.com/pfnet/optuna/pull/242.patch","issue_url":"https://api.github.com/repos/pfnet/optuna/issues/242","number":242,"state":"open","locked":false,"title":"Add `exist_ok` option","user":{"login":"sile","id":181413,"node_id":"MDQ6VXNlcjE4MTQxMw==","avatar_url":"https://avatars1.githubusercontent.com/u/181413?v=4","gravatar_id":"","url":"https://api.github.com/users/sile","html_url":"https://github.com/sile","followers_url":"https://api.github.com/users/sile/followers","following_url":"https://api.github.com/users/sile/following{/other_user}","gists_url":"https://api.github.com/users/sile/gists{/gist_id}","starred_url":"https://api.github.com/users/sile/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sile/subscriptions","organizations_url":"https://api.github.com/users/sile/orgs","repos_url":"https://api.github.com/users/sile/repos","events_url":"https://api.github.com/users/sile/events{/privacy}","received_events_url":"https://api.github.com/users/sile/received_events","type":"User","site_admin":false},"body":"I added `exist_ok` option to` optuna.study.create_study() `function and `$ optuna create-study` CLI command. It allows users to create studies without warrying about \"whether the study already exists in the storage or not\".","created_at":"2018-11-29T07:46:33Z","updated_at":"2018-12-05T07:44:52Z","closed_at":null,"merged_at":null,"merge_commit_sha":"23d342ab172b397e789fb101b12d1d76db670301","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/pfnet/optuna/pulls/242/commits","review_comments_url":"https://api.github.com/repos/pfnet/optuna/pulls/242/comments","review_comment_url":"https://api.github.com/repos/pfnet/optuna/pulls/comments{/number}","comments_url":"https://api.github.com/repos/pfnet/optuna/issues/242/comments","statuses_url":"https://api.github.com/repos/pfnet/optuna/statuses/2988e6fa8dadbbd95e799464e5b785265fee98ac","head":{"label":"pfnet:exist-ok-option","ref":"exist-ok-option","sha":"2988e6fa8dadbbd95e799464e5b785265fee98ac","user":{"login":"pfnet","id":9739572,"node_id":"MDEyOk9yZ2FuaXphdGlvbjk3Mzk1NzI=","avatar_url":"https://avatars2.githubusercontent.com/u/9739572?v=4","gravatar_id":"","url":"https://api.github.com/users/pfnet","html_url":"https://github.com/pfnet","followers_url":"https://api.github.com/users/pfnet/followers","following_url":"https://api.github.com/users/pfnet/following{/other_user}","gists_url":"https://api.github.com/users/pfnet/gists{/gist_id}","starred_url":"https://api.github.com/users/pfnet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pfnet/subscriptions","organizations_url":"https://api.github.com/users/pfnet/orgs","repos_url":"https://api.github.com/users/pfnet/repos","events_url":"https://api.github.com/users/pfnet/events{/privacy}","received_events_url":"https://api.github.com/users/pfnet/received_events","type":"Organization","site_admin":false},"repo":{"id":122299416,"node_id":"MDEwOlJlcG9zaXRvcnkxMjIyOTk0MTY=","name":"optuna","full_name":"pfnet/optuna","private":false,"owner":{"login":"pfnet","id":9739572,"node_id":"MDEyOk9yZ2FuaXphdGlvbjk3Mzk1NzI=","avatar_url":"https://avatars2.githubusercontent.com/u/9739572?v=4","gravatar_id":"","url":"https://api.github.com/users/pfnet","html_url":"https://github.com/pfnet","followers_url":"https://api.github.com/users/pfnet/followers","following_url":"https://api.github.com/users/pfnet/following{/other_user}","gists_url":"https://api.github.com/users/pfnet/gists{/gist_id}","starred_url":"https://api.github.com/users/pfnet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pfnet/subscriptions","organizations_url":"https://api.github.com/users/pfnet/orgs","repos_url":"https://api.github.com/users/pfnet/repos","events_url":"https://api.github.com/users/pfnet/events{/privacy}","received_events_url":"https://api.github.com/users/pfnet/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/pfnet/optuna","description":"A hyperparameter optimization framework","fork":false,"url":"https://api.github.com/repos/pfnet/optuna","forks_url":"https://api.github.com/repos/pfnet/optuna/forks","keys_url":"https://api.github.com/repos/pfnet/optuna/keys{/key_id}","collaborators_url":"https://api.github.com/repos/pfnet/optuna/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/pfnet/optuna/teams","hooks_url":"https://api.github.com/repos/pfnet/optuna/hooks","issue_events_url":"https://api.github.com/repos/pfnet/optuna/issues/events{/number}","events_url":"https://api.github.com/repos/pfnet/optuna/events","assignees_url":"https://api.github.com/repos/pfnet/optuna/assignees{/user}","branches_url":"https://api.github.com/repos/pfnet/optuna/branches{/branch}","tags_url":"https://api.github.com/repos/pfnet/optuna/tags","blobs_url":"https://api.github.com/repos/pfnet/optuna/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/pfnet/optuna/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/pfnet/optuna/git/refs{/sha}","trees_url":"https://api.github.com/repos/pfnet/optuna/git/trees{/sha}","statuses_url":"https://api.github.com/repos/pfnet/optuna/statuses/{sha}","languages_url":"https://api.github.com/repos/pfnet/optuna/languages","stargazers_url":"https://api.github.com/repos/pfnet/optuna/stargazers","contributors_url":"https://api.github.com/repos/pfnet/optuna/contributors","subscribers_url":"https://api.github.com/repos/pfnet/optuna/subscribers","subscription_url":"https://api.github.com/repos/pfnet/optuna/subscription","commits_url":"https://api.github.com/repos/pfnet/optuna/commits{/sha}","git_commits_url":"https://api.github.com/repos/pfnet/optuna/git/commits{/sha}","comments_url":"https://api.github.com/repos/pfnet/optuna/comments{/number}","issue_comment_url":"https://api.github.com/repos/pfnet/optuna/issues/comments{/number}","contents_url":"https://api.github.com/repos/pfnet/optuna/contents/{+path}","compare_url":"https://api.github.com/repos/pfnet/optuna/compare/{base}...{head}","merges_url":"https://api.github.com/repos/pfnet/optuna/merges","archive_url":"https://api.github.com/repos/pfnet/optuna/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/pfnet/optuna/downloads","issues_url":"https://api.github.com/repos/pfnet/optuna/issues{/number}","pulls_url":"https://api.github.com/repos/pfnet/optuna/pulls{/number}","milestones_url":"https://api.github.com/repos/pfnet/optuna/milestones{/number}","notifications_url":"https://api.github.com/repos/pfnet/optuna/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/pfnet/optuna/labels{/name}","releases_url":"https://api.github.com/repos/pfnet/optuna/releases{/id}","deployments_url":"https://api.github.com/repos/pfnet/optuna/deployments","created_at":"2018-02-21T06:12:56Z","updated_at":"2018-12-05T07:36:57Z","pushed_at":"2018-12-05T07:39:30Z","git_url":"git://github.com/pfnet/optuna.git","ssh_url":"git@github.com:pfnet/optuna.git","clone_url":"https://github.com/pfnet/optuna.git","svn_url":"https://github.com/pfnet/optuna","homepage":"https://optuna.org","size":958,"stargazers_count":267,"watchers_count":267,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":12,"mirror_url":null,"archived":false,"open_issues_count":12,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":12,"open_issues":12,"watchers":267,"default_branch":"master"}},"base":{"label":"pfnet:master","ref":"master","sha":"aa5e81c9de70de950d3b7c66159fda83b16ea138","user":{"login":"pfnet","id":9739572,"node_id":"MDEyOk9yZ2FuaXphdGlvbjk3Mzk1NzI=","avatar_url":"https://avatars2.githubusercontent.com/u/9739572?v=4","gravatar_id":"","url":"https://api.github.com/users/pfnet","html_url":"https://github.com/pfnet","followers_url":"https://api.github.com/users/pfnet/followers","following_url":"https://api.github.com/users/pfnet/following{/other_user}","gists_url":"https://api.github.com/users/pfnet/gists{/gist_id}","starred_url":"https://api.github.com/users/pfnet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pfnet/subscriptions","organizations_url":"https://api.github.com/users/pfnet/orgs","repos_url":"https://api.github.com/users/pfnet/repos","events_url":"https://api.github.com/users/pfnet/events{/privacy}","received_events_url":"https://api.github.com/users/pfnet/received_events","type":"Organization","site_admin":false},"repo":{"id":122299416,"node_id":"MDEwOlJlcG9zaXRvcnkxMjIyOTk0MTY=","name":"optuna","full_name":"pfnet/optuna","private":false,"owner":{"login":"pfnet","id":9739572,"node_id":"MDEyOk9yZ2FuaXphdGlvbjk3Mzk1NzI=","avatar_url":"https://avatars2.githubusercontent.com/u/9739572?v=4","gravatar_id":"","url":"https://api.github.com/users/pfnet","html_url":"https://github.com/pfnet","followers_url":"https://api.github.com/users/pfnet/followers","following_url":"https://api.github.com/users/pfnet/following{/other_user}","gists_url":"https://api.github.com/users/pfnet/gists{/gist_id}","starred_url":"https://api.github.com/users/pfnet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pfnet/subscriptions","organizations_url":"https://api.github.com/users/pfnet/orgs","repos_url":"https://api.github.com/users/pfnet/repos","events_url":"https://api.github.com/users/pfnet/events{/privacy}","received_events_url":"https://api.github.com/users/pfnet/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/pfnet/optuna","description":"A hyperparameter optimization framework","fork":false,"url":"https://api.github.com/repos/pfnet/optuna","forks_url":"https://api.github.com/repos/pfnet/optuna/forks","keys_url":"https://api.github.com/repos/pfnet/optuna/keys{/key_id}","collaborators_url":"https://api.github.com/repos/pfnet/optuna/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/pfnet/optuna/teams","hooks_url":"https://api.github.com/repos/pfnet/optuna/hooks","issue_events_url":"https://api.github.com/repos/pfnet/optuna/issues/events{/number}","events_url":"https://api.github.com/repos/pfnet/optuna/events","assignees_url":"https://api.github.com/repos/pfnet/optuna/assignees{/user}","branches_url":"https://api.github.com/repos/pfnet/optuna/branches{/branch}","tags_url":"https://api.github.com/repos/pfnet/optuna/tags","blobs_url":"https://api.github.com/repos/pfnet/optuna/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/pfnet/optuna/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/pfnet/optuna/git/refs{/sha}","trees_url":"https://api.github.com/repos/pfnet/optuna/git/trees{/sha}","statuses_url":"https://api.github.com/repos/pfnet/optuna/statuses/{sha}","languages_url":"https://api.github.com/repos/pfnet/optuna/languages","stargazers_url":"https://api.github.com/repos/pfnet/optuna/stargazers","contributors_url":"https://api.github.com/repos/pfnet/optuna/contributors","subscribers_url":"https://api.github.com/repos/pfnet/optuna/subscribers","subscription_url":"https://api.github.com/repos/pfnet/optuna/subscription","commits_url":"https://api.github.com/repos/pfnet/optuna/commits{/sha}","git_commits_url":"https://api.github.com/repos/pfnet/optuna/git/commits{/sha}","comments_url":"https://api.github.com/repos/pfnet/optuna/comments{/number}","issue_comment_url":"https://api.github.com/repos/pfnet/optuna/issues/comments{/number}","contents_url":"https://api.github.com/repos/pfnet/optuna/contents/{+path}","compare_url":"https://api.github.com/repos/pfnet/optuna/compare/{base}...{head}","merges_url":"https://api.github.com/repos/pfnet/optuna/merges","archive_url":"https://api.github.com/repos/pfnet/optuna/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/pfnet/optuna/downloads","issues_url":"https://api.github.com/repos/pfnet/optuna/issues{/number}","pulls_url":"https://api.github.com/repos/pfnet/optuna/pulls{/number}","milestones_url":"https://api.github.com/repos/pfnet/optuna/milestones{/number}","notifications_url":"https://api.github.com/repos/pfnet/optuna/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/pfnet/optuna/labels{/name}","releases_url":"https://api.github.com/repos/pfnet/optuna/releases{/id}","deployments_url":"https://api.github.com/repos/pfnet/optuna/deployments","created_at":"2018-02-21T06:12:56Z","updated_at":"2018-12-05T07:36:57Z","pushed_at":"2018-12-05T07:39:30Z","git_url":"git://github.com/pfnet/optuna.git","ssh_url":"git@github.com:pfnet/optuna.git","clone_url":"https://github.com/pfnet/optuna.git","svn_url":"https://github.com/pfnet/optuna","homepage":"https://optuna.org","size":958,"stargazers_count":267,"watchers_count":267,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":12,"mirror_url":null,"archived":false,"open_issues_count":12,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":12,"open_issues":12,"watchers":267,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/pfnet/optuna/pulls/242"},"html":{"href":"https://github.com/pfnet/optuna/pull/242"},"issue":{"href":"https://api.github.com/repos/pfnet/optuna/issues/242"},"comments":{"href":"https://api.github.com/repos/pfnet/optuna/issues/242/comments"},"review_comments":{"href":"https://api.github.com/repos/pfnet/optuna/pulls/242/comments"},"review_comment":{"href":"https://api.github.com/repos/pfnet/optuna/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/pfnet/optuna/pulls/242/commits"},"statuses":{"href":"https://api.github.com/repos/pfnet/optuna/statuses/2988e6fa8dadbbd95e799464e5b785265fee98ac"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"toshihikoyanase"}}