-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathTaskManager.py
36 lines (29 loc) · 1.02 KB
/
TaskManager.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from config import gConfig
from DownloadThread import DownloadThread
class TaskManager(object):
def __init__(self):
self.__downloadThreads = [DownloadThread() for i in range(gConfig['downloadThreads'])]
for x in self.__downloadThreads:
x.setDaemon(True)
x.start()
# @log_it(('begin','end'), logging.INFO, logArgs=False, logReturnValue=False)
# def stopTask(self, taskOption):
# for x in self.__downloadThreads:
# x.stopTaskIfRight(taskOption)
# # @log_it(('begin','end'), logging.INFO, logArgs=False, logReturnValue=False)
# def stopAllTasks(self):
# for x in self.__downloadThreads:
# x.stopTaskIfRight(None, True)
def exit(self):
pass
gMan = TaskManager()
if __name__ == '__main__':
from datas import gData
gData.downloadQueue.put({
'url': 'http://douban.com',
'savename': 'test.html',
'savedir': '/home/revir/tmp'
})
gData.cleanAll()