Skip to content

Commit

Permalink
async workers
Browse files Browse the repository at this point in the history
  • Loading branch information
divi255 committed Jul 14, 2019
1 parent 98a3a35 commit 09dfa22
Show file tree
Hide file tree
Showing 9 changed files with 271 additions and 130 deletions.
2 changes: 0 additions & 2 deletions TODO.todo
Original file line number Diff line number Diff line change
@@ -1,2 +0,0 @@
- [ ] start interval worker executor manually (keep interval)
- [ ] async executors
2 changes: 1 addition & 1 deletion atasker/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
__author__ = "Altertech Group, http://www.altertech.com/"
__copyright__ = "Copyright (C) 2018-2019 Altertech Group"
__license__ = "Apache License 2.0"
__version__ = "0.1.1"
__version__ = "0.1.2"

from atasker.supervisor import TaskSupervisor
from atasker.supervisor import TASK_LOW
Expand Down
2 changes: 1 addition & 1 deletion atasker/f.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
__author__ = "Altertech Group, http://www.altertech.com/"
__copyright__ = "Copyright (C) 2018-2019 Altertech Group"
__license__ = "Apache License 2.0"
__version__ = "0.1.1"
__version__ = "0.1.2"

import traceback
import threading
Expand Down
5 changes: 4 additions & 1 deletion atasker/supervisor.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
__author__ = "Altertech Group, http://www.altertech.com/"
__copyright__ = "Copyright (C) 2018-2019 Altertech Group"
__license__ = "Apache License 2.0"
__version__ = "0.1.1"
__version__ = "0.1.2"

import threading
import time
Expand Down Expand Up @@ -182,6 +182,9 @@ async def _main_loop(self):
if r == RQ_SCHEDULER:
logger.debug('Supervisor: new scheduler {}'.format(res))
scheduler_task = self.event_loop.create_task(res.loop())
if hasattr(res, 'extra_loops'):
for l in res.extra_loops:
self.event_loop.create_task(getattr(res, l)())
with self._lock:
self._schedulers[res] = (res, scheduler_task)
elif r == RQ_TASK:
Expand Down
2 changes: 1 addition & 1 deletion atasker/threads.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
__author__ = "Altertech Group, http://www.altertech.com/"
__copyright__ = "Copyright (C) 2018-2019 Altertech Group"
__license__ = "Apache License 2.0"
__version__ = "0.1.1"
__version__ = "0.1.2"

import threading
import time
Expand Down

0 comments on commit 09dfa22

Please sign in to comment.