Closed jimjshields closed 4 years ago
Changed the suggested API after discussing with @spulec (inspiration from botocore's event registry):
from pyqs import task, events
def print_pre_process(context):
print({"pre_process": context})
def print_post_process(context):
print({"pre_process": context})
events.register_event("pre_process", print_pre_process)
events.register_event("post_process", print_post_process)
@task(queue="my_queue")
def send_email(subject):
pass
pyqs email.tasks.send_email
# {"pre_process": {"task_name": "send_email", ...}}
# {"post_process": {"task_name": "send_email", "status": "success", ...}}
Still no tests, but what do you think about this API @spulec? If it's good, I can work on tests.
I like this!
If we can add some tests, I'll be happy to merge.
Refactored & renamed a few things, and added unit / functional tests.
@spulec do you think there are uncovered cases? I know there aren't any end-to-end tests, but I don't think it's necessary to come up with a way to do those for this change.
Bumping this @spulec — if you're not sure about merging yet, is there a suggested way to test a beta version from a branch?
Thanks @jimjshields !
This is a proof of concept for https://github.com/spulec/PyQS/issues/70
I haven't figured out how best to test this, it might require a more end-to-end test.
Works like: