{"action":"created","comment":{"url":"https://api.github.com/repos/metomi/rose/pulls/comments/42749621","id":42749621,"diff_hunk":"@@ -0,0 +1,458 @@\n+# -*- coding: utf-8 -*-\n+# ----------------------------------------------------------------------------\n+# (C) British Crown Copyright 2012-5 Met Office.\n+#\n+# This file is part of Rose, a framework for meteorological suites.\n+#\n+# Rose is free software: you can redistribute it and/or modify\n+# it under the terms of the GNU General Public License as published by\n+# the Free Software Foundation, either version 3 of the License, or\n+# (at your option) any later version.\n+#\n+# Rose is distributed in the hope that it will be useful,\n+# but WITHOUT ANY WARRANTY; without even the implied warranty of\n+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n+# GNU General Public License for more details.\n+#\n+# You should have received a copy of the GNU General Public License\n+# along with Rose. If not, see <http://www.gnu.org/licenses/>.\n+# ----------------------------------------------------------------------------\n+\"\"\"Builtin application: rose_bunch: run multiple commands in parallel.\"\"\"\n+\n+\n+import os\n+import shlex\n+import sqlite3\n+from multiprocessing import Pool\n+from time import sleep\n+\n+from rose.env import env_var_process\n+from rose.app_run import (\n+    BuiltinApp,\n+    ConfigValueError,\n+    CompulsoryConfigValueError)\n+from rose.popen import RosePopener\n+import rose.job_runner\n+from rose.reporter import Event\n+\n+\n+class AbortEvent(Event):\n+\n+    \"\"\"An event raised when a task failure will stop further task running\"\"\"\n+\n+    LEVEL = Event.V\n+    KIND = Event.KIND_OUT\n+\n+    def __str__(self):\n+        return \"Closing task pool, no further commands will be run.\"\n+\n+\n+class FailEvent(Event):\n+\n+    \"\"\"An event used to report failure of a task in the pool.\"\"\"\n+\n+    KIND = Event.KIND_ERR\n+\n+    def __str__(self):\n+        name, rc = self.args\n+        return \"Command %s failed with return code %s\" % (name, rc)\n+\n+class InconsistentArglength(Exception):\n+\n+    \"\"\"An event raised when arg lengths are not consistent\"\"\"\n+\n+    ERROR_MSG = \"Inconsistent arg lengths\"\n+\n+    def __str__(self):\n+\n+        return  self.ERROR_MSG\n+\n+class LaunchEvent(Event):\n+\n+    \"\"\"An event raised when adding a command to the task pool.\"\"\"\n+\n+    LEVEL = Event.V\n+    KIND = Event.KIND_OUT\n+\n+    def __str__(self):\n+        name, cmd = self.args\n+        return \"Adding command %s to pool: %s\" % (name, cmd)\n+\n+\n+class SucceededEvent(Event):\n+\n+    \"\"\"An event used to report success of a task in the pool.\"\"\"\n+\n+    LEVEL = Event.V\n+    KIND = Event.KIND_OUT\n+\n+    def __str__(self):\n+        name, rc = self.args\n+        return \"Command %s completed successfully # rc = %s\" % (name, rc)\n+\n+\n+class SkippingEvent(Event):\n+\n+    \"\"\"Event raised when a command is skipped in incremental mode\"\"\"\n+    LEVEL = Event.V\n+    KIND = Event.KIND_OUT\n+\n+    def __str__(self):\n+        name = self.args\n+        return \"Skipping %s: previously ran and succeeded\" % (name)","path":"lib/python/rose/apps/rose_bunch.py","position":102,"original_position":102,"commit_id":"95067d494952cc1704a1957a5516f87185c1e046","original_commit_id":"95067d494952cc1704a1957a5516f87185c1e046","user":{"login":"matthewrmshin","id":908613,"avatar_url":"https://avatars.githubusercontent.com/u/908613?v=3","gravatar_id":"","url":"https://api.github.com/users/matthewrmshin","html_url":"https://github.com/matthewrmshin","followers_url":"https://api.github.com/users/matthewrmshin/followers","following_url":"https://api.github.com/users/matthewrmshin/following{/other_user}","gists_url":"https://api.github.com/users/matthewrmshin/gists{/gist_id}","starred_url":"https://api.github.com/users/matthewrmshin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/matthewrmshin/subscriptions","organizations_url":"https://api.github.com/users/matthewrmshin/orgs","repos_url":"https://api.github.com/users/matthewrmshin/repos","events_url":"https://api.github.com/users/matthewrmshin/events{/privacy}","received_events_url":"https://api.github.com/users/matthewrmshin/received_events","type":"User","site_admin":false},"body":"Or `[DONE] command ...`?","created_at":"2015-10-22T13:51:03Z","updated_at":"2015-10-22T13:51:03Z","html_url":"https://github.com/metomi/rose/pull/1696#discussion_r42749621","pull_request_url":"https://api.github.com/repos/metomi/rose/pulls/1696","_links":{"self":{"href":"https://api.github.com/repos/metomi/rose/pulls/comments/42749621"},"html":{"href":"https://github.com/metomi/rose/pull/1696#discussion_r42749621"},"pull_request":{"href":"https://api.github.com/repos/metomi/rose/pulls/1696"}}},"pull_request":{"url":"https://api.github.com/repos/metomi/rose/pulls/1696","id":44910409,"html_url":"https://github.com/metomi/rose/pull/1696","diff_url":"https://github.com/metomi/rose/pull/1696.diff","patch_url":"https://github.com/metomi/rose/pull/1696.patch","issue_url":"https://api.github.com/repos/metomi/rose/issues/1696","number":1696,"state":"open","locked":false,"title":"1531: rose run multiple commands in one app","user":{"login":"arjclark","id":2562650,"avatar_url":"https://avatars.githubusercontent.com/u/2562650?v=3","gravatar_id":"","url":"https://api.github.com/users/arjclark","html_url":"https://github.com/arjclark","followers_url":"https://api.github.com/users/arjclark/followers","following_url":"https://api.github.com/users/arjclark/following{/other_user}","gists_url":"https://api.github.com/users/arjclark/gists{/gist_id}","starred_url":"https://api.github.com/users/arjclark/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/arjclark/subscriptions","organizations_url":"https://api.github.com/users/arjclark/orgs","repos_url":"https://api.github.com/users/arjclark/repos","events_url":"https://api.github.com/users/arjclark/events{/privacy}","received_events_url":"https://api.github.com/users/arjclark/received_events","type":"User","site_admin":false},"body":"@matthewrmshin - not ready for merge yet (still several things to do and test). Can you take a preliminary look and see what you think?","created_at":"2015-09-14T09:43:17Z","updated_at":"2015-10-22T13:51:03Z","closed_at":null,"merged_at":null,"merge_commit_sha":"198177272973d3d16896711ae9115b5ccb661283","assignee":{"login":"matthewrmshin","id":908613,"avatar_url":"https://avatars.githubusercontent.com/u/908613?v=3","gravatar_id":"","url":"https://api.github.com/users/matthewrmshin","html_url":"https://github.com/matthewrmshin","followers_url":"https://api.github.com/users/matthewrmshin/followers","following_url":"https://api.github.com/users/matthewrmshin/following{/other_user}","gists_url":"https://api.github.com/users/matthewrmshin/gists{/gist_id}","starred_url":"https://api.github.com/users/matthewrmshin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/matthewrmshin/subscriptions","organizations_url":"https://api.github.com/users/matthewrmshin/orgs","repos_url":"https://api.github.com/users/matthewrmshin/repos","events_url":"https://api.github.com/users/matthewrmshin/events{/privacy}","received_events_url":"https://api.github.com/users/matthewrmshin/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/metomi/rose/milestones/37","html_url":"https://github.com/metomi/rose/milestones/next-release","labels_url":"https://api.github.com/repos/metomi/rose/milestones/37/labels","id":1357128,"number":37,"title":"next-release","description":"Rose release 32","creator":{"login":"matthewrmshin","id":908613,"avatar_url":"https://avatars.githubusercontent.com/u/908613?v=3","gravatar_id":"","url":"https://api.github.com/users/matthewrmshin","html_url":"https://github.com/matthewrmshin","followers_url":"https://api.github.com/users/matthewrmshin/followers","following_url":"https://api.github.com/users/matthewrmshin/following{/other_user}","gists_url":"https://api.github.com/users/matthewrmshin/gists{/gist_id}","starred_url":"https://api.github.com/users/matthewrmshin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/matthewrmshin/subscriptions","organizations_url":"https://api.github.com/users/matthewrmshin/orgs","repos_url":"https://api.github.com/users/matthewrmshin/repos","events_url":"https://api.github.com/users/matthewrmshin/events{/privacy}","received_events_url":"https://api.github.com/users/matthewrmshin/received_events","type":"User","site_admin":false},"open_issues":11,"closed_issues":0,"state":"open","created_at":"2015-10-15T11:40:05Z","updated_at":"2015-10-22T11:04:56Z","due_on":"2015-11-30T00:00:00Z","closed_at":null},"commits_url":"https://api.github.com/repos/metomi/rose/pulls/1696/commits","review_comments_url":"https://api.github.com/repos/metomi/rose/pulls/1696/comments","review_comment_url":"https://api.github.com/repos/metomi/rose/pulls/comments{/number}","comments_url":"https://api.github.com/repos/metomi/rose/issues/1696/comments","statuses_url":"https://api.github.com/repos/metomi/rose/statuses/95067d494952cc1704a1957a5516f87185c1e046","head":{"label":"arjclark:1531.multi-cmd","ref":"1531.multi-cmd","sha":"95067d494952cc1704a1957a5516f87185c1e046","user":{"login":"arjclark","id":2562650,"avatar_url":"https://avatars.githubusercontent.com/u/2562650?v=3","gravatar_id":"","url":"https://api.github.com/users/arjclark","html_url":"https://github.com/arjclark","followers_url":"https://api.github.com/users/arjclark/followers","following_url":"https://api.github.com/users/arjclark/following{/other_user}","gists_url":"https://api.github.com/users/arjclark/gists{/gist_id}","starred_url":"https://api.github.com/users/arjclark/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/arjclark/subscriptions","organizations_url":"https://api.github.com/users/arjclark/orgs","repos_url":"https://api.github.com/users/arjclark/repos","events_url":"https://api.github.com/users/arjclark/events{/privacy}","received_events_url":"https://api.github.com/users/arjclark/received_events","type":"User","site_admin":false},"repo":{"id":6224478,"name":"rose","full_name":"arjclark/rose","owner":{"login":"arjclark","id":2562650,"avatar_url":"https://avatars.githubusercontent.com/u/2562650?v=3","gravatar_id":"","url":"https://api.github.com/users/arjclark","html_url":"https://github.com/arjclark","followers_url":"https://api.github.com/users/arjclark/followers","following_url":"https://api.github.com/users/arjclark/following{/other_user}","gists_url":"https://api.github.com/users/arjclark/gists{/gist_id}","starred_url":"https://api.github.com/users/arjclark/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/arjclark/subscriptions","organizations_url":"https://api.github.com/users/arjclark/orgs","repos_url":"https://api.github.com/users/arjclark/repos","events_url":"https://api.github.com/users/arjclark/events{/privacy}","received_events_url":"https://api.github.com/users/arjclark/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/arjclark/rose","description":"Rose is a framework for managing and running meteorological suites.","fork":true,"url":"https://api.github.com/repos/arjclark/rose","forks_url":"https://api.github.com/repos/arjclark/rose/forks","keys_url":"https://api.github.com/repos/arjclark/rose/keys{/key_id}","collaborators_url":"https://api.github.com/repos/arjclark/rose/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/arjclark/rose/teams","hooks_url":"https://api.github.com/repos/arjclark/rose/hooks","issue_events_url":"https://api.github.com/repos/arjclark/rose/issues/events{/number}","events_url":"https://api.github.com/repos/arjclark/rose/events","assignees_url":"https://api.github.com/repos/arjclark/rose/assignees{/user}","branches_url":"https://api.github.com/repos/arjclark/rose/branches{/branch}","tags_url":"https://api.github.com/repos/arjclark/rose/tags","blobs_url":"https://api.github.com/repos/arjclark/rose/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/arjclark/rose/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/arjclark/rose/git/refs{/sha}","trees_url":"https://api.github.com/repos/arjclark/rose/git/trees{/sha}","statuses_url":"https://api.github.com/repos/arjclark/rose/statuses/{sha}","languages_url":"https://api.github.com/repos/arjclark/rose/languages","stargazers_url":"https://api.github.com/repos/arjclark/rose/stargazers","contributors_url":"https://api.github.com/repos/arjclark/rose/contributors","subscribers_url":"https://api.github.com/repos/arjclark/rose/subscribers","subscription_url":"https://api.github.com/repos/arjclark/rose/subscription","commits_url":"https://api.github.com/repos/arjclark/rose/commits{/sha}","git_commits_url":"https://api.github.com/repos/arjclark/rose/git/commits{/sha}","comments_url":"https://api.github.com/repos/arjclark/rose/comments{/number}","issue_comment_url":"https://api.github.com/repos/arjclark/rose/issues/comments{/number}","contents_url":"https://api.github.com/repos/arjclark/rose/contents/{+path}","compare_url":"https://api.github.com/repos/arjclark/rose/compare/{base}...{head}","merges_url":"https://api.github.com/repos/arjclark/rose/merges","archive_url":"https://api.github.com/repos/arjclark/rose/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/arjclark/rose/downloads","issues_url":"https://api.github.com/repos/arjclark/rose/issues{/number}","pulls_url":"https://api.github.com/repos/arjclark/rose/pulls{/number}","milestones_url":"https://api.github.com/repos/arjclark/rose/milestones{/number}","notifications_url":"https://api.github.com/repos/arjclark/rose/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/arjclark/rose/labels{/name}","releases_url":"https://api.github.com/repos/arjclark/rose/releases{/id}","created_at":"2012-10-15T09:21:14Z","updated_at":"2015-05-07T13:18:05Z","pushed_at":"2015-10-22T13:23:13Z","git_url":"git://github.com/arjclark/rose.git","ssh_url":"git@github.com:arjclark/rose.git","clone_url":"https://github.com/arjclark/rose.git","svn_url":"https://github.com/arjclark/rose","homepage":null,"size":16275,"stargazers_count":1,"watchers_count":1,"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":1,"default_branch":"master"}},"base":{"label":"metomi:master","ref":"master","sha":"6e8b2f6cdb54df451fae2696f4ee32a303cf7a64","user":{"login":"metomi","id":2477494,"avatar_url":"https://avatars.githubusercontent.com/u/2477494?v=3","gravatar_id":"","url":"https://api.github.com/users/metomi","html_url":"https://github.com/metomi","followers_url":"https://api.github.com/users/metomi/followers","following_url":"https://api.github.com/users/metomi/following{/other_user}","gists_url":"https://api.github.com/users/metomi/gists{/gist_id}","starred_url":"https://api.github.com/users/metomi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/metomi/subscriptions","organizations_url":"https://api.github.com/users/metomi/orgs","repos_url":"https://api.github.com/users/metomi/repos","events_url":"https://api.github.com/users/metomi/events{/privacy}","received_events_url":"https://api.github.com/users/metomi/received_events","type":"Organization","site_admin":false},"repo":{"id":6223866,"name":"rose","full_name":"metomi/rose","owner":{"login":"metomi","id":2477494,"avatar_url":"https://avatars.githubusercontent.com/u/2477494?v=3","gravatar_id":"","url":"https://api.github.com/users/metomi","html_url":"https://github.com/metomi","followers_url":"https://api.github.com/users/metomi/followers","following_url":"https://api.github.com/users/metomi/following{/other_user}","gists_url":"https://api.github.com/users/metomi/gists{/gist_id}","starred_url":"https://api.github.com/users/metomi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/metomi/subscriptions","organizations_url":"https://api.github.com/users/metomi/orgs","repos_url":"https://api.github.com/users/metomi/repos","events_url":"https://api.github.com/users/metomi/events{/privacy}","received_events_url":"https://api.github.com/users/metomi/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/metomi/rose","description":"Rose: a framework for managing and running meteorological suites.","fork":false,"url":"https://api.github.com/repos/metomi/rose","forks_url":"https://api.github.com/repos/metomi/rose/forks","keys_url":"https://api.github.com/repos/metomi/rose/keys{/key_id}","collaborators_url":"https://api.github.com/repos/metomi/rose/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/metomi/rose/teams","hooks_url":"https://api.github.com/repos/metomi/rose/hooks","issue_events_url":"https://api.github.com/repos/metomi/rose/issues/events{/number}","events_url":"https://api.github.com/repos/metomi/rose/events","assignees_url":"https://api.github.com/repos/metomi/rose/assignees{/user}","branches_url":"https://api.github.com/repos/metomi/rose/branches{/branch}","tags_url":"https://api.github.com/repos/metomi/rose/tags","blobs_url":"https://api.github.com/repos/metomi/rose/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/metomi/rose/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/metomi/rose/git/refs{/sha}","trees_url":"https://api.github.com/repos/metomi/rose/git/trees{/sha}","statuses_url":"https://api.github.com/repos/metomi/rose/statuses/{sha}","languages_url":"https://api.github.com/repos/metomi/rose/languages","stargazers_url":"https://api.github.com/repos/metomi/rose/stargazers","contributors_url":"https://api.github.com/repos/metomi/rose/contributors","subscribers_url":"https://api.github.com/repos/metomi/rose/subscribers","subscription_url":"https://api.github.com/repos/metomi/rose/subscription","commits_url":"https://api.github.com/repos/metomi/rose/commits{/sha}","git_commits_url":"https://api.github.com/repos/metomi/rose/git/commits{/sha}","comments_url":"https://api.github.com/repos/metomi/rose/comments{/number}","issue_comment_url":"https://api.github.com/repos/metomi/rose/issues/comments{/number}","contents_url":"https://api.github.com/repos/metomi/rose/contents/{+path}","compare_url":"https://api.github.com/repos/metomi/rose/compare/{base}...{head}","merges_url":"https://api.github.com/repos/metomi/rose/merges","archive_url":"https://api.github.com/repos/metomi/rose/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/metomi/rose/downloads","issues_url":"https://api.github.com/repos/metomi/rose/issues{/number}","pulls_url":"https://api.github.com/repos/metomi/rose/pulls{/number}","milestones_url":"https://api.github.com/repos/metomi/rose/milestones{/number}","notifications_url":"https://api.github.com/repos/metomi/rose/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/metomi/rose/labels{/name}","releases_url":"https://api.github.com/repos/metomi/rose/releases{/id}","created_at":"2012-10-15T08:31:10Z","updated_at":"2015-10-13T07:19:18Z","pushed_at":"2015-10-22T11:04:56Z","git_url":"git://github.com/metomi/rose.git","ssh_url":"git@github.com:metomi/rose.git","clone_url":"https://github.com/metomi/rose.git","svn_url":"https://github.com/metomi/rose","homepage":"metomi.github.io/rose/doc/","size":22302,"stargazers_count":18,"watchers_count":18,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":20,"mirror_url":null,"open_issues_count":169,"forks":20,"open_issues":169,"watchers":18,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/metomi/rose/pulls/1696"},"html":{"href":"https://github.com/metomi/rose/pull/1696"},"issue":{"href":"https://api.github.com/repos/metomi/rose/issues/1696"},"comments":{"href":"https://api.github.com/repos/metomi/rose/issues/1696/comments"},"review_comments":{"href":"https://api.github.com/repos/metomi/rose/pulls/1696/comments"},"review_comment":{"href":"https://api.github.com/repos/metomi/rose/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/metomi/rose/pulls/1696/commits"},"statuses":{"href":"https://api.github.com/repos/metomi/rose/statuses/95067d494952cc1704a1957a5516f87185c1e046"}}}}