-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathschedular.py
26 lines (21 loc) · 919 Bytes
/
schedular.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
import multiprocessing
import subprocess
import os
import threading
maxThreads = 5
def runCommand(parameter):
"""Gets jobs to be run from the Jobs Folder and adds them
to the jobs list.
"""
#moduleList = os.listdir(os.getcwd() + "/modules/")
for root, moduleNames, fileNames in os.walk('./modules/'):
for moduleName in moduleNames:
#import each module in the module directory
exec("import " + "modules." + moduleName + "." + moduleName + " as runModule")
#run the moduleMain function in each module.
#moduleMain always returns a list object with the following keys
# - status (boolean True or False)
# - message (string a short message that describes the result)
result = runModule.moduleMain(parameter).start()
print threading.activeCount()
print result['message']