{"action":"created","comment":{"url":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/pulls/comments/199828635","pull_request_review_id":134023861,"id":199828635,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDE5OTgyODYzNQ==","diff_hunk":"@@ -215,14 +213,58 @@ def create_dask_client(args):\n       empty string to start one locally\n \n     \"\"\"\n+    import dask\n     scheduler_address = args.scheduler_address\n \n+    if scheduler_address in ('thread', 'threaded', 'threads'):","path":"server/cli_common/utils.py","position":20,"original_position":20,"commit_id":"c2be1b9331b11cf863d997b36192f375c161965b","original_commit_id":"c2be1b9331b11cf863d997b36192f375c161965b","user":{"login":"cdeepakroy","id":1923534,"node_id":"MDQ6VXNlcjE5MjM1MzQ=","avatar_url":"https://avatars1.githubusercontent.com/u/1923534?v=4","gravatar_id":"","url":"https://api.github.com/users/cdeepakroy","html_url":"https://github.com/cdeepakroy","followers_url":"https://api.github.com/users/cdeepakroy/followers","following_url":"https://api.github.com/users/cdeepakroy/following{/other_user}","gists_url":"https://api.github.com/users/cdeepakroy/gists{/gist_id}","starred_url":"https://api.github.com/users/cdeepakroy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cdeepakroy/subscriptions","organizations_url":"https://api.github.com/users/cdeepakroy/orgs","repos_url":"https://api.github.com/users/cdeepakroy/repos","events_url":"https://api.github.com/users/cdeepakroy/events{/privacy}","received_events_url":"https://api.github.com/users/cdeepakroy/received_events","type":"User","site_admin":false},"body":"@manthey I suggest using just one value instead of three. Maybe `multithreading` and `multiprocessing`","created_at":"2018-07-03T14:29:38Z","updated_at":"2018-07-03T14:29:38Z","html_url":"https://github.com/DigitalSlideArchive/HistomicsTK/pull/486#discussion_r199828635","pull_request_url":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/pulls/486","author_association":"COLLABORATOR","_links":{"self":{"href":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/pulls/comments/199828635"},"html":{"href":"https://github.com/DigitalSlideArchive/HistomicsTK/pull/486#discussion_r199828635"},"pull_request":{"href":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/pulls/486"}}},"pull_request":{"url":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/pulls/486","id":176842564,"node_id":"MDExOlB1bGxSZXF1ZXN0MTc2ODQyNTY0","html_url":"https://github.com/DigitalSlideArchive/HistomicsTK/pull/486","diff_url":"https://github.com/DigitalSlideArchive/HistomicsTK/pull/486.diff","patch_url":"https://github.com/DigitalSlideArchive/HistomicsTK/pull/486.patch","issue_url":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/issues/486","number":486,"state":"open","locked":false,"title":"Allow setting number of dask workers and threads per worker and resolve memory overload issue","user":{"login":"cdeepakroy","id":1923534,"node_id":"MDQ6VXNlcjE5MjM1MzQ=","avatar_url":"https://avatars1.githubusercontent.com/u/1923534?v=4","gravatar_id":"","url":"https://api.github.com/users/cdeepakroy","html_url":"https://github.com/cdeepakroy","followers_url":"https://api.github.com/users/cdeepakroy/followers","following_url":"https://api.github.com/users/cdeepakroy/following{/other_user}","gists_url":"https://api.github.com/users/cdeepakroy/gists{/gist_id}","starred_url":"https://api.github.com/users/cdeepakroy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cdeepakroy/subscriptions","organizations_url":"https://api.github.com/users/cdeepakroy/orgs","repos_url":"https://api.github.com/users/cdeepakroy/repos","events_url":"https://api.github.com/users/cdeepakroy/events{/privacy}","received_events_url":"https://api.github.com/users/cdeepakroy/received_events","type":"User","site_admin":false},"body":"This PR:\r\n* Adds two parameters `num_workers` and `num_threads_per_worker` to all CLIs using Dask that will allow the user to set the Number of dask workers and number of threads per each dask worker, respectively, while setting a dask cluster internally (i.e. when no scheduler address is passed).\r\n* When `num_workers` is negative (e.g. -1) then number of dask workers is set to number of physical cores (obtained using `psutils.cpu_count(logical=False)`) minus the number of workers specified. For example if `num_workers = -1`  then number of dask workers is set to `psutils.cpu_count(logical=False) - 1`. \r\n* Resolves memory overload issue by broadcasting `im_fgnd_mask_lres` to all workers before starting the dask computation in `compute_tile_foreground_fraction`.  If we don't do this, dask will make a copy of it and pickle it for each call to the dask.delayed function it is being passed to. \r\n* Lowers the `analysis_tile_size` parameters in CLIs using Dask to `1024`. The earlier setting of `4096` freezes my machine. With `1024` it runs smoothly and was able finish the NucleiDetection CLI on a `32k x 38k` pixels slide in ~7 minutes without freezing the machine. My machine has Dual Intel Xeon E5-2609 Processor with 8 cores each, 32 GB of RAM, and Ubuntu 16.04 LTS.\r\n* Also lowered the `min_radius` to 6 for more accurate results. I will make another PR with better defaults after rigorous testing on some benchmark datasets.\r\n","created_at":"2018-03-22T16:49:48Z","updated_at":"2018-07-03T14:29:38Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ebc5046458689d8369d0e75ae6556d27a5a84f54","assignee":null,"assignees":[],"requested_reviewers":[{"login":"manthey","id":8781639,"node_id":"MDQ6VXNlcjg3ODE2Mzk=","avatar_url":"https://avatars0.githubusercontent.com/u/8781639?v=4","gravatar_id":"","url":"https://api.github.com/users/manthey","html_url":"https://github.com/manthey","followers_url":"https://api.github.com/users/manthey/followers","following_url":"https://api.github.com/users/manthey/following{/other_user}","gists_url":"https://api.github.com/users/manthey/gists{/gist_id}","starred_url":"https://api.github.com/users/manthey/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/manthey/subscriptions","organizations_url":"https://api.github.com/users/manthey/orgs","repos_url":"https://api.github.com/users/manthey/repos","events_url":"https://api.github.com/users/manthey/events{/privacy}","received_events_url":"https://api.github.com/users/manthey/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/pulls/486/commits","review_comments_url":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/pulls/486/comments","review_comment_url":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/pulls/comments{/number}","comments_url":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/issues/486/comments","statuses_url":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/statuses/c2be1b9331b11cf863d997b36192f375c161965b","head":{"label":"DigitalSlideArchive:allow-setting-dask-workers","ref":"allow-setting-dask-workers","sha":"c2be1b9331b11cf863d997b36192f375c161965b","user":{"login":"DigitalSlideArchive","id":13769637,"node_id":"MDEyOk9yZ2FuaXphdGlvbjEzNzY5NjM3","avatar_url":"https://avatars2.githubusercontent.com/u/13769637?v=4","gravatar_id":"","url":"https://api.github.com/users/DigitalSlideArchive","html_url":"https://github.com/DigitalSlideArchive","followers_url":"https://api.github.com/users/DigitalSlideArchive/followers","following_url":"https://api.github.com/users/DigitalSlideArchive/following{/other_user}","gists_url":"https://api.github.com/users/DigitalSlideArchive/gists{/gist_id}","starred_url":"https://api.github.com/users/DigitalSlideArchive/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DigitalSlideArchive/subscriptions","organizations_url":"https://api.github.com/users/DigitalSlideArchive/orgs","repos_url":"https://api.github.com/users/DigitalSlideArchive/repos","events_url":"https://api.github.com/users/DigitalSlideArchive/events{/privacy}","received_events_url":"https://api.github.com/users/DigitalSlideArchive/received_events","type":"Organization","site_admin":false},"repo":{"id":44324447,"node_id":"MDEwOlJlcG9zaXRvcnk0NDMyNDQ0Nw==","name":"HistomicsTK","full_name":"DigitalSlideArchive/HistomicsTK","owner":{"login":"DigitalSlideArchive","id":13769637,"node_id":"MDEyOk9yZ2FuaXphdGlvbjEzNzY5NjM3","avatar_url":"https://avatars2.githubusercontent.com/u/13769637?v=4","gravatar_id":"","url":"https://api.github.com/users/DigitalSlideArchive","html_url":"https://github.com/DigitalSlideArchive","followers_url":"https://api.github.com/users/DigitalSlideArchive/followers","following_url":"https://api.github.com/users/DigitalSlideArchive/following{/other_user}","gists_url":"https://api.github.com/users/DigitalSlideArchive/gists{/gist_id}","starred_url":"https://api.github.com/users/DigitalSlideArchive/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DigitalSlideArchive/subscriptions","organizations_url":"https://api.github.com/users/DigitalSlideArchive/orgs","repos_url":"https://api.github.com/users/DigitalSlideArchive/repos","events_url":"https://api.github.com/users/DigitalSlideArchive/events{/privacy}","received_events_url":"https://api.github.com/users/DigitalSlideArchive/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/DigitalSlideArchive/HistomicsTK","description":"A Python and REST API for Histopathology Image Analysis","fork":false,"url":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK","forks_url":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/forks","keys_url":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/keys{/key_id}","collaborators_url":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/teams","hooks_url":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/hooks","issue_events_url":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/issues/events{/number}","events_url":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/events","assignees_url":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/assignees{/user}","branches_url":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/branches{/branch}","tags_url":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/tags","blobs_url":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/git/refs{/sha}","trees_url":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/git/trees{/sha}","statuses_url":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/statuses/{sha}","languages_url":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/languages","stargazers_url":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/stargazers","contributors_url":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/contributors","subscribers_url":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/subscribers","subscription_url":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/subscription","commits_url":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/commits{/sha}","git_commits_url":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/git/commits{/sha}","comments_url":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/comments{/number}","issue_comment_url":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/issues/comments{/number}","contents_url":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/contents/{+path}","compare_url":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/compare/{base}...{head}","merges_url":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/merges","archive_url":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/downloads","issues_url":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/issues{/number}","pulls_url":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/pulls{/number}","milestones_url":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/milestones{/number}","notifications_url":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/labels{/name}","releases_url":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/releases{/id}","deployments_url":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/deployments","created_at":"2015-10-15T14:49:21Z","updated_at":"2018-07-02T19:28:56Z","pushed_at":"2018-07-03T14:15:20Z","git_url":"git://github.com/DigitalSlideArchive/HistomicsTK.git","ssh_url":"git@github.com:DigitalSlideArchive/HistomicsTK.git","clone_url":"https://github.com/DigitalSlideArchive/HistomicsTK.git","svn_url":"https://github.com/DigitalSlideArchive/HistomicsTK","homepage":"https://digitalslidearchive.github.io/HistomicsTK/","size":51037,"stargazers_count":52,"watchers_count":52,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":23,"mirror_url":null,"archived":false,"open_issues_count":43,"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":23,"open_issues":43,"watchers":52,"default_branch":"master"}},"base":{"label":"DigitalSlideArchive:master","ref":"master","sha":"f1263e693d07bf3ed48fbedbf46a0c43dba70f7f","user":{"login":"DigitalSlideArchive","id":13769637,"node_id":"MDEyOk9yZ2FuaXphdGlvbjEzNzY5NjM3","avatar_url":"https://avatars2.githubusercontent.com/u/13769637?v=4","gravatar_id":"","url":"https://api.github.com/users/DigitalSlideArchive","html_url":"https://github.com/DigitalSlideArchive","followers_url":"https://api.github.com/users/DigitalSlideArchive/followers","following_url":"https://api.github.com/users/DigitalSlideArchive/following{/other_user}","gists_url":"https://api.github.com/users/DigitalSlideArchive/gists{/gist_id}","starred_url":"https://api.github.com/users/DigitalSlideArchive/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DigitalSlideArchive/subscriptions","organizations_url":"https://api.github.com/users/DigitalSlideArchive/orgs","repos_url":"https://api.github.com/users/DigitalSlideArchive/repos","events_url":"https://api.github.com/users/DigitalSlideArchive/events{/privacy}","received_events_url":"https://api.github.com/users/DigitalSlideArchive/received_events","type":"Organization","site_admin":false},"repo":{"id":44324447,"node_id":"MDEwOlJlcG9zaXRvcnk0NDMyNDQ0Nw==","name":"HistomicsTK","full_name":"DigitalSlideArchive/HistomicsTK","owner":{"login":"DigitalSlideArchive","id":13769637,"node_id":"MDEyOk9yZ2FuaXphdGlvbjEzNzY5NjM3","avatar_url":"https://avatars2.githubusercontent.com/u/13769637?v=4","gravatar_id":"","url":"https://api.github.com/users/DigitalSlideArchive","html_url":"https://github.com/DigitalSlideArchive","followers_url":"https://api.github.com/users/DigitalSlideArchive/followers","following_url":"https://api.github.com/users/DigitalSlideArchive/following{/other_user}","gists_url":"https://api.github.com/users/DigitalSlideArchive/gists{/gist_id}","starred_url":"https://api.github.com/users/DigitalSlideArchive/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DigitalSlideArchive/subscriptions","organizations_url":"https://api.github.com/users/DigitalSlideArchive/orgs","repos_url":"https://api.github.com/users/DigitalSlideArchive/repos","events_url":"https://api.github.com/users/DigitalSlideArchive/events{/privacy}","received_events_url":"https://api.github.com/users/DigitalSlideArchive/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/DigitalSlideArchive/HistomicsTK","description":"A Python and REST API for Histopathology Image Analysis","fork":false,"url":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK","forks_url":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/forks","keys_url":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/keys{/key_id}","collaborators_url":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/teams","hooks_url":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/hooks","issue_events_url":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/issues/events{/number}","events_url":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/events","assignees_url":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/assignees{/user}","branches_url":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/branches{/branch}","tags_url":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/tags","blobs_url":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/git/refs{/sha}","trees_url":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/git/trees{/sha}","statuses_url":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/statuses/{sha}","languages_url":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/languages","stargazers_url":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/stargazers","contributors_url":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/contributors","subscribers_url":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/subscribers","subscription_url":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/subscription","commits_url":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/commits{/sha}","git_commits_url":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/git/commits{/sha}","comments_url":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/comments{/number}","issue_comment_url":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/issues/comments{/number}","contents_url":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/contents/{+path}","compare_url":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/compare/{base}...{head}","merges_url":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/merges","archive_url":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/downloads","issues_url":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/issues{/number}","pulls_url":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/pulls{/number}","milestones_url":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/milestones{/number}","notifications_url":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/labels{/name}","releases_url":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/releases{/id}","deployments_url":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/deployments","created_at":"2015-10-15T14:49:21Z","updated_at":"2018-07-02T19:28:56Z","pushed_at":"2018-07-03T14:15:20Z","git_url":"git://github.com/DigitalSlideArchive/HistomicsTK.git","ssh_url":"git@github.com:DigitalSlideArchive/HistomicsTK.git","clone_url":"https://github.com/DigitalSlideArchive/HistomicsTK.git","svn_url":"https://github.com/DigitalSlideArchive/HistomicsTK","homepage":"https://digitalslidearchive.github.io/HistomicsTK/","size":51037,"stargazers_count":52,"watchers_count":52,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":23,"mirror_url":null,"archived":false,"open_issues_count":43,"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":23,"open_issues":43,"watchers":52,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/pulls/486"},"html":{"href":"https://github.com/DigitalSlideArchive/HistomicsTK/pull/486"},"issue":{"href":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/issues/486"},"comments":{"href":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/issues/486/comments"},"review_comments":{"href":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/pulls/486/comments"},"review_comment":{"href":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/pulls/486/commits"},"statuses":{"href":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/statuses/c2be1b9331b11cf863d997b36192f375c161965b"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"cdeepakroy"}}