currentfeature/docs
Last change
on this file since b5d87e0 was
b5d87e0,
checked in by Borja Lopez <borja@…>, 5 years ago
|
(#29) Added a tasks module, implemented a task to run the mail queue processor,
sending any automatically generated emails in the queue.
Tasks can be run manually, with the virtual env active:
python ow/tasks/run.py development.ini TASK_NAME
(where TASK_NAME is the name of a task, like send_emails)
Running the run.py script without parameters gives an usage-like message
with instructions on how to properly call the script.
|
-
Property mode set to
100644
|
File size:
533 bytes
|
Rev | Line | |
---|
[b5d87e0] | 1 | import sys |
---|
| 2 | |
---|
| 3 | from ow.tasks.manager import TasksManager |
---|
| 4 | from ow.tasks.mail import queue_processor |
---|
| 5 | |
---|
| 6 | |
---|
| 7 | def command_line(): |
---|
| 8 | tasks_manager = TasksManager() |
---|
| 9 | |
---|
| 10 | # "register" the tasks |
---|
| 11 | tasks_manager.add_task('send_emails', queue_processor) |
---|
| 12 | |
---|
| 13 | if len(sys.argv) != 3: |
---|
| 14 | tasks_manager.usage(sys.argv[0]) |
---|
| 15 | sys.exit(1) |
---|
| 16 | |
---|
| 17 | script_name = sys.argv[0] |
---|
| 18 | ini_file = sys.argv[1] |
---|
| 19 | action = sys.argv[2] |
---|
| 20 | |
---|
| 21 | tasks_manager.run(script_name, ini_file, action) |
---|
| 22 | |
---|
| 23 | |
---|
| 24 | if __name__ == '__main__': |
---|
| 25 | command_line() # pragma no cover |
---|
Note: See
TracBrowser
for help on using the repository browser.