{"action":"created","issue":{"url":"https://api.github.com/repos/pyfarm/pyfarm-agent/issues/335","labels_url":"https://api.github.com/repos/pyfarm/pyfarm-agent/issues/335/labels{/name}","comments_url":"https://api.github.com/repos/pyfarm/pyfarm-agent/issues/335/comments","events_url":"https://api.github.com/repos/pyfarm/pyfarm-agent/issues/335/events","html_url":"https://github.com/pyfarm/pyfarm-agent/pull/335","id":111309470,"number":335,"title":"Modify assign API to respond directly with tuples","user":{"login":"opalmer","id":255117,"avatar_url":"https://avatars.githubusercontent.com/u/255117?v=3","gravatar_id":"","url":"https://api.github.com/users/opalmer","html_url":"https://github.com/opalmer","followers_url":"https://api.github.com/users/opalmer/followers","following_url":"https://api.github.com/users/opalmer/following{/other_user}","gists_url":"https://api.github.com/users/opalmer/gists{/gist_id}","starred_url":"https://api.github.com/users/opalmer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/opalmer/subscriptions","organizations_url":"https://api.github.com/users/opalmer/orgs","repos_url":"https://api.github.com/users/opalmer/repos","events_url":"https://api.github.com/users/opalmer/events{/privacy}","received_events_url":"https://api.github.com/users/opalmer/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/pyfarm/pyfarm-agent/labels/agent:api","name":"agent:api","color":"006b75"},{"url":"https://api.github.com/repos/pyfarm/pyfarm-agent/labels/enhancement","name":"enhancement","color":"84b6eb"}],"state":"open","locked":false,"assignee":{"login":"opalmer","id":255117,"avatar_url":"https://avatars.githubusercontent.com/u/255117?v=3","gravatar_id":"","url":"https://api.github.com/users/opalmer","html_url":"https://github.com/opalmer","followers_url":"https://api.github.com/users/opalmer/followers","following_url":"https://api.github.com/users/opalmer/following{/other_user}","gists_url":"https://api.github.com/users/opalmer/gists{/gist_id}","starred_url":"https://api.github.com/users/opalmer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/opalmer/subscriptions","organizations_url":"https://api.github.com/users/opalmer/orgs","repos_url":"https://api.github.com/users/opalmer/repos","events_url":"https://api.github.com/users/opalmer/events{/privacy}","received_events_url":"https://api.github.com/users/opalmer/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/pyfarm/pyfarm-agent/milestones/7","html_url":"https://github.com/pyfarm/pyfarm-agent/milestones/0.8.7","labels_url":"https://api.github.com/repos/pyfarm/pyfarm-agent/milestones/7/labels","id":1148619,"number":7,"title":"0.8.7","description":"","creator":{"login":"opalmer","id":255117,"avatar_url":"https://avatars.githubusercontent.com/u/255117?v=3","gravatar_id":"","url":"https://api.github.com/users/opalmer","html_url":"https://github.com/opalmer","followers_url":"https://api.github.com/users/opalmer/followers","following_url":"https://api.github.com/users/opalmer/following{/other_user}","gists_url":"https://api.github.com/users/opalmer/gists{/gist_id}","starred_url":"https://api.github.com/users/opalmer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/opalmer/subscriptions","organizations_url":"https://api.github.com/users/opalmer/orgs","repos_url":"https://api.github.com/users/opalmer/repos","events_url":"https://api.github.com/users/opalmer/events{/privacy}","received_events_url":"https://api.github.com/users/opalmer/received_events","type":"User","site_admin":false},"open_issues":5,"closed_issues":40,"state":"open","created_at":"2015-06-04T03:11:38Z","updated_at":"2015-10-26T20:53:39Z","due_on":null,"closed_at":null},"comments":3,"created_at":"2015-10-14T02:39:52Z","updated_at":"2015-10-28T18:00:36Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/pyfarm/pyfarm-agent/pulls/335","html_url":"https://github.com/pyfarm/pyfarm-agent/pull/335","diff_url":"https://github.com/pyfarm/pyfarm-agent/pull/335.diff","patch_url":"https://github.com/pyfarm/pyfarm-agent/pull/335.patch"},"body":"So while working on #334 it's become more apparent that in order to handle exceptions properly and generally cleanup the assignment APIs we need to do a little work converting it to inlineCallbacks.  Otherwise we can end up with a response going back to a client before a job type is actually loaded causing exceptions to possibly swallowed.\r\n\r\nThe modification of the assignment API to use inlineCallbacks will be broken down into another CL but for now this PR modifies some of the code from this style of response:\r\n\r\n```python\r\nrequest.setResponseCode(ACCEPTED)\r\nrequest.write(dumps({\"id\": assignment_uuid}))\r\nrequest.finish()\r\nreturn NOT_DONE_YET\r\n```\r\n\r\nto:\r\n\r\n```python\r\nreturn dumps({\"id\": assignment_uuid}), ACCEPTED\r\n```\r\n\r\nThis approach is cleaner and tightens the coupling some between the request being made and when the response is sent."},"comment":{"url":"https://api.github.com/repos/pyfarm/pyfarm-agent/issues/comments/151933710","html_url":"https://github.com/pyfarm/pyfarm-agent/pull/335#issuecomment-151933710","issue_url":"https://api.github.com/repos/pyfarm/pyfarm-agent/issues/335","id":151933710,"user":{"login":"guidow","id":6033185,"avatar_url":"https://avatars.githubusercontent.com/u/6033185?v=3","gravatar_id":"","url":"https://api.github.com/users/guidow","html_url":"https://github.com/guidow","followers_url":"https://api.github.com/users/guidow/followers","following_url":"https://api.github.com/users/guidow/following{/other_user}","gists_url":"https://api.github.com/users/guidow/gists{/gist_id}","starred_url":"https://api.github.com/users/guidow/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/guidow/subscriptions","organizations_url":"https://api.github.com/users/guidow/orgs","repos_url":"https://api.github.com/users/guidow/repos","events_url":"https://api.github.com/users/guidow/events{/privacy}","received_events_url":"https://api.github.com/users/guidow/received_events","type":"User","site_admin":false},"created_at":"2015-10-28T18:00:36Z","updated_at":"2015-10-28T18:00:36Z","body":"Looks good. Sorry for the long delay."}}