Skip to content

Commit

Permalink
Logmatch : Resolve matching with n_workers greater than 1
Browse files Browse the repository at this point in the history
When logmatch is tested with n_workers greater than 1,
the error is outputed that xrange is depracated and chunk_size
being float type.
Commit resolves the data type issue and also changes xrange to
range
  • Loading branch information
rustamtemirov committed Nov 29, 2023
1 parent 4953a44 commit 825e7a7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions logparser/logmatch/regexmatch.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def match_event(self, event_list):
results = match_fn(event_list, self.template_match_dict, self.optimized)
else:
pool = mp.Pool(processes=self.n_workers)
chunk_size = len(event_list) / self.n_workers + 1
chunk_size = len(event_list) // self.n_workers + 1
result_chunks = [
pool.apply_async(
match_fn,
Expand All @@ -86,7 +86,7 @@ def match_event(self, event_list):
self.optimized,
),
)
for i in xrange(0, len(event_list), chunk_size)
for i in range(0, len(event_list), chunk_size)
]
pool.close()
pool.join()
Expand Down

0 comments on commit 825e7a7

Please sign in to comment.