Skip to content

Commit

Permalink
fixes in info methods
Browse files Browse the repository at this point in the history
  • Loading branch information
divi255 committed Aug 23, 2019
1 parent 001157b commit 00f54be
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions atasker/supervisor.py
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ def stop_aloop(self, name, wait=True, cancel_tasks=False, _lock=True):
if _lock:
self._lock.release()

def get_info(self, tt=None):
def get_info(self, tt=None, aloops=True, schedulers=True):

class SupervisorInfo:
pass
Expand All @@ -353,14 +353,24 @@ class SupervisorInfo:
result.mp_tasks = list(self._active_mps)
result.mp_tasks_count = len(result.mp_tasks)
result.mp_queue = self._mp_queue.copy()
result.aloops = self.aloops.copy()
result.schedulers = self._schedulers
if aloops:
result.aloops = self.aloops.copy()
if schedulers:
result.schedulers = self._schedulers.copy()
result.task_info = {}
for n, v in self._task_info.items():
if tt is None or v.tt == tt:
result.task_info[n] = (v)
return result

def get_aloops(self):
with self._lock:
return self.aloops.copy()

def get_schedulers(self):
with self._lock:
return self._schedulers.copy()

async def _start_task(self,
tt,
task_id,
Expand Down

0 comments on commit 00f54be

Please sign in to comment.