Skip to content
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

Open
wants to merge 10 commits into
base: develop
Choose a base branch
from
Open

Npath with DFS and multiprocessing #39

wants to merge 10 commits into from

Conversation

JoshCordova
Copy link
Contributor

No description provided.

@codecov-commenter
Copy link

codecov-commenter commented May 22, 2021

Codecov Report

Merging #39 (4c95c77) into develop (40f00b6) will decrease coverage by 1.94%.
The diff coverage is 15.09%.

Impacted file tree graph

@@             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     
Impacted Files Coverage Δ
src/core/command_data.py 59.45% <0.00%> (-0.27%) ⬇️
src/metric/npath_complexity.py 63.10% <5.00%> (-36.90%) ⬇️
src/core/command.py 39.44% <9.90%> (-1.55%) ⬇️
src/graph/control_flow_graph.py 90.62% <68.75%> (-0.18%) ⬇️
src/graph/graph.py 77.95% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 40f00b6...4c95c77. Read the comment docs.

from enum import Enum
from functools import partial
from multiprocessing import Manager, Pool
from multiprocessing import Manager, Pool, Lock # pylint: disable=unused-import
Copy link
Contributor

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}")
Copy link
Contributor

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
Copy link
Contributor

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
Copy link
Contributor

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}")
Copy link
Contributor

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]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

itemgetter(0)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants