{"action":"created","comment":{"url":"https://api.github.com/repos/metabrainz/acousticbrainz-server/pulls/comments/73035640","id":73035640,"diff_hunk":"@@ -2,71 +2,72 @@\n from flask import Blueprint, jsonify, request\n from flask_login import current_user\n from webserver.decorators import auth_required\n+from webserver.views.api import exceptions\n import db.dataset_eval\n-import db.dataset\n+import db.data\n \n bp_dataset_eval = Blueprint('api_v1_dataset_eval', __name__)\n \n-@bp_dataset_eval.route(\"/<uuid:job_id>/job-details\", methods=[\"GET\"])\n+@bp_dataset_eval.route(\"/jobs\", methods=[\"GET\"])\n @auth_required\n-def job_details(job_id):\n-    \"\"\"Returns the details of a particular job.\n-       API key argument is required.\n+def get_jobs():\n+    \"\"\"Return a list of jobs related to the current user.\n+       Identify the current user by being logged in or by passing a Token for authentication.\n+\n+       :query status: *Required.* Status of jobs to be returned. Possible values: \"pending\"\n+       :query location: *Required.* Location that the user wants to evaluate jobs. Possible values: \"remote\"\n \n        **Example Response**:\n \n        .. sourcecode:: json\n \n        {\n-           \"job_details\": {\n-               \"created\": \"Tue, 07 Jun 2016 22:12:32 GMT\",\n-               \"dataset_details\": {\n-                   \"author\": 1,\n-                   \"classes\": [\n-                       {\n-                           \"description\": null,\n-                           \"id\": \"141\",\n-                           \"name\": \"Class2\",\n-                           \"recordings\": [\n-                               \"d08ab44b-94c8-482b-a67f-a683a30fbe5a\",\n-                               \"2618cb1d-8699-49df-93f7-a8afea6c914f\"\n-                           ]\n-                       },\n-                       {\n-                           \"description\": null,\n-                           \"id\": \"142\",\n-                           \"name\": \"Class1\",\n-                           \"recordings\": [\n-                               \"5251c17c-c161-4e73-8b1c-4231e8e39095\",\n-                               \"c0dccd50-f9dc-476c-b1f1-84f00adeab51\"\n-                           ]\n-                       }\n-                   ],\n-                   \"created\": \"Mon, 02 May 2016 16:41:08 GMT\",\n-                   \"description\": \"\",\n-                   \"id\": \"5375e0ff-a6d0-44a3-bee1-05d46fbe6bd5\",\n-                   \"last_edited\": \"Mon, 02 May 2016 16:41:08 GMT\",\n-                   \"name\": \"test4\",\n-                   \"public\": true\n-               },\n-               \"dataset_id\": \"5375e0ff-a6d0-44a3-bee1-05d46fbe6bd5\",\n-               \"eval_location\": \"local\",\n-               \"id\": \"7804abe5-58be-4c9c-a787-22b91d031489\",\n-               \"options\": {\n-                   \"filter_type\": null,\n-                   \"normalize\": false\n-               },\n-               \"result\": null,\n-               \"snapshot_id\": \"2d51df50-6b71-410e-bf9a-7e877fc9c6c0\",\n-               \"status\": \"pending\",\n-               \"status_msg\": null,\n-               \"testing_snapshot\": null,\n-               \"training_snapshot\": null,\n-               \"updated\": \"Tue, 07 Jun 2016 22:12:32 GMT\"\n-           },\n-          \"success\": true\n-    }\n+           'username': 'Test'\n+           'jobs': [\n+               {\n+                   'dataset_name': 'test_dataset',\n+                   'created': 'Wed, 08 Jun 2016 21:41:58 GMT',\n+                   'job_id': '0fc553b6-f3a8-4e24-af39-56ac02276ed9'\n+               }\n+           ]\n+       }\n+\n+    :reqheader Content-Type: *application/json*\n+    :<json string username:  MusicBrainz username of the user.\n+    :<json array jobs:       Jobs which match the query.\n+    \"\"\"\n+\n+    location = request.args.get(\"location\")\n+    status = request.args.get(\"status\")\n+    # TODO: This endpoint can be used in the future to get any type of job,\n+    #       but for now we only use it for pending/remote.\n+    if location != db.dataset_eval.EVAL_REMOTE or status != db.dataset_eval.STATUS_PENDING:\n+        raise exceptions.APIBadRequest(\"parameter location must be 'remote' and status 'pending'\")\n+\n+    jobs = db.dataset_eval.get_remote_pending_jobs_for_user(current_user.id)\n+    return jsonify(\n+        username=current_user.musicbrainz_id,\n+        jobs=jobs\n+    )\n+\n+@bp_dataset_eval.route(\"/bulk-recordings/<recording_ids>\", methods=[\"GET\"])\n+def bulk_recordings(recording_ids):\n+    \"\"\"Returns the low level details for all the recording-ids\n+       mentioned in the request with their offset. Offsets are \n+       optional. If no offset is given then a default value of\n+       0 is used.\n     \"\"\"\n-    job = db.dataset_eval.get_job(job_id)\n-    job['dataset_details'] = db.dataset.get(job_details['dataset_id'])\n-    return jsonify({'success' : True, 'job_details' : job})\n+    recordings = recording_ids.split(\";\")","path":"webserver/views/api/v1/dataset_eval.py","position":null,"original_position":115,"commit_id":"1fa2c22d0ef3a323bb8245c37780b31a62afa556","original_commit_id":"1fa2c22d0ef3a323bb8245c37780b31a62afa556","user":{"login":"alastair","id":19217,"avatar_url":"https://avatars.githubusercontent.com/u/19217?v=3","gravatar_id":"","url":"https://api.github.com/users/alastair","html_url":"https://github.com/alastair","followers_url":"https://api.github.com/users/alastair/followers","following_url":"https://api.github.com/users/alastair/following{/other_user}","gists_url":"https://api.github.com/users/alastair/gists{/gist_id}","starred_url":"https://api.github.com/users/alastair/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alastair/subscriptions","organizations_url":"https://api.github.com/users/alastair/orgs","repos_url":"https://api.github.com/users/alastair/repos","events_url":"https://api.github.com/users/alastair/events{/privacy}","received_events_url":"https://api.github.com/users/alastair/received_events","type":"User","site_admin":false},"body":"I suggested ; in http://tickets.musicbrainz.org/browse/AB-147, because we use it in MB: http://musicbrainz.org/doc/Development/XML_Web_Service/Version_2#collections","created_at":"2016-08-01T19:14:00Z","updated_at":"2016-08-01T19:14:00Z","html_url":"https://github.com/metabrainz/acousticbrainz-server/pull/209#discussion_r73035640","pull_request_url":"https://api.github.com/repos/metabrainz/acousticbrainz-server/pulls/209","_links":{"self":{"href":"https://api.github.com/repos/metabrainz/acousticbrainz-server/pulls/comments/73035640"},"html":{"href":"https://github.com/metabrainz/acousticbrainz-server/pull/209#discussion_r73035640"},"pull_request":{"href":"https://api.github.com/repos/metabrainz/acousticbrainz-server/pulls/209"}}},"pull_request":{"url":"https://api.github.com/repos/metabrainz/acousticbrainz-server/pulls/209","id":79490511,"html_url":"https://github.com/metabrainz/acousticbrainz-server/pull/209","diff_url":"https://github.com/metabrainz/acousticbrainz-server/pull/209.diff","patch_url":"https://github.com/metabrainz/acousticbrainz-server/pull/209.patch","issue_url":"https://api.github.com/repos/metabrainz/acousticbrainz-server/issues/209","number":209,"state":"open","locked":false,"title":"Get multiple recordings","user":{"login":"kartikgupta0909","id":8431695,"avatar_url":"https://avatars.githubusercontent.com/u/8431695?v=3","gravatar_id":"","url":"https://api.github.com/users/kartikgupta0909","html_url":"https://github.com/kartikgupta0909","followers_url":"https://api.github.com/users/kartikgupta0909/followers","following_url":"https://api.github.com/users/kartikgupta0909/following{/other_user}","gists_url":"https://api.github.com/users/kartikgupta0909/gists{/gist_id}","starred_url":"https://api.github.com/users/kartikgupta0909/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kartikgupta0909/subscriptions","organizations_url":"https://api.github.com/users/kartikgupta0909/orgs","repos_url":"https://api.github.com/users/kartikgupta0909/repos","events_url":"https://api.github.com/users/kartikgupta0909/events{/privacy}","received_events_url":"https://api.github.com/users/kartikgupta0909/received_events","type":"User","site_admin":false},"body":"This is related to http://tickets.musicbrainz.org/browse/AB-147","created_at":"2016-07-31T17:21:44Z","updated_at":"2016-08-01T19:14:00Z","closed_at":null,"merged_at":null,"merge_commit_sha":"28c4860f13f799a8cd4fe651a940bba2773e7211","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/metabrainz/acousticbrainz-server/pulls/209/commits","review_comments_url":"https://api.github.com/repos/metabrainz/acousticbrainz-server/pulls/209/comments","review_comment_url":"https://api.github.com/repos/metabrainz/acousticbrainz-server/pulls/comments{/number}","comments_url":"https://api.github.com/repos/metabrainz/acousticbrainz-server/issues/209/comments","statuses_url":"https://api.github.com/repos/metabrainz/acousticbrainz-server/statuses/1fa2c22d0ef3a323bb8245c37780b31a62afa556","head":{"label":"metabrainz:Get-Multiple-Recordings","ref":"Get-Multiple-Recordings","sha":"1fa2c22d0ef3a323bb8245c37780b31a62afa556","user":{"login":"metabrainz","id":293421,"avatar_url":"https://avatars.githubusercontent.com/u/293421?v=3","gravatar_id":"","url":"https://api.github.com/users/metabrainz","html_url":"https://github.com/metabrainz","followers_url":"https://api.github.com/users/metabrainz/followers","following_url":"https://api.github.com/users/metabrainz/following{/other_user}","gists_url":"https://api.github.com/users/metabrainz/gists{/gist_id}","starred_url":"https://api.github.com/users/metabrainz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/metabrainz/subscriptions","organizations_url":"https://api.github.com/users/metabrainz/orgs","repos_url":"https://api.github.com/users/metabrainz/repos","events_url":"https://api.github.com/users/metabrainz/events{/privacy}","received_events_url":"https://api.github.com/users/metabrainz/received_events","type":"Organization","site_admin":false},"repo":{"id":24893738,"name":"acousticbrainz-server","full_name":"metabrainz/acousticbrainz-server","owner":{"login":"metabrainz","id":293421,"avatar_url":"https://avatars.githubusercontent.com/u/293421?v=3","gravatar_id":"","url":"https://api.github.com/users/metabrainz","html_url":"https://github.com/metabrainz","followers_url":"https://api.github.com/users/metabrainz/followers","following_url":"https://api.github.com/users/metabrainz/following{/other_user}","gists_url":"https://api.github.com/users/metabrainz/gists{/gist_id}","starred_url":"https://api.github.com/users/metabrainz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/metabrainz/subscriptions","organizations_url":"https://api.github.com/users/metabrainz/orgs","repos_url":"https://api.github.com/users/metabrainz/repos","events_url":"https://api.github.com/users/metabrainz/events{/privacy}","received_events_url":"https://api.github.com/users/metabrainz/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/metabrainz/acousticbrainz-server","description":"The server components for the AcousticBrainz project","fork":false,"url":"https://api.github.com/repos/metabrainz/acousticbrainz-server","forks_url":"https://api.github.com/repos/metabrainz/acousticbrainz-server/forks","keys_url":"https://api.github.com/repos/metabrainz/acousticbrainz-server/keys{/key_id}","collaborators_url":"https://api.github.com/repos/metabrainz/acousticbrainz-server/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/metabrainz/acousticbrainz-server/teams","hooks_url":"https://api.github.com/repos/metabrainz/acousticbrainz-server/hooks","issue_events_url":"https://api.github.com/repos/metabrainz/acousticbrainz-server/issues/events{/number}","events_url":"https://api.github.com/repos/metabrainz/acousticbrainz-server/events","assignees_url":"https://api.github.com/repos/metabrainz/acousticbrainz-server/assignees{/user}","branches_url":"https://api.github.com/repos/metabrainz/acousticbrainz-server/branches{/branch}","tags_url":"https://api.github.com/repos/metabrainz/acousticbrainz-server/tags","blobs_url":"https://api.github.com/repos/metabrainz/acousticbrainz-server/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/metabrainz/acousticbrainz-server/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/metabrainz/acousticbrainz-server/git/refs{/sha}","trees_url":"https://api.github.com/repos/metabrainz/acousticbrainz-server/git/trees{/sha}","statuses_url":"https://api.github.com/repos/metabrainz/acousticbrainz-server/statuses/{sha}","languages_url":"https://api.github.com/repos/metabrainz/acousticbrainz-server/languages","stargazers_url":"https://api.github.com/repos/metabrainz/acousticbrainz-server/stargazers","contributors_url":"https://api.github.com/repos/metabrainz/acousticbrainz-server/contributors","subscribers_url":"https://api.github.com/repos/metabrainz/acousticbrainz-server/subscribers","subscription_url":"https://api.github.com/repos/metabrainz/acousticbrainz-server/subscription","commits_url":"https://api.github.com/repos/metabrainz/acousticbrainz-server/commits{/sha}","git_commits_url":"https://api.github.com/repos/metabrainz/acousticbrainz-server/git/commits{/sha}","comments_url":"https://api.github.com/repos/metabrainz/acousticbrainz-server/comments{/number}","issue_comment_url":"https://api.github.com/repos/metabrainz/acousticbrainz-server/issues/comments{/number}","contents_url":"https://api.github.com/repos/metabrainz/acousticbrainz-server/contents/{+path}","compare_url":"https://api.github.com/repos/metabrainz/acousticbrainz-server/compare/{base}...{head}","merges_url":"https://api.github.com/repos/metabrainz/acousticbrainz-server/merges","archive_url":"https://api.github.com/repos/metabrainz/acousticbrainz-server/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/metabrainz/acousticbrainz-server/downloads","issues_url":"https://api.github.com/repos/metabrainz/acousticbrainz-server/issues{/number}","pulls_url":"https://api.github.com/repos/metabrainz/acousticbrainz-server/pulls{/number}","milestones_url":"https://api.github.com/repos/metabrainz/acousticbrainz-server/milestones{/number}","notifications_url":"https://api.github.com/repos/metabrainz/acousticbrainz-server/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/metabrainz/acousticbrainz-server/labels{/name}","releases_url":"https://api.github.com/repos/metabrainz/acousticbrainz-server/releases{/id}","deployments_url":"https://api.github.com/repos/metabrainz/acousticbrainz-server/deployments","created_at":"2014-10-07T14:22:44Z","updated_at":"2016-07-23T17:23:01Z","pushed_at":"2016-07-31T17:21:44Z","git_url":"git://github.com/metabrainz/acousticbrainz-server.git","ssh_url":"git@github.com:metabrainz/acousticbrainz-server.git","clone_url":"https://github.com/metabrainz/acousticbrainz-server.git","svn_url":"https://github.com/metabrainz/acousticbrainz-server","homepage":"https://acousticbrainz.org/","size":2407,"stargazers_count":38,"watchers_count":38,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":19,"mirror_url":null,"open_issues_count":22,"forks":19,"open_issues":22,"watchers":38,"default_branch":"master"}},"base":{"label":"metabrainz:master","ref":"master","sha":"3b9f087f5e3945cc11c790b25cef73fdf78576c3","user":{"login":"metabrainz","id":293421,"avatar_url":"https://avatars.githubusercontent.com/u/293421?v=3","gravatar_id":"","url":"https://api.github.com/users/metabrainz","html_url":"https://github.com/metabrainz","followers_url":"https://api.github.com/users/metabrainz/followers","following_url":"https://api.github.com/users/metabrainz/following{/other_user}","gists_url":"https://api.github.com/users/metabrainz/gists{/gist_id}","starred_url":"https://api.github.com/users/metabrainz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/metabrainz/subscriptions","organizations_url":"https://api.github.com/users/metabrainz/orgs","repos_url":"https://api.github.com/users/metabrainz/repos","events_url":"https://api.github.com/users/metabrainz/events{/privacy}","received_events_url":"https://api.github.com/users/metabrainz/received_events","type":"Organization","site_admin":false},"repo":{"id":24893738,"name":"acousticbrainz-server","full_name":"metabrainz/acousticbrainz-server","owner":{"login":"metabrainz","id":293421,"avatar_url":"https://avatars.githubusercontent.com/u/293421?v=3","gravatar_id":"","url":"https://api.github.com/users/metabrainz","html_url":"https://github.com/metabrainz","followers_url":"https://api.github.com/users/metabrainz/followers","following_url":"https://api.github.com/users/metabrainz/following{/other_user}","gists_url":"https://api.github.com/users/metabrainz/gists{/gist_id}","starred_url":"https://api.github.com/users/metabrainz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/metabrainz/subscriptions","organizations_url":"https://api.github.com/users/metabrainz/orgs","repos_url":"https://api.github.com/users/metabrainz/repos","events_url":"https://api.github.com/users/metabrainz/events{/privacy}","received_events_url":"https://api.github.com/users/metabrainz/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/metabrainz/acousticbrainz-server","description":"The server components for the AcousticBrainz project","fork":false,"url":"https://api.github.com/repos/metabrainz/acousticbrainz-server","forks_url":"https://api.github.com/repos/metabrainz/acousticbrainz-server/forks","keys_url":"https://api.github.com/repos/metabrainz/acousticbrainz-server/keys{/key_id}","collaborators_url":"https://api.github.com/repos/metabrainz/acousticbrainz-server/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/metabrainz/acousticbrainz-server/teams","hooks_url":"https://api.github.com/repos/metabrainz/acousticbrainz-server/hooks","issue_events_url":"https://api.github.com/repos/metabrainz/acousticbrainz-server/issues/events{/number}","events_url":"https://api.github.com/repos/metabrainz/acousticbrainz-server/events","assignees_url":"https://api.github.com/repos/metabrainz/acousticbrainz-server/assignees{/user}","branches_url":"https://api.github.com/repos/metabrainz/acousticbrainz-server/branches{/branch}","tags_url":"https://api.github.com/repos/metabrainz/acousticbrainz-server/tags","blobs_url":"https://api.github.com/repos/metabrainz/acousticbrainz-server/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/metabrainz/acousticbrainz-server/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/metabrainz/acousticbrainz-server/git/refs{/sha}","trees_url":"https://api.github.com/repos/metabrainz/acousticbrainz-server/git/trees{/sha}","statuses_url":"https://api.github.com/repos/metabrainz/acousticbrainz-server/statuses/{sha}","languages_url":"https://api.github.com/repos/metabrainz/acousticbrainz-server/languages","stargazers_url":"https://api.github.com/repos/metabrainz/acousticbrainz-server/stargazers","contributors_url":"https://api.github.com/repos/metabrainz/acousticbrainz-server/contributors","subscribers_url":"https://api.github.com/repos/metabrainz/acousticbrainz-server/subscribers","subscription_url":"https://api.github.com/repos/metabrainz/acousticbrainz-server/subscription","commits_url":"https://api.github.com/repos/metabrainz/acousticbrainz-server/commits{/sha}","git_commits_url":"https://api.github.com/repos/metabrainz/acousticbrainz-server/git/commits{/sha}","comments_url":"https://api.github.com/repos/metabrainz/acousticbrainz-server/comments{/number}","issue_comment_url":"https://api.github.com/repos/metabrainz/acousticbrainz-server/issues/comments{/number}","contents_url":"https://api.github.com/repos/metabrainz/acousticbrainz-server/contents/{+path}","compare_url":"https://api.github.com/repos/metabrainz/acousticbrainz-server/compare/{base}...{head}","merges_url":"https://api.github.com/repos/metabrainz/acousticbrainz-server/merges","archive_url":"https://api.github.com/repos/metabrainz/acousticbrainz-server/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/metabrainz/acousticbrainz-server/downloads","issues_url":"https://api.github.com/repos/metabrainz/acousticbrainz-server/issues{/number}","pulls_url":"https://api.github.com/repos/metabrainz/acousticbrainz-server/pulls{/number}","milestones_url":"https://api.github.com/repos/metabrainz/acousticbrainz-server/milestones{/number}","notifications_url":"https://api.github.com/repos/metabrainz/acousticbrainz-server/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/metabrainz/acousticbrainz-server/labels{/name}","releases_url":"https://api.github.com/repos/metabrainz/acousticbrainz-server/releases{/id}","deployments_url":"https://api.github.com/repos/metabrainz/acousticbrainz-server/deployments","created_at":"2014-10-07T14:22:44Z","updated_at":"2016-07-23T17:23:01Z","pushed_at":"2016-07-31T17:21:44Z","git_url":"git://github.com/metabrainz/acousticbrainz-server.git","ssh_url":"git@github.com:metabrainz/acousticbrainz-server.git","clone_url":"https://github.com/metabrainz/acousticbrainz-server.git","svn_url":"https://github.com/metabrainz/acousticbrainz-server","homepage":"https://acousticbrainz.org/","size":2407,"stargazers_count":38,"watchers_count":38,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":19,"mirror_url":null,"open_issues_count":22,"forks":19,"open_issues":22,"watchers":38,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/metabrainz/acousticbrainz-server/pulls/209"},"html":{"href":"https://github.com/metabrainz/acousticbrainz-server/pull/209"},"issue":{"href":"https://api.github.com/repos/metabrainz/acousticbrainz-server/issues/209"},"comments":{"href":"https://api.github.com/repos/metabrainz/acousticbrainz-server/issues/209/comments"},"review_comments":{"href":"https://api.github.com/repos/metabrainz/acousticbrainz-server/pulls/209/comments"},"review_comment":{"href":"https://api.github.com/repos/metabrainz/acousticbrainz-server/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/metabrainz/acousticbrainz-server/pulls/209/commits"},"statuses":{"href":"https://api.github.com/repos/metabrainz/acousticbrainz-server/statuses/1fa2c22d0ef3a323bb8245c37780b31a62afa556"}}}}
{"actor":{"display_login":"alastair"}}