{"action":"created","comment":{"url":"https://api.github.com/repos/dmwm/WMCore/pulls/comments/60606196","id":60606196,"diff_hunk":"@@ -78,6 +81,42 @@ def setupMonitors(self, task, wmbsJob):\n                 #This should be a config section\n                 monitorArgs = getattr(task.data.watchdog, monitor)\n                 args = monitorArgs.dictionary_()\n+                # Scale resources according to the HTCondor runtime environment.\n+                origCores = 1\n+                for stepName in task.listAllStepNames():\n+                    sh = task.getStepHelper(stepName)\n+                    origCores = max(origCores, sh.getNumberOfCores())\n+                resources = {'cores': origCores}\n+                origMaxRSS = args.get('maxRSS')\n+                if origMaxRSS:\n+                    origMaxRSS = int(origMaxRSS/1000.) # HTCondor expects MB; we get KB.\n+                    resources['memory'] = origMaxRSS\n+                # Actually parses the HTCondor runtime\n+                resizeResources(resources)\n+                # HTCondor doesn't explicitly scale VSize; it's also not clear what\n+                # resources this manages (as we already watch the memory use) or how\n+                # it should relate to other resources (such as memory or cores used).\n+                # Hence, we simply remove it if we change anything about the memory.\n+                if origMaxRSS and (resources['memory'] != origMaxRSS) and ('maxVSize' in args):\n+                    del args['maxVSize']\n+                # Scale our timeouts according to the scaling of the cores.  *NOTE*\n+                # the job ad contains the real scaling here - unfortunately, it uses\n+                # ClassAd expressions and we can only parse values.  Something for the\n+                # future.\n+                # As the scaling is not perfectly linear (efficiency is closer to 95%),\n+                # we add a somewhat-arbitrarily-chosen 60 minutes (timeouts are in seconds).\n+                coreScaling = resources['cores'] / origCores","path":"src/python/WMCore/WMRuntime/Watchdog.py","position":45,"original_position":45,"commit_id":"1fb67ed12e5900e0976e06dc7b8858a7ba016ff5","original_commit_id":"1fb67ed12e5900e0976e06dc7b8858a7ba016ff5","user":{"login":"bbockelm","id":1093447,"avatar_url":"https://avatars.githubusercontent.com/u/1093447?v=3","gravatar_id":"","url":"https://api.github.com/users/bbockelm","html_url":"https://github.com/bbockelm","followers_url":"https://api.github.com/users/bbockelm/followers","following_url":"https://api.github.com/users/bbockelm/following{/other_user}","gists_url":"https://api.github.com/users/bbockelm/gists{/gist_id}","starred_url":"https://api.github.com/users/bbockelm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bbockelm/subscriptions","organizations_url":"https://api.github.com/users/bbockelm/orgs","repos_url":"https://api.github.com/users/bbockelm/repos","events_url":"https://api.github.com/users/bbockelm/events{/privacy}","received_events_url":"https://api.github.com/users/bbockelm/received_events","type":"User","site_admin":false},"body":"If the `cores` is unchanged, the scale factor should be 1, right?","created_at":"2016-04-21T15:51:21Z","updated_at":"2016-04-21T15:51:21Z","html_url":"https://github.com/dmwm/WMCore/pull/6757#discussion_r60606196","pull_request_url":"https://api.github.com/repos/dmwm/WMCore/pulls/6757","_links":{"self":{"href":"https://api.github.com/repos/dmwm/WMCore/pulls/comments/60606196"},"html":{"href":"https://github.com/dmwm/WMCore/pull/6757#discussion_r60606196"},"pull_request":{"href":"https://api.github.com/repos/dmwm/WMCore/pulls/6757"}}},"pull_request":{"url":"https://api.github.com/repos/dmwm/WMCore/pulls/6757","id":64465228,"html_url":"https://github.com/dmwm/WMCore/pull/6757","diff_url":"https://github.com/dmwm/WMCore/pull/6757.diff","patch_url":"https://github.com/dmwm/WMCore/pull/6757.patch","issue_url":"https://api.github.com/repos/dmwm/WMCore/issues/6757","number":6757,"state":"open","locked":false,"title":"Allow runtime environment to resize the cores in the job.","user":{"login":"bbockelm","id":1093447,"avatar_url":"https://avatars.githubusercontent.com/u/1093447?v=3","gravatar_id":"","url":"https://api.github.com/users/bbockelm","html_url":"https://github.com/bbockelm","followers_url":"https://api.github.com/users/bbockelm/followers","following_url":"https://api.github.com/users/bbockelm/following{/other_user}","gists_url":"https://api.github.com/users/bbockelm/gists{/gist_id}","starred_url":"https://api.github.com/users/bbockelm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bbockelm/subscriptions","organizations_url":"https://api.github.com/users/bbockelm/orgs","repos_url":"https://api.github.com/users/bbockelm/repos","events_url":"https://api.github.com/users/bbockelm/events{/privacy}","received_events_url":"https://api.github.com/users/bbockelm/received_events","type":"User","site_admin":false},"body":"This allows WMRuntime to resize the number of threads in the pset\r\n*if* the job is in the condor runtime environment (`_CONDOR_MACHINE_AD`\r\nenv var is set and the slot's ad is in the referenced file), the\r\n`Cpus` attribute is set to an integer, and `WMCore_ResizeJob` is set to\r\n`true`.\r\n\r\nSo, by default this does nothing.  However, Ops can then explicitly\r\nenable job resizing (and setting `RequestCpus` and `RequestMemory`\r\nappropriately to reflect this) for a given workflow or subtask in\r\ncondor.  Since I suspect we'll need to experiment a bit with the\r\ncorrect values for `RequestMemory` / `RequestCpus`, I don't currently\r\nchange those in the `CondorPlugin`.\r\n\r\nThis just gives us the flexibility to explore the phase space.\r\n\r\nCases of the `resizeCores` function tested by hand:\r\n  - When `_CONDOR_MACHINE_AD` env var is missing.\r\n  - When machine ad is unparseable.\r\n  - When resize job attribute is missing, true, or false.\r\n  - Non-parseable values for `Cpus` or `WMCore_ResizeJob`\r\n  - `Cpus` is greater than, equal to, or less than numCores","created_at":"2016-03-29T13:29:52Z","updated_at":"2016-04-21T15:51:21Z","closed_at":null,"merged_at":null,"merge_commit_sha":"9095a1d0b7702ba307ac0de6da413425338910de","assignee":{"login":"bbockelm","id":1093447,"avatar_url":"https://avatars.githubusercontent.com/u/1093447?v=3","gravatar_id":"","url":"https://api.github.com/users/bbockelm","html_url":"https://github.com/bbockelm","followers_url":"https://api.github.com/users/bbockelm/followers","following_url":"https://api.github.com/users/bbockelm/following{/other_user}","gists_url":"https://api.github.com/users/bbockelm/gists{/gist_id}","starred_url":"https://api.github.com/users/bbockelm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bbockelm/subscriptions","organizations_url":"https://api.github.com/users/bbockelm/orgs","repos_url":"https://api.github.com/users/bbockelm/repos","events_url":"https://api.github.com/users/bbockelm/events{/privacy}","received_events_url":"https://api.github.com/users/bbockelm/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/dmwm/WMCore/pulls/6757/commits","review_comments_url":"https://api.github.com/repos/dmwm/WMCore/pulls/6757/comments","review_comment_url":"https://api.github.com/repos/dmwm/WMCore/pulls/comments{/number}","comments_url":"https://api.github.com/repos/dmwm/WMCore/issues/6757/comments","statuses_url":"https://api.github.com/repos/dmwm/WMCore/statuses/1fb67ed12e5900e0976e06dc7b8858a7ba016ff5","head":{"label":"bbockelm:resizeCpus","ref":"resizeCpus","sha":"1fb67ed12e5900e0976e06dc7b8858a7ba016ff5","user":{"login":"bbockelm","id":1093447,"avatar_url":"https://avatars.githubusercontent.com/u/1093447?v=3","gravatar_id":"","url":"https://api.github.com/users/bbockelm","html_url":"https://github.com/bbockelm","followers_url":"https://api.github.com/users/bbockelm/followers","following_url":"https://api.github.com/users/bbockelm/following{/other_user}","gists_url":"https://api.github.com/users/bbockelm/gists{/gist_id}","starred_url":"https://api.github.com/users/bbockelm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bbockelm/subscriptions","organizations_url":"https://api.github.com/users/bbockelm/orgs","repos_url":"https://api.github.com/users/bbockelm/repos","events_url":"https://api.github.com/users/bbockelm/events{/privacy}","received_events_url":"https://api.github.com/users/bbockelm/received_events","type":"User","site_admin":false},"repo":{"id":6643641,"name":"WMCore","full_name":"bbockelm/WMCore","owner":{"login":"bbockelm","id":1093447,"avatar_url":"https://avatars.githubusercontent.com/u/1093447?v=3","gravatar_id":"","url":"https://api.github.com/users/bbockelm","html_url":"https://github.com/bbockelm","followers_url":"https://api.github.com/users/bbockelm/followers","following_url":"https://api.github.com/users/bbockelm/following{/other_user}","gists_url":"https://api.github.com/users/bbockelm/gists{/gist_id}","starred_url":"https://api.github.com/users/bbockelm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bbockelm/subscriptions","organizations_url":"https://api.github.com/users/bbockelm/orgs","repos_url":"https://api.github.com/users/bbockelm/repos","events_url":"https://api.github.com/users/bbockelm/events{/privacy}","received_events_url":"https://api.github.com/users/bbockelm/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/bbockelm/WMCore","description":"WMCore","fork":true,"url":"https://api.github.com/repos/bbockelm/WMCore","forks_url":"https://api.github.com/repos/bbockelm/WMCore/forks","keys_url":"https://api.github.com/repos/bbockelm/WMCore/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bbockelm/WMCore/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bbockelm/WMCore/teams","hooks_url":"https://api.github.com/repos/bbockelm/WMCore/hooks","issue_events_url":"https://api.github.com/repos/bbockelm/WMCore/issues/events{/number}","events_url":"https://api.github.com/repos/bbockelm/WMCore/events","assignees_url":"https://api.github.com/repos/bbockelm/WMCore/assignees{/user}","branches_url":"https://api.github.com/repos/bbockelm/WMCore/branches{/branch}","tags_url":"https://api.github.com/repos/bbockelm/WMCore/tags","blobs_url":"https://api.github.com/repos/bbockelm/WMCore/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bbockelm/WMCore/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bbockelm/WMCore/git/refs{/sha}","trees_url":"https://api.github.com/repos/bbockelm/WMCore/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bbockelm/WMCore/statuses/{sha}","languages_url":"https://api.github.com/repos/bbockelm/WMCore/languages","stargazers_url":"https://api.github.com/repos/bbockelm/WMCore/stargazers","contributors_url":"https://api.github.com/repos/bbockelm/WMCore/contributors","subscribers_url":"https://api.github.com/repos/bbockelm/WMCore/subscribers","subscription_url":"https://api.github.com/repos/bbockelm/WMCore/subscription","commits_url":"https://api.github.com/repos/bbockelm/WMCore/commits{/sha}","git_commits_url":"https://api.github.com/repos/bbockelm/WMCore/git/commits{/sha}","comments_url":"https://api.github.com/repos/bbockelm/WMCore/comments{/number}","issue_comment_url":"https://api.github.com/repos/bbockelm/WMCore/issues/comments{/number}","contents_url":"https://api.github.com/repos/bbockelm/WMCore/contents/{+path}","compare_url":"https://api.github.com/repos/bbockelm/WMCore/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bbockelm/WMCore/merges","archive_url":"https://api.github.com/repos/bbockelm/WMCore/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bbockelm/WMCore/downloads","issues_url":"https://api.github.com/repos/bbockelm/WMCore/issues{/number}","pulls_url":"https://api.github.com/repos/bbockelm/WMCore/pulls{/number}","milestones_url":"https://api.github.com/repos/bbockelm/WMCore/milestones{/number}","notifications_url":"https://api.github.com/repos/bbockelm/WMCore/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bbockelm/WMCore/labels{/name}","releases_url":"https://api.github.com/repos/bbockelm/WMCore/releases{/id}","deployments_url":"https://api.github.com/repos/bbockelm/WMCore/deployments","created_at":"2012-11-11T20:00:43Z","updated_at":"2015-12-08T03:27:36Z","pushed_at":"2016-04-19T14:18:09Z","git_url":"git://github.com/bbockelm/WMCore.git","ssh_url":"git@github.com:bbockelm/WMCore.git","clone_url":"https://github.com/bbockelm/WMCore.git","svn_url":"https://github.com/bbockelm/WMCore","homepage":"https://svnweb.cern.ch/trac/CMSDMWM/","size":26629,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"dmwm:master","ref":"master","sha":"e98720e554068b6d1e9e5c1d47ffaee4d81f7bce","user":{"login":"dmwm","id":988897,"avatar_url":"https://avatars.githubusercontent.com/u/988897?v=3","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://avatars.githubusercontent.com/u/988897?v=3","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":"2016-04-07T15:35:34Z","pushed_at":"2016-04-21T13:20:55Z","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":29562,"stargazers_count":24,"watchers_count":24,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":52,"mirror_url":null,"open_issues_count":388,"forks":52,"open_issues":388,"watchers":24,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/dmwm/WMCore/pulls/6757"},"html":{"href":"https://github.com/dmwm/WMCore/pull/6757"},"issue":{"href":"https://api.github.com/repos/dmwm/WMCore/issues/6757"},"comments":{"href":"https://api.github.com/repos/dmwm/WMCore/issues/6757/comments"},"review_comments":{"href":"https://api.github.com/repos/dmwm/WMCore/pulls/6757/comments"},"review_comment":{"href":"https://api.github.com/repos/dmwm/WMCore/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/dmwm/WMCore/pulls/6757/commits"},"statuses":{"href":"https://api.github.com/repos/dmwm/WMCore/statuses/1fb67ed12e5900e0976e06dc7b8858a7ba016ff5"}}}}