{"action":"created","comment":{"url":"https://api.github.com/repos/caskdata/cdap/pulls/comments/199912921","pull_request_review_id":134119879,"id":199912921,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDE5OTkxMjkyMQ==","diff_hunk":"@@ -404,7 +437,20 @@ public void deleteSchedules(ProgramId programId) {\n         queue.markJobsForDeletion(scheduleId, deleteTime);\n       }\n       for (ProgramSchedule programSchedule : schedules) {\n-        adminEventPublisher.publishScheduleDeletion(programSchedule.getScheduleId(), programSchedule);\n+        ScheduleId scheduleId = programSchedule.getScheduleId();\n+        adminEventPublisher.publishScheduleDeletion(scheduleId, programSchedule);\n+        // if the deleted schedule has properties with profile assignment, remove the assignment\n+        Optional<ProfileId> profileId = SystemArguments.getProfileIdFromArgs(scheduleId.getNamespaceId(),\n+                                                                             programSchedule.getProperties());\n+        if (profileId.isPresent()) {\n+          try {\n+            profileDataset.removeProfileAssignment(profileId.get(), scheduleId);\n+          } catch (NotFoundException e) {\n+            // this should not happen since the profile cannot be deleted if there is a schedule who is using it\n+            LOG.warn(\"Unable to find the profile {} when deleting schedule {}, \" +\n+                       \"therefore unable to remove the assignment\", profileId.get(), scheduleId);","path":"cdap-app-fabric/src/main/java/co/cask/cdap/scheduler/CoreSchedulerService.java","position":38,"original_position":100,"commit_id":"79d53ad5b399a34adfd6e95498227b56bc13c4c0","original_commit_id":"79d53ad5b399a34adfd6e95498227b56bc13c4c0","user":{"login":"albertshau","id":5215004,"node_id":"MDQ6VXNlcjUyMTUwMDQ=","avatar_url":"https://avatars3.githubusercontent.com/u/5215004?v=4","gravatar_id":"","url":"https://api.github.com/users/albertshau","html_url":"https://github.com/albertshau","followers_url":"https://api.github.com/users/albertshau/followers","following_url":"https://api.github.com/users/albertshau/following{/other_user}","gists_url":"https://api.github.com/users/albertshau/gists{/gist_id}","starred_url":"https://api.github.com/users/albertshau/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/albertshau/subscriptions","organizations_url":"https://api.github.com/users/albertshau/orgs","repos_url":"https://api.github.com/users/albertshau/repos","events_url":"https://api.github.com/users/albertshau/events{/privacy}","received_events_url":"https://api.github.com/users/albertshau/received_events","type":"User","site_admin":false},"body":"I think we can get rid of 'therefore unable to remove the assignment', as it's functionally the same as if it were removed. Let's change it to ' delete schedule {}, skipping assignment deletion.'","created_at":"2018-07-03T18:40:29Z","updated_at":"2018-07-03T18:42:28Z","html_url":"https://github.com/caskdata/cdap/pull/10275#discussion_r199912921","pull_request_url":"https://api.github.com/repos/caskdata/cdap/pulls/10275","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/caskdata/cdap/pulls/comments/199912921"},"html":{"href":"https://github.com/caskdata/cdap/pull/10275#discussion_r199912921"},"pull_request":{"href":"https://api.github.com/repos/caskdata/cdap/pulls/10275"}}},"pull_request":{"url":"https://api.github.com/repos/caskdata/cdap/pulls/10275","id":198600302,"node_id":"MDExOlB1bGxSZXF1ZXN0MTk4NjAwMzAy","html_url":"https://github.com/caskdata/cdap/pull/10275","diff_url":"https://github.com/caskdata/cdap/pull/10275.diff","patch_url":"https://github.com/caskdata/cdap/pull/10275.patch","issue_url":"https://api.github.com/repos/caskdata/cdap/issues/10275","number":10275,"state":"open","locked":false,"title":"CDAP-13514 add profile deletion restrictions","user":{"login":"yaojiefeng","id":12615579,"node_id":"MDQ6VXNlcjEyNjE1NTc5","avatar_url":"https://avatars0.githubusercontent.com/u/12615579?v=4","gravatar_id":"","url":"https://api.github.com/users/yaojiefeng","html_url":"https://github.com/yaojiefeng","followers_url":"https://api.github.com/users/yaojiefeng/followers","following_url":"https://api.github.com/users/yaojiefeng/following{/other_user}","gists_url":"https://api.github.com/users/yaojiefeng/gists{/gist_id}","starred_url":"https://api.github.com/users/yaojiefeng/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yaojiefeng/subscriptions","organizations_url":"https://api.github.com/users/yaojiefeng/orgs","repos_url":"https://api.github.com/users/yaojiefeng/repos","events_url":"https://api.github.com/users/yaojiefeng/events{/privacy}","received_events_url":"https://api.github.com/users/yaojiefeng/received_events","type":"User","site_admin":false},"body":"JIRA: https://issues.cask.co/browse/CDAP-13514\r\nBuild: https://builds.cask.co/browse/CDAP-DUT6532\r\nAdding restrictions to profile deletion, now a profile can only be deleted when: \r\n1. It is DISABLED,\r\n2. No entity has assignment with it\r\n3. No active program runs using it\r\nMajority changes is to let MetadataStoreDataset be able to read, write based on the passed in column name. Also rearranged some method orders so that public method comes before private methods.\r\n","created_at":"2018-07-02T08:02:06Z","updated_at":"2018-07-03T18:42:28Z","closed_at":null,"merged_at":null,"merge_commit_sha":"8f6cf1c298fb12622d7d1506a3a63cd8848a3d41","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":673594855,"node_id":"MDU6TGFiZWw2NzM1OTQ4NTU=","url":"https://api.github.com/repos/caskdata/cdap/labels/5.0","name":"5.0","color":"ff6600","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/caskdata/cdap/pulls/10275/commits","review_comments_url":"https://api.github.com/repos/caskdata/cdap/pulls/10275/comments","review_comment_url":"https://api.github.com/repos/caskdata/cdap/pulls/comments{/number}","comments_url":"https://api.github.com/repos/caskdata/cdap/issues/10275/comments","statuses_url":"https://api.github.com/repos/caskdata/cdap/statuses/79d53ad5b399a34adfd6e95498227b56bc13c4c0","head":{"label":"caskdata:feature/CDAP-13514-add-profile-deletion-restrictions","ref":"feature/CDAP-13514-add-profile-deletion-restrictions","sha":"79d53ad5b399a34adfd6e95498227b56bc13c4c0","user":{"login":"caskdata","id":8123023,"node_id":"MDEyOk9yZ2FuaXphdGlvbjgxMjMwMjM=","avatar_url":"https://avatars2.githubusercontent.com/u/8123023?v=4","gravatar_id":"","url":"https://api.github.com/users/caskdata","html_url":"https://github.com/caskdata","followers_url":"https://api.github.com/users/caskdata/followers","following_url":"https://api.github.com/users/caskdata/following{/other_user}","gists_url":"https://api.github.com/users/caskdata/gists{/gist_id}","starred_url":"https://api.github.com/users/caskdata/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/caskdata/subscriptions","organizations_url":"https://api.github.com/users/caskdata/orgs","repos_url":"https://api.github.com/users/caskdata/repos","events_url":"https://api.github.com/users/caskdata/events{/privacy}","received_events_url":"https://api.github.com/users/caskdata/received_events","type":"Organization","site_admin":false},"repo":{"id":22542759,"node_id":"MDEwOlJlcG9zaXRvcnkyMjU0Mjc1OQ==","name":"cdap","full_name":"caskdata/cdap","owner":{"login":"caskdata","id":8123023,"node_id":"MDEyOk9yZ2FuaXphdGlvbjgxMjMwMjM=","avatar_url":"https://avatars2.githubusercontent.com/u/8123023?v=4","gravatar_id":"","url":"https://api.github.com/users/caskdata","html_url":"https://github.com/caskdata","followers_url":"https://api.github.com/users/caskdata/followers","following_url":"https://api.github.com/users/caskdata/following{/other_user}","gists_url":"https://api.github.com/users/caskdata/gists{/gist_id}","starred_url":"https://api.github.com/users/caskdata/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/caskdata/subscriptions","organizations_url":"https://api.github.com/users/caskdata/orgs","repos_url":"https://api.github.com/users/caskdata/repos","events_url":"https://api.github.com/users/caskdata/events{/privacy}","received_events_url":"https://api.github.com/users/caskdata/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/caskdata/cdap","description":"A Unified Integration Platform - Cask Data Application Platform (CDAP)","fork":false,"url":"https://api.github.com/repos/caskdata/cdap","forks_url":"https://api.github.com/repos/caskdata/cdap/forks","keys_url":"https://api.github.com/repos/caskdata/cdap/keys{/key_id}","collaborators_url":"https://api.github.com/repos/caskdata/cdap/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/caskdata/cdap/teams","hooks_url":"https://api.github.com/repos/caskdata/cdap/hooks","issue_events_url":"https://api.github.com/repos/caskdata/cdap/issues/events{/number}","events_url":"https://api.github.com/repos/caskdata/cdap/events","assignees_url":"https://api.github.com/repos/caskdata/cdap/assignees{/user}","branches_url":"https://api.github.com/repos/caskdata/cdap/branches{/branch}","tags_url":"https://api.github.com/repos/caskdata/cdap/tags","blobs_url":"https://api.github.com/repos/caskdata/cdap/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/caskdata/cdap/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/caskdata/cdap/git/refs{/sha}","trees_url":"https://api.github.com/repos/caskdata/cdap/git/trees{/sha}","statuses_url":"https://api.github.com/repos/caskdata/cdap/statuses/{sha}","languages_url":"https://api.github.com/repos/caskdata/cdap/languages","stargazers_url":"https://api.github.com/repos/caskdata/cdap/stargazers","contributors_url":"https://api.github.com/repos/caskdata/cdap/contributors","subscribers_url":"https://api.github.com/repos/caskdata/cdap/subscribers","subscription_url":"https://api.github.com/repos/caskdata/cdap/subscription","commits_url":"https://api.github.com/repos/caskdata/cdap/commits{/sha}","git_commits_url":"https://api.github.com/repos/caskdata/cdap/git/commits{/sha}","comments_url":"https://api.github.com/repos/caskdata/cdap/comments{/number}","issue_comment_url":"https://api.github.com/repos/caskdata/cdap/issues/comments{/number}","contents_url":"https://api.github.com/repos/caskdata/cdap/contents/{+path}","compare_url":"https://api.github.com/repos/caskdata/cdap/compare/{base}...{head}","merges_url":"https://api.github.com/repos/caskdata/cdap/merges","archive_url":"https://api.github.com/repos/caskdata/cdap/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/caskdata/cdap/downloads","issues_url":"https://api.github.com/repos/caskdata/cdap/issues{/number}","pulls_url":"https://api.github.com/repos/caskdata/cdap/pulls{/number}","milestones_url":"https://api.github.com/repos/caskdata/cdap/milestones{/number}","notifications_url":"https://api.github.com/repos/caskdata/cdap/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/caskdata/cdap/labels{/name}","releases_url":"https://api.github.com/repos/caskdata/cdap/releases{/id}","deployments_url":"https://api.github.com/repos/caskdata/cdap/deployments","created_at":"2014-08-02T09:00:10Z","updated_at":"2018-07-03T18:07:05Z","pushed_at":"2018-07-03T18:41:25Z","git_url":"git://github.com/caskdata/cdap.git","ssh_url":"git@github.com:caskdata/cdap.git","clone_url":"https://github.com/caskdata/cdap.git","svn_url":"https://github.com/caskdata/cdap","homepage":"http://docs.cask.co/cdap","size":534825,"stargazers_count":236,"watchers_count":236,"language":"Java","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":120,"mirror_url":null,"archived":false,"open_issues_count":22,"license":{"key":"other","name":"Other","spdx_id":null,"url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":120,"open_issues":22,"watchers":236,"default_branch":"develop"}},"base":{"label":"caskdata:develop","ref":"develop","sha":"37eae0e9234e21702035e7cca8ffee0b1b91f539","user":{"login":"caskdata","id":8123023,"node_id":"MDEyOk9yZ2FuaXphdGlvbjgxMjMwMjM=","avatar_url":"https://avatars2.githubusercontent.com/u/8123023?v=4","gravatar_id":"","url":"https://api.github.com/users/caskdata","html_url":"https://github.com/caskdata","followers_url":"https://api.github.com/users/caskdata/followers","following_url":"https://api.github.com/users/caskdata/following{/other_user}","gists_url":"https://api.github.com/users/caskdata/gists{/gist_id}","starred_url":"https://api.github.com/users/caskdata/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/caskdata/subscriptions","organizations_url":"https://api.github.com/users/caskdata/orgs","repos_url":"https://api.github.com/users/caskdata/repos","events_url":"https://api.github.com/users/caskdata/events{/privacy}","received_events_url":"https://api.github.com/users/caskdata/received_events","type":"Organization","site_admin":false},"repo":{"id":22542759,"node_id":"MDEwOlJlcG9zaXRvcnkyMjU0Mjc1OQ==","name":"cdap","full_name":"caskdata/cdap","owner":{"login":"caskdata","id":8123023,"node_id":"MDEyOk9yZ2FuaXphdGlvbjgxMjMwMjM=","avatar_url":"https://avatars2.githubusercontent.com/u/8123023?v=4","gravatar_id":"","url":"https://api.github.com/users/caskdata","html_url":"https://github.com/caskdata","followers_url":"https://api.github.com/users/caskdata/followers","following_url":"https://api.github.com/users/caskdata/following{/other_user}","gists_url":"https://api.github.com/users/caskdata/gists{/gist_id}","starred_url":"https://api.github.com/users/caskdata/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/caskdata/subscriptions","organizations_url":"https://api.github.com/users/caskdata/orgs","repos_url":"https://api.github.com/users/caskdata/repos","events_url":"https://api.github.com/users/caskdata/events{/privacy}","received_events_url":"https://api.github.com/users/caskdata/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/caskdata/cdap","description":"A Unified Integration Platform - Cask Data Application Platform (CDAP)","fork":false,"url":"https://api.github.com/repos/caskdata/cdap","forks_url":"https://api.github.com/repos/caskdata/cdap/forks","keys_url":"https://api.github.com/repos/caskdata/cdap/keys{/key_id}","collaborators_url":"https://api.github.com/repos/caskdata/cdap/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/caskdata/cdap/teams","hooks_url":"https://api.github.com/repos/caskdata/cdap/hooks","issue_events_url":"https://api.github.com/repos/caskdata/cdap/issues/events{/number}","events_url":"https://api.github.com/repos/caskdata/cdap/events","assignees_url":"https://api.github.com/repos/caskdata/cdap/assignees{/user}","branches_url":"https://api.github.com/repos/caskdata/cdap/branches{/branch}","tags_url":"https://api.github.com/repos/caskdata/cdap/tags","blobs_url":"https://api.github.com/repos/caskdata/cdap/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/caskdata/cdap/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/caskdata/cdap/git/refs{/sha}","trees_url":"https://api.github.com/repos/caskdata/cdap/git/trees{/sha}","statuses_url":"https://api.github.com/repos/caskdata/cdap/statuses/{sha}","languages_url":"https://api.github.com/repos/caskdata/cdap/languages","stargazers_url":"https://api.github.com/repos/caskdata/cdap/stargazers","contributors_url":"https://api.github.com/repos/caskdata/cdap/contributors","subscribers_url":"https://api.github.com/repos/caskdata/cdap/subscribers","subscription_url":"https://api.github.com/repos/caskdata/cdap/subscription","commits_url":"https://api.github.com/repos/caskdata/cdap/commits{/sha}","git_commits_url":"https://api.github.com/repos/caskdata/cdap/git/commits{/sha}","comments_url":"https://api.github.com/repos/caskdata/cdap/comments{/number}","issue_comment_url":"https://api.github.com/repos/caskdata/cdap/issues/comments{/number}","contents_url":"https://api.github.com/repos/caskdata/cdap/contents/{+path}","compare_url":"https://api.github.com/repos/caskdata/cdap/compare/{base}...{head}","merges_url":"https://api.github.com/repos/caskdata/cdap/merges","archive_url":"https://api.github.com/repos/caskdata/cdap/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/caskdata/cdap/downloads","issues_url":"https://api.github.com/repos/caskdata/cdap/issues{/number}","pulls_url":"https://api.github.com/repos/caskdata/cdap/pulls{/number}","milestones_url":"https://api.github.com/repos/caskdata/cdap/milestones{/number}","notifications_url":"https://api.github.com/repos/caskdata/cdap/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/caskdata/cdap/labels{/name}","releases_url":"https://api.github.com/repos/caskdata/cdap/releases{/id}","deployments_url":"https://api.github.com/repos/caskdata/cdap/deployments","created_at":"2014-08-02T09:00:10Z","updated_at":"2018-07-03T18:07:05Z","pushed_at":"2018-07-03T18:41:25Z","git_url":"git://github.com/caskdata/cdap.git","ssh_url":"git@github.com:caskdata/cdap.git","clone_url":"https://github.com/caskdata/cdap.git","svn_url":"https://github.com/caskdata/cdap","homepage":"http://docs.cask.co/cdap","size":534825,"stargazers_count":236,"watchers_count":236,"language":"Java","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":120,"mirror_url":null,"archived":false,"open_issues_count":22,"license":{"key":"other","name":"Other","spdx_id":null,"url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":120,"open_issues":22,"watchers":236,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/caskdata/cdap/pulls/10275"},"html":{"href":"https://github.com/caskdata/cdap/pull/10275"},"issue":{"href":"https://api.github.com/repos/caskdata/cdap/issues/10275"},"comments":{"href":"https://api.github.com/repos/caskdata/cdap/issues/10275/comments"},"review_comments":{"href":"https://api.github.com/repos/caskdata/cdap/pulls/10275/comments"},"review_comment":{"href":"https://api.github.com/repos/caskdata/cdap/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/caskdata/cdap/pulls/10275/commits"},"statuses":{"href":"https://api.github.com/repos/caskdata/cdap/statuses/79d53ad5b399a34adfd6e95498227b56bc13c4c0"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"albertshau"}}