{"action":"opened","number":18,"pull_request":{"url":"https://api.github.com/repos/optimamodel/sciris/pulls/18","id":196840489,"node_id":"MDExOlB1bGxSZXF1ZXN0MTk2ODQwNDg5","html_url":"https://github.com/optimamodel/sciris/pull/18","diff_url":"https://github.com/optimamodel/sciris/pull/18.diff","patch_url":"https://github.com/optimamodel/sciris/pull/18.patch","issue_url":"https://api.github.com/repos/optimamodel/sciris/issues/18","number":18,"state":"open","locked":false,"title":"Task queues gc","user":{"login":"gchadder3","id":6740322,"node_id":"MDQ6VXNlcjY3NDAzMjI=","avatar_url":"https://avatars3.githubusercontent.com/u/6740322?v=4","gravatar_id":"","url":"https://api.github.com/users/gchadder3","html_url":"https://github.com/gchadder3","followers_url":"https://api.github.com/users/gchadder3/followers","following_url":"https://api.github.com/users/gchadder3/following{/other_user}","gists_url":"https://api.github.com/users/gchadder3/gists{/gist_id}","starred_url":"https://api.github.com/users/gchadder3/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gchadder3/subscriptions","organizations_url":"https://api.github.com/users/gchadder3/orgs","repos_url":"https://api.github.com/users/gchadder3/repos","events_url":"https://api.github.com/users/gchadder3/events{/privacy}","received_events_url":"https://api.github.com/users/gchadder3/received_events","type":"User","site_admin":false},"body":"Task queuing is now working.  `sciris/sciris/weblib/tasks.py` is the primary code in the Sciris framework for implementing this functionality.  It defines 2 classes: `TaskRecord` which encapsulates Redis records that are kept for each active slot which is used by an asynchronous task to be run on Celery; and `TaskDict` which encapsulates the whole collection of these TaskRecords.  It defines a function called `make_celery_instance()` that the calling code can use to build a Celery instance, and this function also creates a Celery task callback called `run_task()` that is used to call user-defined task functions that they might want to run in a separate process from the main server process.  RPCs are also defined in this file that may be called by the client to spawn and manage tsaks at a low level.  These include:\r\n* launch_task(): used to launch a new task with a particular task ID\r\n* check_task(): used to check the status of a task with a particular task ID, including whether it's queued, started, completed, or failed with an error, and how long the task has been pending and/or running\r\n* get_task_result(): used to get the final result of a task with a particular task ID\r\n* delete_task(): used to delete a task particular task ID (for cleanup)\r\nA couple of functions are also defined in `tasks.py` to set up a `@register_async_task` decorator which can be used by Sciris users to tag custom task functions.\r\n\r\nCode to test this functionality is currently in `sciris/examples/helloneighbor`.  The root step for testing is `run_rpcsclientapp.py`, so the server can be started by doing `python run_rpcsclientapp.py`.  On Linux, the Celery worker should be started via: `celery worker -A apptasks -l info` whereas in Windows that would be `celery worker -A apptasks -P eventlet`.  `apptasks.py` is the primary location for the task-testing code.   `sciris/examples/helloneighbor/vueclient_rpcs/index.html` is the location of the client webpage code.  To use this, start the server, then go to `http://localhost:8080`, hit the \"admin Login\" button, and then hit the \"Get new dots\" button with the JavaScript console up.  The results of doing a task spawning and polling for completion should come up.\r\n\r\n`sciris/examples/helloneighbor/vueclient_rpcs/task-service.js` defines a set of JavaScript functions that interface with the RPC functions to make it easy to set up launching and polling for results of tasks.  The key utility functions are `getTaskResultWaiting()` and `getTaskResultPolling()`.","created_at":"2018-06-22T20:41:09Z","updated_at":"2018-06-22T20:41:09Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/optimamodel/sciris/pulls/18/commits","review_comments_url":"https://api.github.com/repos/optimamodel/sciris/pulls/18/comments","review_comment_url":"https://api.github.com/repos/optimamodel/sciris/pulls/comments{/number}","comments_url":"https://api.github.com/repos/optimamodel/sciris/issues/18/comments","statuses_url":"https://api.github.com/repos/optimamodel/sciris/statuses/cdfe6495239483e055c82b01fa06906c87f3aa12","head":{"label":"optimamodel:task-queues-gc","ref":"task-queues-gc","sha":"cdfe6495239483e055c82b01fa06906c87f3aa12","user":{"login":"optimamodel","id":11303578,"node_id":"MDEyOk9yZ2FuaXphdGlvbjExMzAzNTc4","avatar_url":"https://avatars1.githubusercontent.com/u/11303578?v=4","gravatar_id":"","url":"https://api.github.com/users/optimamodel","html_url":"https://github.com/optimamodel","followers_url":"https://api.github.com/users/optimamodel/followers","following_url":"https://api.github.com/users/optimamodel/following{/other_user}","gists_url":"https://api.github.com/users/optimamodel/gists{/gist_id}","starred_url":"https://api.github.com/users/optimamodel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/optimamodel/subscriptions","organizations_url":"https://api.github.com/users/optimamodel/orgs","repos_url":"https://api.github.com/users/optimamodel/repos","events_url":"https://api.github.com/users/optimamodel/events{/privacy}","received_events_url":"https://api.github.com/users/optimamodel/received_events","type":"Organization","site_admin":false},"repo":{"id":99168619,"node_id":"MDEwOlJlcG9zaXRvcnk5OTE2ODYxOQ==","name":"sciris","full_name":"optimamodel/sciris","owner":{"login":"optimamodel","id":11303578,"node_id":"MDEyOk9yZ2FuaXphdGlvbjExMzAzNTc4","avatar_url":"https://avatars1.githubusercontent.com/u/11303578?v=4","gravatar_id":"","url":"https://api.github.com/users/optimamodel","html_url":"https://github.com/optimamodel","followers_url":"https://api.github.com/users/optimamodel/followers","following_url":"https://api.github.com/users/optimamodel/following{/other_user}","gists_url":"https://api.github.com/users/optimamodel/gists{/gist_id}","starred_url":"https://api.github.com/users/optimamodel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/optimamodel/subscriptions","organizations_url":"https://api.github.com/users/optimamodel/orgs","repos_url":"https://api.github.com/users/optimamodel/repos","events_url":"https://api.github.com/users/optimamodel/events{/privacy}","received_events_url":"https://api.github.com/users/optimamodel/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/optimamodel/sciris","description":"Flexible user interface for scientific simulations","fork":false,"url":"https://api.github.com/repos/optimamodel/sciris","forks_url":"https://api.github.com/repos/optimamodel/sciris/forks","keys_url":"https://api.github.com/repos/optimamodel/sciris/keys{/key_id}","collaborators_url":"https://api.github.com/repos/optimamodel/sciris/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/optimamodel/sciris/teams","hooks_url":"https://api.github.com/repos/optimamodel/sciris/hooks","issue_events_url":"https://api.github.com/repos/optimamodel/sciris/issues/events{/number}","events_url":"https://api.github.com/repos/optimamodel/sciris/events","assignees_url":"https://api.github.com/repos/optimamodel/sciris/assignees{/user}","branches_url":"https://api.github.com/repos/optimamodel/sciris/branches{/branch}","tags_url":"https://api.github.com/repos/optimamodel/sciris/tags","blobs_url":"https://api.github.com/repos/optimamodel/sciris/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/optimamodel/sciris/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/optimamodel/sciris/git/refs{/sha}","trees_url":"https://api.github.com/repos/optimamodel/sciris/git/trees{/sha}","statuses_url":"https://api.github.com/repos/optimamodel/sciris/statuses/{sha}","languages_url":"https://api.github.com/repos/optimamodel/sciris/languages","stargazers_url":"https://api.github.com/repos/optimamodel/sciris/stargazers","contributors_url":"https://api.github.com/repos/optimamodel/sciris/contributors","subscribers_url":"https://api.github.com/repos/optimamodel/sciris/subscribers","subscription_url":"https://api.github.com/repos/optimamodel/sciris/subscription","commits_url":"https://api.github.com/repos/optimamodel/sciris/commits{/sha}","git_commits_url":"https://api.github.com/repos/optimamodel/sciris/git/commits{/sha}","comments_url":"https://api.github.com/repos/optimamodel/sciris/comments{/number}","issue_comment_url":"https://api.github.com/repos/optimamodel/sciris/issues/comments{/number}","contents_url":"https://api.github.com/repos/optimamodel/sciris/contents/{+path}","compare_url":"https://api.github.com/repos/optimamodel/sciris/compare/{base}...{head}","merges_url":"https://api.github.com/repos/optimamodel/sciris/merges","archive_url":"https://api.github.com/repos/optimamodel/sciris/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/optimamodel/sciris/downloads","issues_url":"https://api.github.com/repos/optimamodel/sciris/issues{/number}","pulls_url":"https://api.github.com/repos/optimamodel/sciris/pulls{/number}","milestones_url":"https://api.github.com/repos/optimamodel/sciris/milestones{/number}","notifications_url":"https://api.github.com/repos/optimamodel/sciris/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/optimamodel/sciris/labels{/name}","releases_url":"https://api.github.com/repos/optimamodel/sciris/releases{/id}","deployments_url":"https://api.github.com/repos/optimamodel/sciris/deployments","created_at":"2017-08-02T23:11:29Z","updated_at":"2018-06-19T08:32:39Z","pushed_at":"2018-06-22T20:08:06Z","git_url":"git://github.com/optimamodel/sciris.git","ssh_url":"git@github.com:optimamodel/sciris.git","clone_url":"https://github.com/optimamodel/sciris.git","svn_url":"https://github.com/optimamodel/sciris","homepage":null,"size":1311,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":1,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":0,"open_issues":1,"watchers":0,"default_branch":"develop"}},"base":{"label":"optimamodel:develop","ref":"develop","sha":"f79e1a379c80c6616cfd12f48253df9bb1caf266","user":{"login":"optimamodel","id":11303578,"node_id":"MDEyOk9yZ2FuaXphdGlvbjExMzAzNTc4","avatar_url":"https://avatars1.githubusercontent.com/u/11303578?v=4","gravatar_id":"","url":"https://api.github.com/users/optimamodel","html_url":"https://github.com/optimamodel","followers_url":"https://api.github.com/users/optimamodel/followers","following_url":"https://api.github.com/users/optimamodel/following{/other_user}","gists_url":"https://api.github.com/users/optimamodel/gists{/gist_id}","starred_url":"https://api.github.com/users/optimamodel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/optimamodel/subscriptions","organizations_url":"https://api.github.com/users/optimamodel/orgs","repos_url":"https://api.github.com/users/optimamodel/repos","events_url":"https://api.github.com/users/optimamodel/events{/privacy}","received_events_url":"https://api.github.com/users/optimamodel/received_events","type":"Organization","site_admin":false},"repo":{"id":99168619,"node_id":"MDEwOlJlcG9zaXRvcnk5OTE2ODYxOQ==","name":"sciris","full_name":"optimamodel/sciris","owner":{"login":"optimamodel","id":11303578,"node_id":"MDEyOk9yZ2FuaXphdGlvbjExMzAzNTc4","avatar_url":"https://avatars1.githubusercontent.com/u/11303578?v=4","gravatar_id":"","url":"https://api.github.com/users/optimamodel","html_url":"https://github.com/optimamodel","followers_url":"https://api.github.com/users/optimamodel/followers","following_url":"https://api.github.com/users/optimamodel/following{/other_user}","gists_url":"https://api.github.com/users/optimamodel/gists{/gist_id}","starred_url":"https://api.github.com/users/optimamodel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/optimamodel/subscriptions","organizations_url":"https://api.github.com/users/optimamodel/orgs","repos_url":"https://api.github.com/users/optimamodel/repos","events_url":"https://api.github.com/users/optimamodel/events{/privacy}","received_events_url":"https://api.github.com/users/optimamodel/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/optimamodel/sciris","description":"Flexible user interface for scientific simulations","fork":false,"url":"https://api.github.com/repos/optimamodel/sciris","forks_url":"https://api.github.com/repos/optimamodel/sciris/forks","keys_url":"https://api.github.com/repos/optimamodel/sciris/keys{/key_id}","collaborators_url":"https://api.github.com/repos/optimamodel/sciris/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/optimamodel/sciris/teams","hooks_url":"https://api.github.com/repos/optimamodel/sciris/hooks","issue_events_url":"https://api.github.com/repos/optimamodel/sciris/issues/events{/number}","events_url":"https://api.github.com/repos/optimamodel/sciris/events","assignees_url":"https://api.github.com/repos/optimamodel/sciris/assignees{/user}","branches_url":"https://api.github.com/repos/optimamodel/sciris/branches{/branch}","tags_url":"https://api.github.com/repos/optimamodel/sciris/tags","blobs_url":"https://api.github.com/repos/optimamodel/sciris/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/optimamodel/sciris/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/optimamodel/sciris/git/refs{/sha}","trees_url":"https://api.github.com/repos/optimamodel/sciris/git/trees{/sha}","statuses_url":"https://api.github.com/repos/optimamodel/sciris/statuses/{sha}","languages_url":"https://api.github.com/repos/optimamodel/sciris/languages","stargazers_url":"https://api.github.com/repos/optimamodel/sciris/stargazers","contributors_url":"https://api.github.com/repos/optimamodel/sciris/contributors","subscribers_url":"https://api.github.com/repos/optimamodel/sciris/subscribers","subscription_url":"https://api.github.com/repos/optimamodel/sciris/subscription","commits_url":"https://api.github.com/repos/optimamodel/sciris/commits{/sha}","git_commits_url":"https://api.github.com/repos/optimamodel/sciris/git/commits{/sha}","comments_url":"https://api.github.com/repos/optimamodel/sciris/comments{/number}","issue_comment_url":"https://api.github.com/repos/optimamodel/sciris/issues/comments{/number}","contents_url":"https://api.github.com/repos/optimamodel/sciris/contents/{+path}","compare_url":"https://api.github.com/repos/optimamodel/sciris/compare/{base}...{head}","merges_url":"https://api.github.com/repos/optimamodel/sciris/merges","archive_url":"https://api.github.com/repos/optimamodel/sciris/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/optimamodel/sciris/downloads","issues_url":"https://api.github.com/repos/optimamodel/sciris/issues{/number}","pulls_url":"https://api.github.com/repos/optimamodel/sciris/pulls{/number}","milestones_url":"https://api.github.com/repos/optimamodel/sciris/milestones{/number}","notifications_url":"https://api.github.com/repos/optimamodel/sciris/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/optimamodel/sciris/labels{/name}","releases_url":"https://api.github.com/repos/optimamodel/sciris/releases{/id}","deployments_url":"https://api.github.com/repos/optimamodel/sciris/deployments","created_at":"2017-08-02T23:11:29Z","updated_at":"2018-06-19T08:32:39Z","pushed_at":"2018-06-22T20:08:06Z","git_url":"git://github.com/optimamodel/sciris.git","ssh_url":"git@github.com:optimamodel/sciris.git","clone_url":"https://github.com/optimamodel/sciris.git","svn_url":"https://github.com/optimamodel/sciris","homepage":null,"size":1311,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":1,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":0,"open_issues":1,"watchers":0,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/optimamodel/sciris/pulls/18"},"html":{"href":"https://github.com/optimamodel/sciris/pull/18"},"issue":{"href":"https://api.github.com/repos/optimamodel/sciris/issues/18"},"comments":{"href":"https://api.github.com/repos/optimamodel/sciris/issues/18/comments"},"review_comments":{"href":"https://api.github.com/repos/optimamodel/sciris/pulls/18/comments"},"review_comment":{"href":"https://api.github.com/repos/optimamodel/sciris/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/optimamodel/sciris/pulls/18/commits"},"statuses":{"href":"https://api.github.com/repos/optimamodel/sciris/statuses/cdfe6495239483e055c82b01fa06906c87f3aa12"}},"author_association":"CONTRIBUTOR","merged":false,"mergeable":null,"rebaseable":null,"mergeable_state":"unknown","merged_by":null,"comments":0,"review_comments":0,"maintainer_can_modify":false,"commits":40,"additions":1189,"deletions":32,"changed_files":14}}
{"actor":{"display_login":"gchadder3"}}