{"action":"created","comment":{"url":"https://api.github.com/repos/rstudio/rstudio/pulls/comments/193437897","pull_request_review_id":126409918,"id":193437897,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDE5MzQzNzg5Nw==","diff_hunk":"@@ -0,0 +1,184 @@\n+/*\n+ * JobsApi.cpp\n+ *\n+ * Copyright (C) 2009-18 by RStudio, Inc.\n+ *\n+ * Unless you have received this program directly from RStudio pursuant\n+ * to the terms of a commercial license agreement with RStudio, then\n+ * this program is licensed to you under the terms of version 3 of the\n+ * GNU Affero General Public License. This program is distributed WITHOUT\n+ * ANY EXPRESS OR IMPLIED WARRANTY, INCLUDING THOSE OF NON-INFRINGEMENT,\n+ * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Please refer to the\n+ * AGPL (http://www.gnu.org/licenses/agpl-3.0.txt) for more details.\n+ *\n+ */\n+\n+#include <session/SessionModuleContext.hpp>\n+ \n+#include \"JobsApi.hpp\"\n+\n+enum JobUpdateType\n+{\n+   JobAdded   = 0,\n+   JobUpdated = 1,\n+   JobRemoved = 2\n+};\n+\n+using namespace rstudio::core;\n+\n+namespace rstudio {\n+namespace session {\n+namespace modules {      \n+namespace jobs {\n+\n+namespace {\n+\n+// map of job ID to jobs\n+std::map<std::string, boost::shared_ptr<Job> > s_jobs;","path":"src/cpp/session/modules/jobs/JobsApi.cpp","position":37,"original_position":37,"commit_id":"a2dffb0f5b36f509a5aa19085ff083d9c3f0829b","original_commit_id":"a2dffb0f5b36f509a5aa19085ff083d9c3f0829b","user":{"login":"kevinushey","id":1976582,"node_id":"MDQ6VXNlcjE5NzY1ODI=","avatar_url":"https://avatars1.githubusercontent.com/u/1976582?v=4","gravatar_id":"","url":"https://api.github.com/users/kevinushey","html_url":"https://github.com/kevinushey","followers_url":"https://api.github.com/users/kevinushey/followers","following_url":"https://api.github.com/users/kevinushey/following{/other_user}","gists_url":"https://api.github.com/users/kevinushey/gists{/gist_id}","starred_url":"https://api.github.com/users/kevinushey/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kevinushey/subscriptions","organizations_url":"https://api.github.com/users/kevinushey/orgs","repos_url":"https://api.github.com/users/kevinushey/repos","events_url":"https://api.github.com/users/kevinushey/events{/privacy}","received_events_url":"https://api.github.com/users/kevinushey/received_events","type":"User","site_admin":false},"body":"For context: https://github.com/rstudio/rstudio/blob/9a2cd883d53a98b7b6c0957d6fc492e673ee5aac/src/cpp/session/SessionRpc.cpp#L297-L302","created_at":"2018-06-06T14:47:38Z","updated_at":"2018-06-06T14:47:39Z","html_url":"https://github.com/rstudio/rstudio/pull/2923#discussion_r193437897","pull_request_url":"https://api.github.com/repos/rstudio/rstudio/pulls/2923","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/rstudio/rstudio/pulls/comments/193437897"},"html":{"href":"https://github.com/rstudio/rstudio/pull/2923#discussion_r193437897"},"pull_request":{"href":"https://api.github.com/repos/rstudio/rstudio/pulls/2923"}},"in_reply_to_id":193437232},"pull_request":{"url":"https://api.github.com/repos/rstudio/rstudio/pulls/2923","id":192866039,"node_id":"MDExOlB1bGxSZXF1ZXN0MTkyODY2MDM5","html_url":"https://github.com/rstudio/rstudio/pull/2923","diff_url":"https://github.com/rstudio/rstudio/pull/2923.diff","patch_url":"https://github.com/rstudio/rstudio/pull/2923.patch","issue_url":"https://api.github.com/repos/rstudio/rstudio/issues/2923","number":2923,"state":"open","locked":false,"title":"Run R scripts as asynchronous jobs","user":{"login":"jmcphers","id":470418,"node_id":"MDQ6VXNlcjQ3MDQxOA==","avatar_url":"https://avatars3.githubusercontent.com/u/470418?v=4","gravatar_id":"","url":"https://api.github.com/users/jmcphers","html_url":"https://github.com/jmcphers","followers_url":"https://api.github.com/users/jmcphers/followers","following_url":"https://api.github.com/users/jmcphers/following{/other_user}","gists_url":"https://api.github.com/users/jmcphers/gists{/gist_id}","starred_url":"https://api.github.com/users/jmcphers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jmcphers/subscriptions","organizations_url":"https://api.github.com/users/jmcphers/orgs","repos_url":"https://api.github.com/users/jmcphers/repos","events_url":"https://api.github.com/users/jmcphers/events{/privacy}","received_events_url":"https://api.github.com/users/jmcphers/received_events","type":"User","site_admin":false},"body":"This change brings together two existing pieces of infrastructure -- the Progress API and the `AsyncRProcess` wrapper -- to make it possible to run any R script as a background task. This is useful for performing long or expensive jobs without juggling running multiple copies of RStudio Desktop. \r\n\r\nAny R script can now be sourced as a Job:\r\n\r\n![image](https://user-images.githubusercontent.com/470418/41008260-ed4fa6d6-68de-11e8-80ba-0f53d1ce96ea.png)\r\n\r\nBy default, jobs run in a clean R session and use the working directory of the script being run.\r\n\r\n![image](https://user-images.githubusercontent.com/470418/41008316-38520e6c-68df-11e8-8dbc-03f1bd2c6ed6.png)\r\n\r\nHowever it's possible to export the R session's global environment to the job, and it's also possible to export any variables the job creates back into the current R session. (The latter of course should be used with caution since it can overwrite existing values silently!)\r\n\r\nOnce a job starts, its output is shown in the Jobs tab (which has moved next to the Console):\r\n\r\n![image](https://user-images.githubusercontent.com/470418/41008422-ce0e7cf6-68df-11e8-9122-8a85eacce9e3.png)\r\n\r\nThe Jobs tab shows a summary of current and past jobs:\r\n\r\n![image](https://user-images.githubusercontent.com/470418/41008472-06db01e4-68e0-11e8-8901-249c124f5ad5.png)\r\n\r\nNote that this feature is not fully complete (this PR just represents the first and largest chunk of work); the primary remaining work items are smoothing out the edges around cancellation, suspension, desktop app exit, launch options, and UX polish.","created_at":"2018-06-05T23:49:48Z","updated_at":"2018-06-06T14:47:39Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e7328ea31e80b19940b7e3a11dccf77d88afefeb","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/rstudio/rstudio/pulls/2923/commits","review_comments_url":"https://api.github.com/repos/rstudio/rstudio/pulls/2923/comments","review_comment_url":"https://api.github.com/repos/rstudio/rstudio/pulls/comments{/number}","comments_url":"https://api.github.com/repos/rstudio/rstudio/issues/2923/comments","statuses_url":"https://api.github.com/repos/rstudio/rstudio/statuses/a2dffb0f5b36f509a5aa19085ff083d9c3f0829b","head":{"label":"rstudio:feature/async-r-jobs","ref":"feature/async-r-jobs","sha":"a2dffb0f5b36f509a5aa19085ff083d9c3f0829b","user":{"login":"rstudio","id":513560,"node_id":"MDEyOk9yZ2FuaXphdGlvbjUxMzU2MA==","avatar_url":"https://avatars1.githubusercontent.com/u/513560?v=4","gravatar_id":"","url":"https://api.github.com/users/rstudio","html_url":"https://github.com/rstudio","followers_url":"https://api.github.com/users/rstudio/followers","following_url":"https://api.github.com/users/rstudio/following{/other_user}","gists_url":"https://api.github.com/users/rstudio/gists{/gist_id}","starred_url":"https://api.github.com/users/rstudio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rstudio/subscriptions","organizations_url":"https://api.github.com/users/rstudio/orgs","repos_url":"https://api.github.com/users/rstudio/repos","events_url":"https://api.github.com/users/rstudio/events{/privacy}","received_events_url":"https://api.github.com/users/rstudio/received_events","type":"Organization","site_admin":false},"repo":{"id":1147463,"node_id":"MDEwOlJlcG9zaXRvcnkxMTQ3NDYz","name":"rstudio","full_name":"rstudio/rstudio","owner":{"login":"rstudio","id":513560,"node_id":"MDEyOk9yZ2FuaXphdGlvbjUxMzU2MA==","avatar_url":"https://avatars1.githubusercontent.com/u/513560?v=4","gravatar_id":"","url":"https://api.github.com/users/rstudio","html_url":"https://github.com/rstudio","followers_url":"https://api.github.com/users/rstudio/followers","following_url":"https://api.github.com/users/rstudio/following{/other_user}","gists_url":"https://api.github.com/users/rstudio/gists{/gist_id}","starred_url":"https://api.github.com/users/rstudio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rstudio/subscriptions","organizations_url":"https://api.github.com/users/rstudio/orgs","repos_url":"https://api.github.com/users/rstudio/repos","events_url":"https://api.github.com/users/rstudio/events{/privacy}","received_events_url":"https://api.github.com/users/rstudio/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/rstudio/rstudio","description":"RStudio is an integrated development environment (IDE) for R","fork":false,"url":"https://api.github.com/repos/rstudio/rstudio","forks_url":"https://api.github.com/repos/rstudio/rstudio/forks","keys_url":"https://api.github.com/repos/rstudio/rstudio/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rstudio/rstudio/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rstudio/rstudio/teams","hooks_url":"https://api.github.com/repos/rstudio/rstudio/hooks","issue_events_url":"https://api.github.com/repos/rstudio/rstudio/issues/events{/number}","events_url":"https://api.github.com/repos/rstudio/rstudio/events","assignees_url":"https://api.github.com/repos/rstudio/rstudio/assignees{/user}","branches_url":"https://api.github.com/repos/rstudio/rstudio/branches{/branch}","tags_url":"https://api.github.com/repos/rstudio/rstudio/tags","blobs_url":"https://api.github.com/repos/rstudio/rstudio/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rstudio/rstudio/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rstudio/rstudio/git/refs{/sha}","trees_url":"https://api.github.com/repos/rstudio/rstudio/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rstudio/rstudio/statuses/{sha}","languages_url":"https://api.github.com/repos/rstudio/rstudio/languages","stargazers_url":"https://api.github.com/repos/rstudio/rstudio/stargazers","contributors_url":"https://api.github.com/repos/rstudio/rstudio/contributors","subscribers_url":"https://api.github.com/repos/rstudio/rstudio/subscribers","subscription_url":"https://api.github.com/repos/rstudio/rstudio/subscription","commits_url":"https://api.github.com/repos/rstudio/rstudio/commits{/sha}","git_commits_url":"https://api.github.com/repos/rstudio/rstudio/git/commits{/sha}","comments_url":"https://api.github.com/repos/rstudio/rstudio/comments{/number}","issue_comment_url":"https://api.github.com/repos/rstudio/rstudio/issues/comments{/number}","contents_url":"https://api.github.com/repos/rstudio/rstudio/contents/{+path}","compare_url":"https://api.github.com/repos/rstudio/rstudio/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rstudio/rstudio/merges","archive_url":"https://api.github.com/repos/rstudio/rstudio/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rstudio/rstudio/downloads","issues_url":"https://api.github.com/repos/rstudio/rstudio/issues{/number}","pulls_url":"https://api.github.com/repos/rstudio/rstudio/pulls{/number}","milestones_url":"https://api.github.com/repos/rstudio/rstudio/milestones{/number}","notifications_url":"https://api.github.com/repos/rstudio/rstudio/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rstudio/rstudio/labels{/name}","releases_url":"https://api.github.com/repos/rstudio/rstudio/releases{/id}","deployments_url":"https://api.github.com/repos/rstudio/rstudio/deployments","created_at":"2010-12-07T19:10:25Z","updated_at":"2018-06-06T04:10:04Z","pushed_at":"2018-06-06T04:10:02Z","git_url":"git://github.com/rstudio/rstudio.git","ssh_url":"git@github.com:rstudio/rstudio.git","clone_url":"https://github.com/rstudio/rstudio.git","svn_url":"https://github.com/rstudio/rstudio","homepage":"https://www.rstudio.com/products/rstudio/","size":96914,"stargazers_count":2278,"watchers_count":2278,"language":"Java","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":576,"mirror_url":null,"archived":false,"open_issues_count":610,"license":{"key":"other","name":"Other","spdx_id":null,"url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":576,"open_issues":610,"watchers":2278,"default_branch":"master"}},"base":{"label":"rstudio:master","ref":"master","sha":"9a2cd883d53a98b7b6c0957d6fc492e673ee5aac","user":{"login":"rstudio","id":513560,"node_id":"MDEyOk9yZ2FuaXphdGlvbjUxMzU2MA==","avatar_url":"https://avatars1.githubusercontent.com/u/513560?v=4","gravatar_id":"","url":"https://api.github.com/users/rstudio","html_url":"https://github.com/rstudio","followers_url":"https://api.github.com/users/rstudio/followers","following_url":"https://api.github.com/users/rstudio/following{/other_user}","gists_url":"https://api.github.com/users/rstudio/gists{/gist_id}","starred_url":"https://api.github.com/users/rstudio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rstudio/subscriptions","organizations_url":"https://api.github.com/users/rstudio/orgs","repos_url":"https://api.github.com/users/rstudio/repos","events_url":"https://api.github.com/users/rstudio/events{/privacy}","received_events_url":"https://api.github.com/users/rstudio/received_events","type":"Organization","site_admin":false},"repo":{"id":1147463,"node_id":"MDEwOlJlcG9zaXRvcnkxMTQ3NDYz","name":"rstudio","full_name":"rstudio/rstudio","owner":{"login":"rstudio","id":513560,"node_id":"MDEyOk9yZ2FuaXphdGlvbjUxMzU2MA==","avatar_url":"https://avatars1.githubusercontent.com/u/513560?v=4","gravatar_id":"","url":"https://api.github.com/users/rstudio","html_url":"https://github.com/rstudio","followers_url":"https://api.github.com/users/rstudio/followers","following_url":"https://api.github.com/users/rstudio/following{/other_user}","gists_url":"https://api.github.com/users/rstudio/gists{/gist_id}","starred_url":"https://api.github.com/users/rstudio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rstudio/subscriptions","organizations_url":"https://api.github.com/users/rstudio/orgs","repos_url":"https://api.github.com/users/rstudio/repos","events_url":"https://api.github.com/users/rstudio/events{/privacy}","received_events_url":"https://api.github.com/users/rstudio/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/rstudio/rstudio","description":"RStudio is an integrated development environment (IDE) for R","fork":false,"url":"https://api.github.com/repos/rstudio/rstudio","forks_url":"https://api.github.com/repos/rstudio/rstudio/forks","keys_url":"https://api.github.com/repos/rstudio/rstudio/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rstudio/rstudio/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rstudio/rstudio/teams","hooks_url":"https://api.github.com/repos/rstudio/rstudio/hooks","issue_events_url":"https://api.github.com/repos/rstudio/rstudio/issues/events{/number}","events_url":"https://api.github.com/repos/rstudio/rstudio/events","assignees_url":"https://api.github.com/repos/rstudio/rstudio/assignees{/user}","branches_url":"https://api.github.com/repos/rstudio/rstudio/branches{/branch}","tags_url":"https://api.github.com/repos/rstudio/rstudio/tags","blobs_url":"https://api.github.com/repos/rstudio/rstudio/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rstudio/rstudio/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rstudio/rstudio/git/refs{/sha}","trees_url":"https://api.github.com/repos/rstudio/rstudio/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rstudio/rstudio/statuses/{sha}","languages_url":"https://api.github.com/repos/rstudio/rstudio/languages","stargazers_url":"https://api.github.com/repos/rstudio/rstudio/stargazers","contributors_url":"https://api.github.com/repos/rstudio/rstudio/contributors","subscribers_url":"https://api.github.com/repos/rstudio/rstudio/subscribers","subscription_url":"https://api.github.com/repos/rstudio/rstudio/subscription","commits_url":"https://api.github.com/repos/rstudio/rstudio/commits{/sha}","git_commits_url":"https://api.github.com/repos/rstudio/rstudio/git/commits{/sha}","comments_url":"https://api.github.com/repos/rstudio/rstudio/comments{/number}","issue_comment_url":"https://api.github.com/repos/rstudio/rstudio/issues/comments{/number}","contents_url":"https://api.github.com/repos/rstudio/rstudio/contents/{+path}","compare_url":"https://api.github.com/repos/rstudio/rstudio/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rstudio/rstudio/merges","archive_url":"https://api.github.com/repos/rstudio/rstudio/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rstudio/rstudio/downloads","issues_url":"https://api.github.com/repos/rstudio/rstudio/issues{/number}","pulls_url":"https://api.github.com/repos/rstudio/rstudio/pulls{/number}","milestones_url":"https://api.github.com/repos/rstudio/rstudio/milestones{/number}","notifications_url":"https://api.github.com/repos/rstudio/rstudio/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rstudio/rstudio/labels{/name}","releases_url":"https://api.github.com/repos/rstudio/rstudio/releases{/id}","deployments_url":"https://api.github.com/repos/rstudio/rstudio/deployments","created_at":"2010-12-07T19:10:25Z","updated_at":"2018-06-06T04:10:04Z","pushed_at":"2018-06-06T04:10:02Z","git_url":"git://github.com/rstudio/rstudio.git","ssh_url":"git@github.com:rstudio/rstudio.git","clone_url":"https://github.com/rstudio/rstudio.git","svn_url":"https://github.com/rstudio/rstudio","homepage":"https://www.rstudio.com/products/rstudio/","size":96914,"stargazers_count":2278,"watchers_count":2278,"language":"Java","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":576,"mirror_url":null,"archived":false,"open_issues_count":610,"license":{"key":"other","name":"Other","spdx_id":null,"url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":576,"open_issues":610,"watchers":2278,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/rstudio/rstudio/pulls/2923"},"html":{"href":"https://github.com/rstudio/rstudio/pull/2923"},"issue":{"href":"https://api.github.com/repos/rstudio/rstudio/issues/2923"},"comments":{"href":"https://api.github.com/repos/rstudio/rstudio/issues/2923/comments"},"review_comments":{"href":"https://api.github.com/repos/rstudio/rstudio/pulls/2923/comments"},"review_comment":{"href":"https://api.github.com/repos/rstudio/rstudio/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/rstudio/rstudio/pulls/2923/commits"},"statuses":{"href":"https://api.github.com/repos/rstudio/rstudio/statuses/a2dffb0f5b36f509a5aa19085ff083d9c3f0829b"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"kevinushey"}}