{"action":"created","comment":{"url":"https://api.github.com/repos/Stanford-Online/edx-platform/pulls/comments/24618580","id":24618580,"diff_hunk":"@@ -737,3 +738,123 @@ def get(self, request, *args, **kwargs):\n                    'error_msg': error_msg}\n \n         return render_to_response(self.template_name, context)\n+\n+\n+class TaskQueue(SysadminDashboardView):\n+    \"\"\"\n+    This provides the ability to kill an InstructorTask.\n+\n+    This is done by updating the row's task_state from \"QUEUING\" to \"FAILURE\".\n+    \"\"\"\n+\n+    def kill_task(self, row_id=None):\n+        \"\"\"\n+        Kills an InstructorTask by changing it's task_state from 'QUEUING' to 'FAILURE'\n+\n+        Args:\n+          Input: row_id (string)\n+        \"\"\"\n+        if not row_id:\n+            return _('Must provide an ID')\n+\n+        try:\n+            int(row_id)\n+        except ValueError:\n+            return _('ID must be an integer')\n+\n+        msg = u''\n+        try:\n+            task = InstructorTask.objects.get(\n+                id=row_id,\n+                task_state='QUEUING',\n+            )\n+        except InstructorTask.DoesNotExist, err:\n+            msg = _('Cannot find task with ID {row_id} and task_state QUEUING - {error}').format(\n+                row_id=row_id,\n+                error=str(err)\n+            )\n+            return msg\n+\n+        task.task_state = 'FAILURE'\n+        task.save()\n+\n+        msg += _('Task with id {row_id} was successfully killed!').format(row_id=row_id)\n+        return msg\n+\n+    def make_datatable(self):\n+        \"\"\"Creates InstructorTask information datatable\"\"\"\n+\n+        data = []\n+\n+        tasks = InstructorTask.objects.filter(\n+            task_state='QUEUING',\n+        ).order_by('id').reverse()\n+        for task in tasks:\n+            data.append(\n+                [\n+                    task.id,\n+                    task.course_id,\n+                    task.task_type,\n+                    task.task_state,\n+                ]\n+            )\n+\n+        return dict(\n+            header=[\n+                _('ID'),\n+                _('Course ID'),\n+                _('Task Type'),\n+                _('Task State'),\n+            ],\n+            title=_('List of Queueing Tasks'),\n+            data=data,\n+        )\n+\n+    def get(self, request):\n+        \"\"\"\n+        Displays form allowing admin to kill an InstructorTask.\n+\n+        Args:\n+          Input: request (Django Request object)\n+        \"\"\"\n+        if not request.user.is_staff:\n+            raise Http404\n+\n+        context = {\n+            'datatable': self.make_datatable(),\n+            'msg': self.msg,\n+            'djangopid': os.getpid(),\n+            'modeflag': {'task_queue': 'active-section'},\n+            'edx_platform_version': getattr(settings, 'EDX_PLATFORM_VERSION_STRING', ''),\n+        }\n+        return render_to_response(self.template_name, context)\n+\n+    def post(self, request):\n+        \"\"\"\n+        Handle actions on page Task Queue page.\n+\n+        Args:\n+          Input: request (Django Request object)\n+        \"\"\"\n+\n+        if not request.user.is_staff:\n+            raise Http404\n+\n+        action = request.POST.get('action', '')\n+        track.views.server_track(request, action, {},\n+                                 page='task_queue_sysdashboard')\n+\n+        if action == 'kill_task':","path":"lms/djangoapps/dashboard/sysadmin.py","position":118,"original_position":118,"commit_id":"fb60d3c2a74f5b9284243f219a61aeb03c756e9d","original_commit_id":"fb60d3c2a74f5b9284243f219a61aeb03c756e9d","user":{"login":"dcadams","id":1840555,"avatar_url":"https://avatars.githubusercontent.com/u/1840555?v=3","gravatar_id":"","url":"https://api.github.com/users/dcadams","html_url":"https://github.com/dcadams","followers_url":"https://api.github.com/users/dcadams/followers","following_url":"https://api.github.com/users/dcadams/following{/other_user}","gists_url":"https://api.github.com/users/dcadams/gists{/gist_id}","starred_url":"https://api.github.com/users/dcadams/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dcadams/subscriptions","organizations_url":"https://api.github.com/users/dcadams/orgs","repos_url":"https://api.github.com/users/dcadams/repos","events_url":"https://api.github.com/users/dcadams/events{/privacy}","received_events_url":"https://api.github.com/users/dcadams/received_events","type":"User","site_admin":false},"body":"The actions comes from sysadmin_dashboard.html and right now there's only one action for this tab.","created_at":"2015-02-12T20:47:22Z","updated_at":"2015-02-12T20:47:22Z","html_url":"https://github.com/Stanford-Online/edx-platform/pull/205#discussion_r24618580","pull_request_url":"https://api.github.com/repos/Stanford-Online/edx-platform/pulls/205","_links":{"self":{"href":"https://api.github.com/repos/Stanford-Online/edx-platform/pulls/comments/24618580"},"html":{"href":"https://github.com/Stanford-Online/edx-platform/pull/205#discussion_r24618580"},"pull_request":{"href":"https://api.github.com/repos/Stanford-Online/edx-platform/pulls/205"}}},"pull_request":{"url":"https://api.github.com/repos/Stanford-Online/edx-platform/pulls/205","id":28969093,"html_url":"https://github.com/Stanford-Online/edx-platform/pull/205","diff_url":"https://github.com/Stanford-Online/edx-platform/pull/205.diff","patch_url":"https://github.com/Stanford-Online/edx-platform/pull/205.patch","issue_url":"https://api.github.com/repos/Stanford-Online/edx-platform/issues/205","number":205,"state":"open","locked":false,"title":"Add tab to Sysadmin Dashboard to fix bad queue tasks.","user":{"login":"dcadams","id":1840555,"avatar_url":"https://avatars.githubusercontent.com/u/1840555?v=3","gravatar_id":"","url":"https://api.github.com/users/dcadams","html_url":"https://github.com/dcadams","followers_url":"https://api.github.com/users/dcadams/followers","following_url":"https://api.github.com/users/dcadams/following{/other_user}","gists_url":"https://api.github.com/users/dcadams/gists{/gist_id}","starred_url":"https://api.github.com/users/dcadams/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dcadams/subscriptions","organizations_url":"https://api.github.com/users/dcadams/orgs","repos_url":"https://api.github.com/users/dcadams/repos","events_url":"https://api.github.com/users/dcadams/events{/privacy}","received_events_url":"https://api.github.com/users/dcadams/received_events","type":"User","site_admin":false},"body":"On occasion, mainly after a release, it has been found that\r\nentries in the instructor_task_instructortask table get\r\nstuck with a task_state of QUEUING.\r\n\r\nThis PR enables a course staff member to change the state\r\nof said entry and so allow other tasks to run.","created_at":"2015-02-10T00:02:25Z","updated_at":"2015-02-12T20:47:22Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ae948cf4b09b582f868b9475332ccc75d86232b3","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/Stanford-Online/edx-platform/pulls/205/commits","review_comments_url":"https://api.github.com/repos/Stanford-Online/edx-platform/pulls/205/comments","review_comment_url":"https://api.github.com/repos/Stanford-Online/edx-platform/pulls/comments/{number}","comments_url":"https://api.github.com/repos/Stanford-Online/edx-platform/issues/205/comments","statuses_url":"https://api.github.com/repos/Stanford-Online/edx-platform/statuses/fb60d3c2a74f5b9284243f219a61aeb03c756e9d","head":{"label":"Stanford-Online:dcadams/fix_queue_task","ref":"dcadams/fix_queue_task","sha":"fb60d3c2a74f5b9284243f219a61aeb03c756e9d","user":{"login":"Stanford-Online","id":2159497,"avatar_url":"https://avatars.githubusercontent.com/u/2159497?v=3","gravatar_id":"","url":"https://api.github.com/users/Stanford-Online","html_url":"https://github.com/Stanford-Online","followers_url":"https://api.github.com/users/Stanford-Online/followers","following_url":"https://api.github.com/users/Stanford-Online/following{/other_user}","gists_url":"https://api.github.com/users/Stanford-Online/gists{/gist_id}","starred_url":"https://api.github.com/users/Stanford-Online/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Stanford-Online/subscriptions","organizations_url":"https://api.github.com/users/Stanford-Online/orgs","repos_url":"https://api.github.com/users/Stanford-Online/repos","events_url":"https://api.github.com/users/Stanford-Online/events{/privacy}","received_events_url":"https://api.github.com/users/Stanford-Online/received_events","type":"Organization","site_admin":false},"repo":{"id":11616657,"name":"edx-platform","full_name":"Stanford-Online/edx-platform","owner":{"login":"Stanford-Online","id":2159497,"avatar_url":"https://avatars.githubusercontent.com/u/2159497?v=3","gravatar_id":"","url":"https://api.github.com/users/Stanford-Online","html_url":"https://github.com/Stanford-Online","followers_url":"https://api.github.com/users/Stanford-Online/followers","following_url":"https://api.github.com/users/Stanford-Online/following{/other_user}","gists_url":"https://api.github.com/users/Stanford-Online/gists{/gist_id}","starred_url":"https://api.github.com/users/Stanford-Online/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Stanford-Online/subscriptions","organizations_url":"https://api.github.com/users/Stanford-Online/orgs","repos_url":"https://api.github.com/users/Stanford-Online/repos","events_url":"https://api.github.com/users/Stanford-Online/events{/privacy}","received_events_url":"https://api.github.com/users/Stanford-Online/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Stanford-Online/edx-platform","description":"the edX learning management system (LMS) and course authoring tool, Studio","fork":true,"url":"https://api.github.com/repos/Stanford-Online/edx-platform","forks_url":"https://api.github.com/repos/Stanford-Online/edx-platform/forks","keys_url":"https://api.github.com/repos/Stanford-Online/edx-platform/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Stanford-Online/edx-platform/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Stanford-Online/edx-platform/teams","hooks_url":"https://api.github.com/repos/Stanford-Online/edx-platform/hooks","issue_events_url":"https://api.github.com/repos/Stanford-Online/edx-platform/issues/events{/number}","events_url":"https://api.github.com/repos/Stanford-Online/edx-platform/events","assignees_url":"https://api.github.com/repos/Stanford-Online/edx-platform/assignees{/user}","branches_url":"https://api.github.com/repos/Stanford-Online/edx-platform/branches{/branch}","tags_url":"https://api.github.com/repos/Stanford-Online/edx-platform/tags","blobs_url":"https://api.github.com/repos/Stanford-Online/edx-platform/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Stanford-Online/edx-platform/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Stanford-Online/edx-platform/git/refs{/sha}","trees_url":"https://api.github.com/repos/Stanford-Online/edx-platform/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Stanford-Online/edx-platform/statuses/{sha}","languages_url":"https://api.github.com/repos/Stanford-Online/edx-platform/languages","stargazers_url":"https://api.github.com/repos/Stanford-Online/edx-platform/stargazers","contributors_url":"https://api.github.com/repos/Stanford-Online/edx-platform/contributors","subscribers_url":"https://api.github.com/repos/Stanford-Online/edx-platform/subscribers","subscription_url":"https://api.github.com/repos/Stanford-Online/edx-platform/subscription","commits_url":"https://api.github.com/repos/Stanford-Online/edx-platform/commits{/sha}","git_commits_url":"https://api.github.com/repos/Stanford-Online/edx-platform/git/commits{/sha}","comments_url":"https://api.github.com/repos/Stanford-Online/edx-platform/comments{/number}","issue_comment_url":"https://api.github.com/repos/Stanford-Online/edx-platform/issues/comments/{number}","contents_url":"https://api.github.com/repos/Stanford-Online/edx-platform/contents/{+path}","compare_url":"https://api.github.com/repos/Stanford-Online/edx-platform/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Stanford-Online/edx-platform/merges","archive_url":"https://api.github.com/repos/Stanford-Online/edx-platform/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Stanford-Online/edx-platform/downloads","issues_url":"https://api.github.com/repos/Stanford-Online/edx-platform/issues{/number}","pulls_url":"https://api.github.com/repos/Stanford-Online/edx-platform/pulls{/number}","milestones_url":"https://api.github.com/repos/Stanford-Online/edx-platform/milestones{/number}","notifications_url":"https://api.github.com/repos/Stanford-Online/edx-platform/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Stanford-Online/edx-platform/labels{/name}","releases_url":"https://api.github.com/repos/Stanford-Online/edx-platform/releases{/id}","created_at":"2013-07-23T19:05:46Z","updated_at":"2015-02-12T20:25:35Z","pushed_at":"2015-02-12T20:45:09Z","git_url":"git://github.com/Stanford-Online/edx-platform.git","ssh_url":"git@github.com:Stanford-Online/edx-platform.git","clone_url":"https://github.com/Stanford-Online/edx-platform.git","svn_url":"https://github.com/Stanford-Online/edx-platform","homepage":"http://code.edx.org/","size":383353,"stargazers_count":10,"watchers_count":10,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3,"mirror_url":null,"open_issues_count":57,"forks":3,"open_issues":57,"watchers":10,"default_branch":"master"}},"base":{"label":"Stanford-Online:master","ref":"master","sha":"dd2f132a899b6d23f34af09f420c91a321e89411","user":{"login":"Stanford-Online","id":2159497,"avatar_url":"https://avatars.githubusercontent.com/u/2159497?v=3","gravatar_id":"","url":"https://api.github.com/users/Stanford-Online","html_url":"https://github.com/Stanford-Online","followers_url":"https://api.github.com/users/Stanford-Online/followers","following_url":"https://api.github.com/users/Stanford-Online/following{/other_user}","gists_url":"https://api.github.com/users/Stanford-Online/gists{/gist_id}","starred_url":"https://api.github.com/users/Stanford-Online/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Stanford-Online/subscriptions","organizations_url":"https://api.github.com/users/Stanford-Online/orgs","repos_url":"https://api.github.com/users/Stanford-Online/repos","events_url":"https://api.github.com/users/Stanford-Online/events{/privacy}","received_events_url":"https://api.github.com/users/Stanford-Online/received_events","type":"Organization","site_admin":false},"repo":{"id":11616657,"name":"edx-platform","full_name":"Stanford-Online/edx-platform","owner":{"login":"Stanford-Online","id":2159497,"avatar_url":"https://avatars.githubusercontent.com/u/2159497?v=3","gravatar_id":"","url":"https://api.github.com/users/Stanford-Online","html_url":"https://github.com/Stanford-Online","followers_url":"https://api.github.com/users/Stanford-Online/followers","following_url":"https://api.github.com/users/Stanford-Online/following{/other_user}","gists_url":"https://api.github.com/users/Stanford-Online/gists{/gist_id}","starred_url":"https://api.github.com/users/Stanford-Online/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Stanford-Online/subscriptions","organizations_url":"https://api.github.com/users/Stanford-Online/orgs","repos_url":"https://api.github.com/users/Stanford-Online/repos","events_url":"https://api.github.com/users/Stanford-Online/events{/privacy}","received_events_url":"https://api.github.com/users/Stanford-Online/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Stanford-Online/edx-platform","description":"the edX learning management system (LMS) and course authoring tool, Studio","fork":true,"url":"https://api.github.com/repos/Stanford-Online/edx-platform","forks_url":"https://api.github.com/repos/Stanford-Online/edx-platform/forks","keys_url":"https://api.github.com/repos/Stanford-Online/edx-platform/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Stanford-Online/edx-platform/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Stanford-Online/edx-platform/teams","hooks_url":"https://api.github.com/repos/Stanford-Online/edx-platform/hooks","issue_events_url":"https://api.github.com/repos/Stanford-Online/edx-platform/issues/events{/number}","events_url":"https://api.github.com/repos/Stanford-Online/edx-platform/events","assignees_url":"https://api.github.com/repos/Stanford-Online/edx-platform/assignees{/user}","branches_url":"https://api.github.com/repos/Stanford-Online/edx-platform/branches{/branch}","tags_url":"https://api.github.com/repos/Stanford-Online/edx-platform/tags","blobs_url":"https://api.github.com/repos/Stanford-Online/edx-platform/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Stanford-Online/edx-platform/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Stanford-Online/edx-platform/git/refs{/sha}","trees_url":"https://api.github.com/repos/Stanford-Online/edx-platform/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Stanford-Online/edx-platform/statuses/{sha}","languages_url":"https://api.github.com/repos/Stanford-Online/edx-platform/languages","stargazers_url":"https://api.github.com/repos/Stanford-Online/edx-platform/stargazers","contributors_url":"https://api.github.com/repos/Stanford-Online/edx-platform/contributors","subscribers_url":"https://api.github.com/repos/Stanford-Online/edx-platform/subscribers","subscription_url":"https://api.github.com/repos/Stanford-Online/edx-platform/subscription","commits_url":"https://api.github.com/repos/Stanford-Online/edx-platform/commits{/sha}","git_commits_url":"https://api.github.com/repos/Stanford-Online/edx-platform/git/commits{/sha}","comments_url":"https://api.github.com/repos/Stanford-Online/edx-platform/comments{/number}","issue_comment_url":"https://api.github.com/repos/Stanford-Online/edx-platform/issues/comments/{number}","contents_url":"https://api.github.com/repos/Stanford-Online/edx-platform/contents/{+path}","compare_url":"https://api.github.com/repos/Stanford-Online/edx-platform/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Stanford-Online/edx-platform/merges","archive_url":"https://api.github.com/repos/Stanford-Online/edx-platform/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Stanford-Online/edx-platform/downloads","issues_url":"https://api.github.com/repos/Stanford-Online/edx-platform/issues{/number}","pulls_url":"https://api.github.com/repos/Stanford-Online/edx-platform/pulls{/number}","milestones_url":"https://api.github.com/repos/Stanford-Online/edx-platform/milestones{/number}","notifications_url":"https://api.github.com/repos/Stanford-Online/edx-platform/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Stanford-Online/edx-platform/labels{/name}","releases_url":"https://api.github.com/repos/Stanford-Online/edx-platform/releases{/id}","created_at":"2013-07-23T19:05:46Z","updated_at":"2015-02-12T20:25:35Z","pushed_at":"2015-02-12T20:45:09Z","git_url":"git://github.com/Stanford-Online/edx-platform.git","ssh_url":"git@github.com:Stanford-Online/edx-platform.git","clone_url":"https://github.com/Stanford-Online/edx-platform.git","svn_url":"https://github.com/Stanford-Online/edx-platform","homepage":"http://code.edx.org/","size":383353,"stargazers_count":10,"watchers_count":10,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3,"mirror_url":null,"open_issues_count":57,"forks":3,"open_issues":57,"watchers":10,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Stanford-Online/edx-platform/pulls/205"},"html":{"href":"https://github.com/Stanford-Online/edx-platform/pull/205"},"issue":{"href":"https://api.github.com/repos/Stanford-Online/edx-platform/issues/205"},"comments":{"href":"https://api.github.com/repos/Stanford-Online/edx-platform/issues/205/comments"},"review_comments":{"href":"https://api.github.com/repos/Stanford-Online/edx-platform/pulls/205/comments"},"review_comment":{"href":"https://api.github.com/repos/Stanford-Online/edx-platform/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/Stanford-Online/edx-platform/pulls/205/commits"},"statuses":{"href":"https://api.github.com/repos/Stanford-Online/edx-platform/statuses/fb60d3c2a74f5b9284243f219a61aeb03c756e9d"}}}}