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

cmpatible to centos #27

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion clone-detector/backup-gtpm.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
#!/bin/bash
#
#
scriptPATH=`realpath $0`
# scriptPATH=`realpath $0`
scriptPATH="pwd"
rootPATH=`dirname $scriptPATH`
echo "backing up gtpm indexes..."
rm -rf $rootPATH/backup_gtpm
Expand Down
3 changes: 2 additions & 1 deletion clone-detector/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ def execute(self):
command = self.full_script_path('execute.sh', "1")
command_params = command.split()
returncode = self.run_command(
command_params, self.full_file_path("Log_execute_1.out"), self.full_file_path("Log_execute_1.err"))
command_params, self.full_file_path("Log_execute_1.out"),
self.full_file_path("Log_execute_1.err"))
self.current_state += 1
if returncode == ScriptController.EXIT_SUCCESS:
self.flush_state()
Expand Down
3 changes: 2 additions & 1 deletion clone-detector/execute.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/bin/bash
scriptPATH=`realpath $0`
# scriptPATH=`realpath $0`
scriptPATH="pwd"
rootPATH=`dirname $scriptPATH`
echo $rootPATH
rm -rf $rootPATH/NODE*
Expand Down
3 changes: 2 additions & 1 deletion clone-detector/move-index.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
#
# Run this script after indexing with just 1 node
#
scriptPATH=`realpath $0`
# scriptPATH=`realpath $0`
scriptPATH="pwd"
rootPATH=`dirname $scriptPATH`
echo "Installing indexes..."

Expand Down
3 changes: 2 additions & 1 deletion clone-detector/preparequery.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/bin/bash
num_nodes="${1:-0}"
scriptPATH=`realpath $0`
# scriptPATH=`realpath $0`
scriptPATH="pwd"
rootPATH=`dirname $scriptPATH`
echo "rootpath is : $rootPATH"
for i in $(seq 1 1 $num_nodes)
Expand Down
3 changes: 2 additions & 1 deletion clone-detector/replacenodeprefix.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/bin/bash
scriptPATH=`realpath $0`
# scriptPATH=`realpath $0`
scriptPATH="pwd"
rootPATH=`dirname $scriptPATH`
num_nodes="${1:-0}"
src_text="NODE_PREFIX=NODE"
Expand Down
3 changes: 2 additions & 1 deletion clone-detector/restore-gtpm.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
#!/bin/bash
#
#
scriptPATH=`realpath $0`
# scriptPATH=`realpath $0`
scriptPATH="pwd"
rootPATH=`dirname $scriptPATH`
echo "restoring gtpm indexes..."
if [ -d "$rootPATH/gtpmindex" ]; then
Expand Down
44 changes: 44 additions & 0 deletions clone-detector/results.pairs
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
1,13,1,6
1,15,1,14
1,25,1,10
1,19,1,17
1,24,1,8
1,24,1,21
1,20,1,17
1,20,1,19
1,26,1,25
1,22,1,17
1,28,1,8
1,28,1,24
1,28,1,21
1,28,1,27
1,22,1,19
1,26,1,10
1,22,1,20
1,27,1,8
1,23,1,17
1,27,1,21
1,27,1,24
1,29,1,8
1,29,1,27
1,23,1,20
1,23,1,22
1,29,1,21
1,29,1,24
1,29,1,28
1,23,1,19
1,21,1,8
1,33,1,15
1,35,1,17
1,33,1,14
1,35,1,19
1,35,1,23
1,35,1,20
1,35,1,22
1,54,1,52
1,54,1,50
1,52,1,50
1,57,1,56
4,131,4,124
4,163,4,158
4,178,4,177
3 changes: 2 additions & 1 deletion clone-detector/runnodes.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/bin/bash
# run this script on master
scriptPATH=`realpath $0`
# scriptPATH=`realpath $0`
scriptPATH="pwd"
rootPATH=`dirname $scriptPATH`
echo $rootPATH
ant -buildfile $rootPATH/build.xml clean cdi
Expand Down
1 change: 1 addition & 0 deletions clone-detector/search_metadata.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2
3 changes: 2 additions & 1 deletion clone-detector/search_status.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/bin/bash
scriptPATH=`realpath $0`
# scriptPATH=`realpath $0`
scriptPATH="pwd"
rootPATH=`dirname $scriptPATH`
num=`cat search_metadata.txt`

Expand Down
2 changes: 1 addition & 1 deletion clone-detector/sourcerer-cc.properties
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ IS_STATUS_REPORTER_ON=true
LOG_PROCESSED_LINENUMBER_AFTER_X_LINES=50
# Ignore all files outside these bounds
MIN_TOKENS=65
MAX_TOKENS=500000
MAX_TOKENS=50000

# Sharding speeds up search for very large datasets (>200K files).
# For small-ish datasets, it doesn't matter so much
Expand Down
3 changes: 2 additions & 1 deletion clone-detector/splitquery.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
#lines_per_part = int(total_lines + $N - 1) / $N

# Configuration stuff
scriptPATH=`realpath $0`
# scriptPATH=`realpath $0`
scriptPATH="pwd"
rootPATH=`dirname $scriptPATH`
echo "inside splitquery "
queryfile="$rootPATH/input/dataset/blocks.file"
Expand Down
20 changes: 10 additions & 10 deletions clone-detector/unevensplit.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ def split(self):
"""
count=0
line_limit = self.base_x
print "line_limit is ", line_limit
print ("line_limit is ", line_limit)
file_count=1
try:
print "creating split ",file_count
print("creating split ",file_count)
self.outfile = open("query_{part}.file".format(part=file_count),'w')
with open(self.input_filename,'r') as inputfile:
for row in inputfile:
Expand All @@ -42,29 +42,29 @@ def split(self):
file_count+=1
count =0
line_limit =line_limit + math.ceil(0.5*self.base_x)
print "line_limit is ", line_limit
print "creating split ",file_count
print ("line_limit is ", line_limit)
print ("creating split ",file_count)
self.outfile = open("query_{part}.file".format(part=file_count),'w')
self.outfile.write(row)
count+=1
self.outfile.flush()
self.outfile.close()
except IOError, e:
print "Error: {error}".format(error=e)
except IOError as e:
print ("Error: {error}".format(error=e))
sys.exit(1)


def get_num_lines_in_input_file(self):
with open(self.input_filename) as f:
for i, l in enumerate(f):
pass
print "total lines in the inputfile: {0} ".format(i+1)
print ("total lines in the inputfile: {0} ".format(i+1))
return i + 1

def find_base_x(self):
# formula for S = x + x+.5x + x+2*.5x...x + (N-1)*.5x
self.base_x= math.ceil(float(2*self.total_lines)/(float((self.split_count+1)*(self.split_count+2)/2) - 1))
print "base_x is ", self.base_x
print ("base_x is ", self.base_x)

if __name__ == '__main__':

Expand All @@ -73,7 +73,7 @@ def find_base_x(self):
split_count = int(sys.argv[2])
params= {'split_count':split_count,
'input_filename' : input_file}
print "spliting {inputfile} in {count} chunks".format(inputfile=input_file,count=split_count)
print ("spliting {inputfile} in {count} chunks".format(inputfile=input_file,count=split_count))
splitter = Spliter(params)
splitter.split()
print "splitting done!"
print ("splitting done!")