53 @rtype (tuple of dict) |
53 @rtype (tuple of dict) |
54 """ |
54 """ |
55 return __cyclomaticComplexity(file, text) |
55 return __cyclomaticComplexity(file, text) |
56 |
56 |
57 |
57 |
58 def batchCyclomaticComplexity(argumentsList, send, fx, cancelled): |
58 def batchCyclomaticComplexity(argumentsList, send, fx, cancelled, |
|
59 maxProcesses=0): |
59 """ |
60 """ |
60 Module function to calculate the cyclomatic complexity for a batch of |
61 Module function to calculate the cyclomatic complexity for a batch of |
61 files. |
62 files. |
62 |
63 |
63 @param argumentsList list of arguments tuples as given for |
64 @param argumentsList list of arguments tuples as given for |
67 @type function |
68 @type function |
68 @param fx registered service name |
69 @param fx registered service name |
69 @type str |
70 @type str |
70 @param cancelled reference to function checking for a cancellation |
71 @param cancelled reference to function checking for a cancellation |
71 @type function |
72 @type function |
72 """ |
73 @param maxProcesses number of processes to be used |
73 try: |
74 @type int |
74 NumberOfProcesses = multiprocessing.cpu_count() |
75 """ |
75 if NumberOfProcesses >= 1: |
76 if maxProcesses == 0: |
76 NumberOfProcesses -= 1 |
77 # determine based on CPU count |
77 except NotImplementedError: |
78 try: |
78 NumberOfProcesses = 1 |
79 NumberOfProcesses = multiprocessing.cpu_count() |
|
80 if NumberOfProcesses >= 1: |
|
81 NumberOfProcesses -= 1 |
|
82 except NotImplementedError: |
|
83 NumberOfProcesses = 1 |
|
84 else: |
|
85 NumberOfProcesses = maxProcesses |
79 |
86 |
80 # Create queues |
87 # Create queues |
81 taskQueue = multiprocessing.Queue() |
88 taskQueue = multiprocessing.Queue() |
82 doneQueue = multiprocessing.Queue() |
89 doneQueue = multiprocessing.Queue() |
83 |
90 |