{"action":"created","comment":{"url":"https://api.github.com/repos/dmwm/WMCore/pulls/comments/186107392","pull_request_review_id":117635932,"id":186107392,"diff_hunk":"@@ -883,3 +885,167 @@ def listDatasetParents(self, childDataset):\n             msg += \"DBSReader.listDatasetParents(%s)\\n\" % childDataset\n             msg += \"%s\\n\" % formatEx3(ex)\n             raise DBSReaderError(msg)\n+\n+    def getParentFilesGivenParentDataset(self, parentDataset, childLFN):","path":"src/python/WMCore/Services/DBS/DBS3Reader.py","position":14,"original_position":14,"commit_id":"bc0ac190cc4d59edb070efe51012ca4a11a83e72","original_commit_id":"bc0ac190cc4d59edb070efe51012ca4a11a83e72","user":{"login":"vkuznet","id":125138,"avatar_url":"https://avatars0.githubusercontent.com/u/125138?v=4","gravatar_id":"","url":"https://api.github.com/users/vkuznet","html_url":"https://github.com/vkuznet","followers_url":"https://api.github.com/users/vkuznet/followers","following_url":"https://api.github.com/users/vkuznet/following{/other_user}","gists_url":"https://api.github.com/users/vkuznet/gists{/gist_id}","starred_url":"https://api.github.com/users/vkuznet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vkuznet/subscriptions","organizations_url":"https://api.github.com/users/vkuznet/orgs","repos_url":"https://api.github.com/users/vkuznet/repos","events_url":"https://api.github.com/users/vkuznet/events{/privacy}","received_events_url":"https://api.github.com/users/vkuznet/received_events","type":"User","site_admin":false},"body":"This function should be easily parallelizeable, but it requires complete change of its logic and tools. I'll provide here a recipe and pointers and you can look/adjust the code. First, you need pycurl_manager getdata function\r\n```\r\nfrom WMCore.Services.pycurl_manager import getdata as multi_getdata\r\n```\r\nThen you need to construct a list of urls you're going to concurrently send to DBS, e.g.\r\n```\r\nuri = /dbs_uri # replace with main DBS URI\r\nurls = [\"%s/parents?run_num=%s&lumi_list=%s\" % (uri, f['run_num'], f['lumi_section_num']) for f in fInfo]\r\n```\r\nthen you can implement similar logic as shown here:\r\nhttps://github.com/dmwm/WMCore/blob/master/src/python/WMCore/MicroService/Unified/RequestInfo.py#L150\r\nFor example:\r\n```\r\ndata = multi_getdata(urls, ckey(), cert())\r\nparentFiles = []\r\nfor row in data:\r\n     # request url\r\n     req = row['url'].split('/')[-1]\r\n     # response data\r\n     data = json.loads(row['data'])\r\n     # parse data here and extract file name from response\r\n     parentFiles.append( data['logical_file_name'] ) # replace logical_file_name with whatever key DBS uses in response\r\n```\r\nSo, to sum-up.\r\n1. you will not use dbs client APIs since they do not support concurrency\r\n2. you construct list of all urls you want to fetch at once\r\n3. multi_getdata will do proper thing: it will place all calls concurrently and do not saturate DBS server (internally it split input list of urls in to a chunk (default size is 100) and send the chunks).\r\n4. you'll collect results from pycurl and extract responses and construct your output.","created_at":"2018-05-04T14:51:20Z","updated_at":"2018-05-04T14:51:20Z","html_url":"https://github.com/dmwm/WMCore/pull/8593#discussion_r186107392","pull_request_url":"https://api.github.com/repos/dmwm/WMCore/pulls/8593","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/dmwm/WMCore/pulls/comments/186107392"},"html":{"href":"https://github.com/dmwm/WMCore/pull/8593#discussion_r186107392"},"pull_request":{"href":"https://api.github.com/repos/dmwm/WMCore/pulls/8593"}}},"pull_request":{"url":"https://api.github.com/repos/dmwm/WMCore/pulls/8593","id":185246735,"html_url":"https://github.com/dmwm/WMCore/pull/8593","diff_url":"https://github.com/dmwm/WMCore/pull/8593.diff","patch_url":"https://github.com/dmwm/WMCore/pull/8593.patch","issue_url":"https://api.github.com/repos/dmwm/WMCore/issues/8593","number":8593,"state":"open","locked":false,"title":"add api for searching missing parentage","user":{"login":"ticoann","id":1247993,"avatar_url":"https://avatars0.githubusercontent.com/u/1247993?v=4","gravatar_id":"","url":"https://api.github.com/users/ticoann","html_url":"https://github.com/ticoann","followers_url":"https://api.github.com/users/ticoann/followers","following_url":"https://api.github.com/users/ticoann/following{/other_user}","gists_url":"https://api.github.com/users/ticoann/gists{/gist_id}","starred_url":"https://api.github.com/users/ticoann/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ticoann/subscriptions","organizations_url":"https://api.github.com/users/ticoann/orgs","repos_url":"https://api.github.com/users/ticoann/repos","events_url":"https://api.github.com/users/ticoann/events{/privacy}","received_events_url":"https://api.github.com/users/ticoann/received_events","type":"User","site_admin":false},"body":"fixes #8590 \r\nstill need to discuss APIs' functions and signatures. Just initial attempt start discussion.","created_at":"2018-05-01T18:50:45Z","updated_at":"2018-05-04T14:51:20Z","closed_at":null,"merged_at":null,"merge_commit_sha":"3186d5b27725da48f4a3648f95ed2505fc57c3d0","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":311378297,"url":"https://api.github.com/repos/dmwm/WMCore/labels/Do%20not%20merge%20yet","name":"Do not merge yet","color":"fbca04","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/dmwm/WMCore/pulls/8593/commits","review_comments_url":"https://api.github.com/repos/dmwm/WMCore/pulls/8593/comments","review_comment_url":"https://api.github.com/repos/dmwm/WMCore/pulls/comments{/number}","comments_url":"https://api.github.com/repos/dmwm/WMCore/issues/8593/comments","statuses_url":"https://api.github.com/repos/dmwm/WMCore/statuses/bc0ac190cc4d59edb070efe51012ca4a11a83e72","head":{"label":"ticoann:add_missing_parent_search_api","ref":"add_missing_parent_search_api","sha":"bc0ac190cc4d59edb070efe51012ca4a11a83e72","user":{"login":"ticoann","id":1247993,"avatar_url":"https://avatars0.githubusercontent.com/u/1247993?v=4","gravatar_id":"","url":"https://api.github.com/users/ticoann","html_url":"https://github.com/ticoann","followers_url":"https://api.github.com/users/ticoann/followers","following_url":"https://api.github.com/users/ticoann/following{/other_user}","gists_url":"https://api.github.com/users/ticoann/gists{/gist_id}","starred_url":"https://api.github.com/users/ticoann/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ticoann/subscriptions","organizations_url":"https://api.github.com/users/ticoann/orgs","repos_url":"https://api.github.com/users/ticoann/repos","events_url":"https://api.github.com/users/ticoann/events{/privacy}","received_events_url":"https://api.github.com/users/ticoann/received_events","type":"User","site_admin":false},"repo":{"id":2935076,"name":"WMCore","full_name":"ticoann/WMCore","owner":{"login":"ticoann","id":1247993,"avatar_url":"https://avatars0.githubusercontent.com/u/1247993?v=4","gravatar_id":"","url":"https://api.github.com/users/ticoann","html_url":"https://github.com/ticoann","followers_url":"https://api.github.com/users/ticoann/followers","following_url":"https://api.github.com/users/ticoann/following{/other_user}","gists_url":"https://api.github.com/users/ticoann/gists{/gist_id}","starred_url":"https://api.github.com/users/ticoann/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ticoann/subscriptions","organizations_url":"https://api.github.com/users/ticoann/orgs","repos_url":"https://api.github.com/users/ticoann/repos","events_url":"https://api.github.com/users/ticoann/events{/privacy}","received_events_url":"https://api.github.com/users/ticoann/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ticoann/WMCore","description":"WMCore","fork":true,"url":"https://api.github.com/repos/ticoann/WMCore","forks_url":"https://api.github.com/repos/ticoann/WMCore/forks","keys_url":"https://api.github.com/repos/ticoann/WMCore/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ticoann/WMCore/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ticoann/WMCore/teams","hooks_url":"https://api.github.com/repos/ticoann/WMCore/hooks","issue_events_url":"https://api.github.com/repos/ticoann/WMCore/issues/events{/number}","events_url":"https://api.github.com/repos/ticoann/WMCore/events","assignees_url":"https://api.github.com/repos/ticoann/WMCore/assignees{/user}","branches_url":"https://api.github.com/repos/ticoann/WMCore/branches{/branch}","tags_url":"https://api.github.com/repos/ticoann/WMCore/tags","blobs_url":"https://api.github.com/repos/ticoann/WMCore/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ticoann/WMCore/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ticoann/WMCore/git/refs{/sha}","trees_url":"https://api.github.com/repos/ticoann/WMCore/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ticoann/WMCore/statuses/{sha}","languages_url":"https://api.github.com/repos/ticoann/WMCore/languages","stargazers_url":"https://api.github.com/repos/ticoann/WMCore/stargazers","contributors_url":"https://api.github.com/repos/ticoann/WMCore/contributors","subscribers_url":"https://api.github.com/repos/ticoann/WMCore/subscribers","subscription_url":"https://api.github.com/repos/ticoann/WMCore/subscription","commits_url":"https://api.github.com/repos/ticoann/WMCore/commits{/sha}","git_commits_url":"https://api.github.com/repos/ticoann/WMCore/git/commits{/sha}","comments_url":"https://api.github.com/repos/ticoann/WMCore/comments{/number}","issue_comment_url":"https://api.github.com/repos/ticoann/WMCore/issues/comments{/number}","contents_url":"https://api.github.com/repos/ticoann/WMCore/contents/{+path}","compare_url":"https://api.github.com/repos/ticoann/WMCore/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ticoann/WMCore/merges","archive_url":"https://api.github.com/repos/ticoann/WMCore/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ticoann/WMCore/downloads","issues_url":"https://api.github.com/repos/ticoann/WMCore/issues{/number}","pulls_url":"https://api.github.com/repos/ticoann/WMCore/pulls{/number}","milestones_url":"https://api.github.com/repos/ticoann/WMCore/milestones{/number}","notifications_url":"https://api.github.com/repos/ticoann/WMCore/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ticoann/WMCore/labels{/name}","releases_url":"https://api.github.com/repos/ticoann/WMCore/releases{/id}","deployments_url":"https://api.github.com/repos/ticoann/WMCore/deployments","created_at":"2011-12-07T19:34:12Z","updated_at":"2017-03-10T15:20:38Z","pushed_at":"2018-05-02T15:44:19Z","git_url":"git://github.com/ticoann/WMCore.git","ssh_url":"git@github.com:ticoann/WMCore.git","clone_url":"https://github.com/ticoann/WMCore.git","svn_url":"https://github.com/ticoann/WMCore","homepage":"https://svnweb.cern.ch/trac/CMSDMWM/","size":34634,"stargazers_count":3,"watchers_count":3,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3,"mirror_url":null,"archived":false,"open_issues_count":1,"license":null,"forks":3,"open_issues":1,"watchers":3,"default_branch":"master"}},"base":{"label":"dmwm:master","ref":"master","sha":"4741b62ddc93d04202f2d88d5d13a58117febffd","user":{"login":"dmwm","id":988897,"avatar_url":"https://avatars3.githubusercontent.com/u/988897?v=4","gravatar_id":"","url":"https://api.github.com/users/dmwm","html_url":"https://github.com/dmwm","followers_url":"https://api.github.com/users/dmwm/followers","following_url":"https://api.github.com/users/dmwm/following{/other_user}","gists_url":"https://api.github.com/users/dmwm/gists{/gist_id}","starred_url":"https://api.github.com/users/dmwm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dmwm/subscriptions","organizations_url":"https://api.github.com/users/dmwm/orgs","repos_url":"https://api.github.com/users/dmwm/repos","events_url":"https://api.github.com/users/dmwm/events{/privacy}","received_events_url":"https://api.github.com/users/dmwm/received_events","type":"Organization","site_admin":false},"repo":{"id":2370458,"name":"WMCore","full_name":"dmwm/WMCore","owner":{"login":"dmwm","id":988897,"avatar_url":"https://avatars3.githubusercontent.com/u/988897?v=4","gravatar_id":"","url":"https://api.github.com/users/dmwm","html_url":"https://github.com/dmwm","followers_url":"https://api.github.com/users/dmwm/followers","following_url":"https://api.github.com/users/dmwm/following{/other_user}","gists_url":"https://api.github.com/users/dmwm/gists{/gist_id}","starred_url":"https://api.github.com/users/dmwm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dmwm/subscriptions","organizations_url":"https://api.github.com/users/dmwm/orgs","repos_url":"https://api.github.com/users/dmwm/repos","events_url":"https://api.github.com/users/dmwm/events{/privacy}","received_events_url":"https://api.github.com/users/dmwm/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/dmwm/WMCore","description":"WMCore","fork":false,"url":"https://api.github.com/repos/dmwm/WMCore","forks_url":"https://api.github.com/repos/dmwm/WMCore/forks","keys_url":"https://api.github.com/repos/dmwm/WMCore/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dmwm/WMCore/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dmwm/WMCore/teams","hooks_url":"https://api.github.com/repos/dmwm/WMCore/hooks","issue_events_url":"https://api.github.com/repos/dmwm/WMCore/issues/events{/number}","events_url":"https://api.github.com/repos/dmwm/WMCore/events","assignees_url":"https://api.github.com/repos/dmwm/WMCore/assignees{/user}","branches_url":"https://api.github.com/repos/dmwm/WMCore/branches{/branch}","tags_url":"https://api.github.com/repos/dmwm/WMCore/tags","blobs_url":"https://api.github.com/repos/dmwm/WMCore/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dmwm/WMCore/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dmwm/WMCore/git/refs{/sha}","trees_url":"https://api.github.com/repos/dmwm/WMCore/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dmwm/WMCore/statuses/{sha}","languages_url":"https://api.github.com/repos/dmwm/WMCore/languages","stargazers_url":"https://api.github.com/repos/dmwm/WMCore/stargazers","contributors_url":"https://api.github.com/repos/dmwm/WMCore/contributors","subscribers_url":"https://api.github.com/repos/dmwm/WMCore/subscribers","subscription_url":"https://api.github.com/repos/dmwm/WMCore/subscription","commits_url":"https://api.github.com/repos/dmwm/WMCore/commits{/sha}","git_commits_url":"https://api.github.com/repos/dmwm/WMCore/git/commits{/sha}","comments_url":"https://api.github.com/repos/dmwm/WMCore/comments{/number}","issue_comment_url":"https://api.github.com/repos/dmwm/WMCore/issues/comments{/number}","contents_url":"https://api.github.com/repos/dmwm/WMCore/contents/{+path}","compare_url":"https://api.github.com/repos/dmwm/WMCore/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dmwm/WMCore/merges","archive_url":"https://api.github.com/repos/dmwm/WMCore/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dmwm/WMCore/downloads","issues_url":"https://api.github.com/repos/dmwm/WMCore/issues{/number}","pulls_url":"https://api.github.com/repos/dmwm/WMCore/pulls{/number}","milestones_url":"https://api.github.com/repos/dmwm/WMCore/milestones{/number}","notifications_url":"https://api.github.com/repos/dmwm/WMCore/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dmwm/WMCore/labels{/name}","releases_url":"https://api.github.com/repos/dmwm/WMCore/releases{/id}","deployments_url":"https://api.github.com/repos/dmwm/WMCore/deployments","created_at":"2011-09-12T10:37:21Z","updated_at":"2018-04-30T18:49:41Z","pushed_at":"2018-05-04T13:20:48Z","git_url":"git://github.com/dmwm/WMCore.git","ssh_url":"git@github.com:dmwm/WMCore.git","clone_url":"https://github.com/dmwm/WMCore.git","svn_url":"https://github.com/dmwm/WMCore","homepage":"https://svnweb.cern.ch/trac/CMSDMWM/","size":34888,"stargazers_count":24,"watchers_count":24,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":68,"mirror_url":null,"archived":false,"open_issues_count":248,"license":null,"forks":68,"open_issues":248,"watchers":24,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/dmwm/WMCore/pulls/8593"},"html":{"href":"https://github.com/dmwm/WMCore/pull/8593"},"issue":{"href":"https://api.github.com/repos/dmwm/WMCore/issues/8593"},"comments":{"href":"https://api.github.com/repos/dmwm/WMCore/issues/8593/comments"},"review_comments":{"href":"https://api.github.com/repos/dmwm/WMCore/pulls/8593/comments"},"review_comment":{"href":"https://api.github.com/repos/dmwm/WMCore/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/dmwm/WMCore/pulls/8593/commits"},"statuses":{"href":"https://api.github.com/repos/dmwm/WMCore/statuses/bc0ac190cc4d59edb070efe51012ca4a11a83e72"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"vkuznet"}}