Skip to content

Instantly share code, notes, and snippets.

@nytr0gen
Created March 21, 2017 17:41
Show Gist options
  • Save nytr0gen/9cbd419fd9d13bd0a2a23356d048d403 to your computer and use it in GitHub Desktop.
Save nytr0gen/9cbd419fd9d13bd0a2a23356d048d403 to your computer and use it in GitHub Desktop.
machinery add task pseudocode-ish
id = video_id
task_name = "task_" + generateUUID()
task_status = {
"TaskUUID": task_name,
"State": "PENDING",
"Result": null,
"Error": ""
}
task = {
"UUID": task_name,
"Name": "convert",
"RoutingKey": "",
"GroupUUID": "",
"GroupTaskCount": 0,
"Args": [
{
"Type": "int",
"Value": video_id
}
],
"Headers": null,
"Immutable": false,
"OnSuccess": null,
"OnError": null,
"ChordCallback": null
}
redis.exec('SET ' + task_name + ' ' + JSON.stringify(task_status))
redis.exec('RPUSH machinery_tasks ' + JSON.stringify(task))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment