{"action":"created","comment":{"url":"https://api.github.com/repos/cognoma/task-service/pulls/comments/86768098","pull_request_review_id":7407207,"id":86768098,"diff_hunk":"@@ -37,28 +35,32 @@ class Meta:\n             )\n         ]\n     )\n-    priority_levels = postgresfields.ArrayField(models.CharField(max_length=8, choices=PRIORITY_CHOICES))\n     title = models.CharField(null=True, max_length=255, blank=False) # ex \"Classifier Search\"\n     description = models.CharField(null=True, max_length=2048, blank=False) # optional description\n     default_timeout = models.IntegerField(default=600) # default timeout, in seconds\n     max_attempts = models.IntegerField(default=1) # max number of times this job can attempt to run\n     created_at = models.DateTimeField(auto_now_add=True)\n     updated_at = models.DateTimeField(auto_now=True)\n \n+class ValidateTaskPriority(object):\n+    def __init__(self, base):\n+        self.base = base\n+\n+    def __call__(self, value):\n+        print('in validator')\n+        print(self)\n+\n class Task(models.Model):\n     class Meta:\n         db_table = \"tasks\"\n \n     task_def = models.ForeignKey(TaskDef, db_column=\"task_def_name\")\n-    message_id = models.CharField(null=True, max_length=255)\n-    lock_id = models.CharField(null=True, max_length=255) # message or lock id from queue\n-    status = models.CharField(choices=STATUS_CHOICES, max_length=17)\n-    received_at = models.DateTimeField(null=True)\n+    status = models.CharField(choices=STATUS_CHOICES, max_length=17, default='queued')\n+    worker_id = models.CharField(null=True, max_length=255)\n+    locked_at = models.DateTimeField(null=True)\n     priority = models.CharField(choices=PRIORITY_CHOICES, max_length=8, default=\"normal\")\n     unique = models.CharField(null=True, max_length=255)","path":"api/models.py","position":42,"original_position":42,"commit_id":"12473ef7bdf7d0035f9110f6f8d1a6aec941ae3f","original_commit_id":"12473ef7bdf7d0035f9110f6f8d1a6aec941ae3f","user":{"login":"cgreene","id":542643,"avatar_url":"https://avatars.githubusercontent.com/u/542643?v=3","gravatar_id":"","url":"https://api.github.com/users/cgreene","html_url":"https://github.com/cgreene","followers_url":"https://api.github.com/users/cgreene/followers","following_url":"https://api.github.com/users/cgreene/following{/other_user}","gists_url":"https://api.github.com/users/cgreene/gists{/gist_id}","starred_url":"https://api.github.com/users/cgreene/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cgreene/subscriptions","organizations_url":"https://api.github.com/users/cgreene/orgs","repos_url":"https://api.github.com/users/cgreene/repos","events_url":"https://api.github.com/users/cgreene/events{/privacy}","received_events_url":"https://api.github.com/users/cgreene/received_events","type":"User","site_admin":false},"body":"I don't, at this moment, understand what `unique` is for.","created_at":"2016-11-07T12:47:00Z","updated_at":"2016-11-07T12:55:18Z","html_url":"https://github.com/cognoma/task-service/pull/6#discussion_r86768098","pull_request_url":"https://api.github.com/repos/cognoma/task-service/pulls/6","_links":{"self":{"href":"https://api.github.com/repos/cognoma/task-service/pulls/comments/86768098"},"html":{"href":"https://github.com/cognoma/task-service/pull/6#discussion_r86768098"},"pull_request":{"href":"https://api.github.com/repos/cognoma/task-service/pulls/6"}}},"pull_request":{"url":"https://api.github.com/repos/cognoma/task-service/pulls/6","id":92504139,"html_url":"https://github.com/cognoma/task-service/pull/6","diff_url":"https://github.com/cognoma/task-service/pull/6.diff","patch_url":"https://github.com/cognoma/task-service/pull/6.patch","issue_url":"https://api.github.com/repos/cognoma/task-service/issues/6","number":6,"state":"open","locked":false,"title":"Feature/mvp queue","user":{"login":"awm33","id":3846080,"avatar_url":"https://avatars.githubusercontent.com/u/3846080?v=3","gravatar_id":"","url":"https://api.github.com/users/awm33","html_url":"https://github.com/awm33","followers_url":"https://api.github.com/users/awm33/followers","following_url":"https://api.github.com/users/awm33/following{/other_user}","gists_url":"https://api.github.com/users/awm33/gists{/gist_id}","starred_url":"https://api.github.com/users/awm33/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/awm33/subscriptions","organizations_url":"https://api.github.com/users/awm33/orgs","repos_url":"https://api.github.com/users/awm33/repos","events_url":"https://api.github.com/users/awm33/events{/privacy}","received_events_url":"https://api.github.com/users/awm33/received_events","type":"User","site_admin":false},"body":"### Motivation\r\n\r\nQueue implementation for the Cognoma MVP.\r\n\r\n### API changes\r\n\r\nSome fields have been removed for MVP or are not needed for this queue backing type.\r\n\r\n### Implementation Notes\r\n\r\nIt uses a postgres SKIP LOCKED based task table and should handle a decent amount of concurrency, even greater than the number of workers we have budgeted for (2 to 3).\r\n\r\n### Functional Tests\r\n\r\nTesting against the API using curl and the beginnings of the [ml-workers](https://github.com/cognoma/ml-workers) code.\r\n","created_at":"2016-11-06T21:52:23Z","updated_at":"2016-11-07T12:55:18Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b731f97b25918615967dfa09c409e1b0bdf63a10","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/cognoma/task-service/pulls/6/commits","review_comments_url":"https://api.github.com/repos/cognoma/task-service/pulls/6/comments","review_comment_url":"https://api.github.com/repos/cognoma/task-service/pulls/comments{/number}","comments_url":"https://api.github.com/repos/cognoma/task-service/issues/6/comments","statuses_url":"https://api.github.com/repos/cognoma/task-service/statuses/12473ef7bdf7d0035f9110f6f8d1a6aec941ae3f","head":{"label":"cognoma:feature/mvp-queue","ref":"feature/mvp-queue","sha":"12473ef7bdf7d0035f9110f6f8d1a6aec941ae3f","user":{"login":"cognoma","id":20342585,"avatar_url":"https://avatars.githubusercontent.com/u/20342585?v=3","gravatar_id":"","url":"https://api.github.com/users/cognoma","html_url":"https://github.com/cognoma","followers_url":"https://api.github.com/users/cognoma/followers","following_url":"https://api.github.com/users/cognoma/following{/other_user}","gists_url":"https://api.github.com/users/cognoma/gists{/gist_id}","starred_url":"https://api.github.com/users/cognoma/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cognoma/subscriptions","organizations_url":"https://api.github.com/users/cognoma/orgs","repos_url":"https://api.github.com/users/cognoma/repos","events_url":"https://api.github.com/users/cognoma/events{/privacy}","received_events_url":"https://api.github.com/users/cognoma/received_events","type":"Organization","site_admin":false},"repo":{"id":63168110,"name":"task-service","full_name":"cognoma/task-service","owner":{"login":"cognoma","id":20342585,"avatar_url":"https://avatars.githubusercontent.com/u/20342585?v=3","gravatar_id":"","url":"https://api.github.com/users/cognoma","html_url":"https://github.com/cognoma","followers_url":"https://api.github.com/users/cognoma/followers","following_url":"https://api.github.com/users/cognoma/following{/other_user}","gists_url":"https://api.github.com/users/cognoma/gists{/gist_id}","starred_url":"https://api.github.com/users/cognoma/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cognoma/subscriptions","organizations_url":"https://api.github.com/users/cognoma/orgs","repos_url":"https://api.github.com/users/cognoma/repos","events_url":"https://api.github.com/users/cognoma/events{/privacy}","received_events_url":"https://api.github.com/users/cognoma/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/cognoma/task-service","description":"Cognoma Background Tasks API","fork":false,"url":"https://api.github.com/repos/cognoma/task-service","forks_url":"https://api.github.com/repos/cognoma/task-service/forks","keys_url":"https://api.github.com/repos/cognoma/task-service/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cognoma/task-service/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cognoma/task-service/teams","hooks_url":"https://api.github.com/repos/cognoma/task-service/hooks","issue_events_url":"https://api.github.com/repos/cognoma/task-service/issues/events{/number}","events_url":"https://api.github.com/repos/cognoma/task-service/events","assignees_url":"https://api.github.com/repos/cognoma/task-service/assignees{/user}","branches_url":"https://api.github.com/repos/cognoma/task-service/branches{/branch}","tags_url":"https://api.github.com/repos/cognoma/task-service/tags","blobs_url":"https://api.github.com/repos/cognoma/task-service/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cognoma/task-service/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cognoma/task-service/git/refs{/sha}","trees_url":"https://api.github.com/repos/cognoma/task-service/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cognoma/task-service/statuses/{sha}","languages_url":"https://api.github.com/repos/cognoma/task-service/languages","stargazers_url":"https://api.github.com/repos/cognoma/task-service/stargazers","contributors_url":"https://api.github.com/repos/cognoma/task-service/contributors","subscribers_url":"https://api.github.com/repos/cognoma/task-service/subscribers","subscription_url":"https://api.github.com/repos/cognoma/task-service/subscription","commits_url":"https://api.github.com/repos/cognoma/task-service/commits{/sha}","git_commits_url":"https://api.github.com/repos/cognoma/task-service/git/commits{/sha}","comments_url":"https://api.github.com/repos/cognoma/task-service/comments{/number}","issue_comment_url":"https://api.github.com/repos/cognoma/task-service/issues/comments{/number}","contents_url":"https://api.github.com/repos/cognoma/task-service/contents/{+path}","compare_url":"https://api.github.com/repos/cognoma/task-service/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cognoma/task-service/merges","archive_url":"https://api.github.com/repos/cognoma/task-service/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cognoma/task-service/downloads","issues_url":"https://api.github.com/repos/cognoma/task-service/issues{/number}","pulls_url":"https://api.github.com/repos/cognoma/task-service/pulls{/number}","milestones_url":"https://api.github.com/repos/cognoma/task-service/milestones{/number}","notifications_url":"https://api.github.com/repos/cognoma/task-service/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cognoma/task-service/labels{/name}","releases_url":"https://api.github.com/repos/cognoma/task-service/releases{/id}","deployments_url":"https://api.github.com/repos/cognoma/task-service/deployments","created_at":"2016-07-12T15:09:17Z","updated_at":"2016-10-12T03:06:12Z","pushed_at":"2016-11-06T21:52:23Z","git_url":"git://github.com/cognoma/task-service.git","ssh_url":"git@github.com:cognoma/task-service.git","clone_url":"https://github.com/cognoma/task-service.git","svn_url":"https://github.com/cognoma/task-service","homepage":"","size":58,"stargazers_count":1,"watchers_count":1,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":2,"forks":0,"open_issues":2,"watchers":1,"default_branch":"master"}},"base":{"label":"cognoma:master","ref":"master","sha":"89b6033856ec7ed02a4dcf1ee54e3e61e7c00df2","user":{"login":"cognoma","id":20342585,"avatar_url":"https://avatars.githubusercontent.com/u/20342585?v=3","gravatar_id":"","url":"https://api.github.com/users/cognoma","html_url":"https://github.com/cognoma","followers_url":"https://api.github.com/users/cognoma/followers","following_url":"https://api.github.com/users/cognoma/following{/other_user}","gists_url":"https://api.github.com/users/cognoma/gists{/gist_id}","starred_url":"https://api.github.com/users/cognoma/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cognoma/subscriptions","organizations_url":"https://api.github.com/users/cognoma/orgs","repos_url":"https://api.github.com/users/cognoma/repos","events_url":"https://api.github.com/users/cognoma/events{/privacy}","received_events_url":"https://api.github.com/users/cognoma/received_events","type":"Organization","site_admin":false},"repo":{"id":63168110,"name":"task-service","full_name":"cognoma/task-service","owner":{"login":"cognoma","id":20342585,"avatar_url":"https://avatars.githubusercontent.com/u/20342585?v=3","gravatar_id":"","url":"https://api.github.com/users/cognoma","html_url":"https://github.com/cognoma","followers_url":"https://api.github.com/users/cognoma/followers","following_url":"https://api.github.com/users/cognoma/following{/other_user}","gists_url":"https://api.github.com/users/cognoma/gists{/gist_id}","starred_url":"https://api.github.com/users/cognoma/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cognoma/subscriptions","organizations_url":"https://api.github.com/users/cognoma/orgs","repos_url":"https://api.github.com/users/cognoma/repos","events_url":"https://api.github.com/users/cognoma/events{/privacy}","received_events_url":"https://api.github.com/users/cognoma/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/cognoma/task-service","description":"Cognoma Background Tasks API","fork":false,"url":"https://api.github.com/repos/cognoma/task-service","forks_url":"https://api.github.com/repos/cognoma/task-service/forks","keys_url":"https://api.github.com/repos/cognoma/task-service/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cognoma/task-service/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cognoma/task-service/teams","hooks_url":"https://api.github.com/repos/cognoma/task-service/hooks","issue_events_url":"https://api.github.com/repos/cognoma/task-service/issues/events{/number}","events_url":"https://api.github.com/repos/cognoma/task-service/events","assignees_url":"https://api.github.com/repos/cognoma/task-service/assignees{/user}","branches_url":"https://api.github.com/repos/cognoma/task-service/branches{/branch}","tags_url":"https://api.github.com/repos/cognoma/task-service/tags","blobs_url":"https://api.github.com/repos/cognoma/task-service/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cognoma/task-service/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cognoma/task-service/git/refs{/sha}","trees_url":"https://api.github.com/repos/cognoma/task-service/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cognoma/task-service/statuses/{sha}","languages_url":"https://api.github.com/repos/cognoma/task-service/languages","stargazers_url":"https://api.github.com/repos/cognoma/task-service/stargazers","contributors_url":"https://api.github.com/repos/cognoma/task-service/contributors","subscribers_url":"https://api.github.com/repos/cognoma/task-service/subscribers","subscription_url":"https://api.github.com/repos/cognoma/task-service/subscription","commits_url":"https://api.github.com/repos/cognoma/task-service/commits{/sha}","git_commits_url":"https://api.github.com/repos/cognoma/task-service/git/commits{/sha}","comments_url":"https://api.github.com/repos/cognoma/task-service/comments{/number}","issue_comment_url":"https://api.github.com/repos/cognoma/task-service/issues/comments{/number}","contents_url":"https://api.github.com/repos/cognoma/task-service/contents/{+path}","compare_url":"https://api.github.com/repos/cognoma/task-service/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cognoma/task-service/merges","archive_url":"https://api.github.com/repos/cognoma/task-service/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cognoma/task-service/downloads","issues_url":"https://api.github.com/repos/cognoma/task-service/issues{/number}","pulls_url":"https://api.github.com/repos/cognoma/task-service/pulls{/number}","milestones_url":"https://api.github.com/repos/cognoma/task-service/milestones{/number}","notifications_url":"https://api.github.com/repos/cognoma/task-service/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cognoma/task-service/labels{/name}","releases_url":"https://api.github.com/repos/cognoma/task-service/releases{/id}","deployments_url":"https://api.github.com/repos/cognoma/task-service/deployments","created_at":"2016-07-12T15:09:17Z","updated_at":"2016-10-12T03:06:12Z","pushed_at":"2016-11-06T21:52:23Z","git_url":"git://github.com/cognoma/task-service.git","ssh_url":"git@github.com:cognoma/task-service.git","clone_url":"https://github.com/cognoma/task-service.git","svn_url":"https://github.com/cognoma/task-service","homepage":"","size":58,"stargazers_count":1,"watchers_count":1,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":2,"forks":0,"open_issues":2,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/cognoma/task-service/pulls/6"},"html":{"href":"https://github.com/cognoma/task-service/pull/6"},"issue":{"href":"https://api.github.com/repos/cognoma/task-service/issues/6"},"comments":{"href":"https://api.github.com/repos/cognoma/task-service/issues/6/comments"},"review_comments":{"href":"https://api.github.com/repos/cognoma/task-service/pulls/6/comments"},"review_comment":{"href":"https://api.github.com/repos/cognoma/task-service/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/cognoma/task-service/pulls/6/commits"},"statuses":{"href":"https://api.github.com/repos/cognoma/task-service/statuses/12473ef7bdf7d0035f9110f6f8d1a6aec941ae3f"}}}}
{"actor":{"display_login":"cgreene"}}