Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
Commit-Analysis-ML
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Ahmad, Rawel
Commit-Analysis-ML
Commits
d875aaaa
Commit
d875aaaa
authored
1 year ago
by
Rawel
Browse files
Options
Downloads
Patches
Plain Diff
updated documentation with added edge case for sequential heuristic
parent
fd8cc884
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
Data/Heuristic/heuristic_parallel.py
+5
-1
5 additions, 1 deletion
Data/Heuristic/heuristic_parallel.py
Data/Heuristic/heuristic_sequential.py
+10
-0
10 additions, 0 deletions
Data/Heuristic/heuristic_sequential.py
with
15 additions
and
1 deletion
Data/Heuristic/heuristic_parallel.py
+
5
−
1
View file @
d875aaaa
...
...
@@ -10,6 +10,10 @@ selected_heuristic = "vuldigger2"
def
run_heuristic
(
mapping_chunk
):
"""
Runs the heuristic on a chunk of mappings
:param mapping_chunk: A list of mappings
"""
print
(
f
"
PID
{
os
.
getpid
()
}
Starting heuristic range
"
)
db_repo
=
DBRepository
()
config_codes
=
get_config_codes_list
()
...
...
@@ -64,7 +68,7 @@ def worker(queue_in):
def
calculate_chunk_size
(
mappings
,
num_cores
):
#
Use the same implementation as multiprocessing.Pool to calculate chunk size
"""
Use
s
the same implementation as multiprocessing.Pool to calculate chunk size
"""
chunk_size
,
extra
=
divmod
(
len
(
mappings
),
num_cores
*
4
)
if
extra
:
chunk_size
+=
1
...
...
This diff is collapsed.
Click to expand it.
Data/Heuristic/heuristic_sequential.py
+
10
−
0
View file @
d875aaaa
...
...
@@ -46,6 +46,16 @@ def main():
confidence
,
json
.
dumps
(
result_json
),
)
else
:
# If no VCCs are found, we still want to update the mapping to indicate that we have checked it
db_repo
.
update_vcc_fixing_commit
(
mapping
[
"
mapping_id
"
],
mapping
[
"
cve_id
"
],
mapping
[
"
vcc_sha
"
],
mapping
[
"
fixing_config_code
"
],
False
,
json
.
dumps
({})
)
def
init_heuristic
(
selected_heuristic
,
config_code
):
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment