Created
March 21, 2017 17:41
-
-
Save nytr0gen/9cbd419fd9d13bd0a2a23356d048d403 to your computer and use it in GitHub Desktop.
machinery add task pseudocode-ish
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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