-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Npath with DFS and multiprocessing #39
base: develop
Are you sure you want to change the base?
Conversation
Codecov Report
@@ Coverage Diff @@
## develop #39 +/- ##
===========================================
- Coverage 66.69% 64.75% -1.95%
===========================================
Files 20 20
Lines 2231 2301 +70
===========================================
+ Hits 1488 1490 +2
- Misses 743 811 +68
Continue to review full report at Codecov.
|
from enum import Enum | ||
from functools import partial | ||
from multiprocessing import Manager, Pool | ||
from multiprocessing import Manager, Pool, Lock # pylint: disable=unused-import |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove disable unused imports
lock: Callable[[], None], | ||
process_count: int) -> None: | ||
"""Handle the multiprocessing of metrics.""" | ||
print(f"Starting thread {process_count}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pass in the logger
"""Compute all of the metrics for some set of graphs using parallelization.""" | ||
pool = Pool(8) | ||
pool_size = 8 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
define in constructor (for now) & use in do_import as well
lock) | ||
args = list(range(pool_size)) | ||
|
||
result = pool.map(func_to_execute, args, chunksize=1) # pylint: disable=unused-variable |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
don't think we need this var
start_time = time.time() | ||
self.do_metrics_multithreaded(graphs) | ||
elapsed = time.time() - start_time | ||
print(f"TIME ELAPSED: {elapsed}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
log
@@ -77,6 +77,7 @@ def export_metrics(self, name: str, new_name: str) -> None: | |||
"cyclo": [], "npath": []}) | |||
for m_name in self.metrics: | |||
metric_value = self.metrics[m_name] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
itemgetter(0)
No description provided.