Subversion Repositories SmartDukaan

Rev

Rev 14244 | Rev 14248 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 14244 Rev 14245
Line 1... Line 1...
1
import pysolr
1
import pysolr
2
import pymongo
2
import pymongo
3
import json
3
import json
4
import os
4
import os
5
import optparse
5
import optparse
-
 
6
import shutil
6
 
7
 
7
con=None
8
con=None
8
 
9
 
9
filePath = '/tmp/autosuggest.json'
10
filePath = '/tmp/autosuggest.json'
10
destFilePath = '/home/kshitij/'
11
destFilePath = '/home/kshitij/'
Line 69... Line 70...
69
        except OSError:
70
        except OSError:
70
            pass
71
            pass
71
    output = open(filePath, 'ab+')
72
    output = open(filePath, 'ab+')
72
    json.dump(autoSuggestList, output)
73
    json.dump(autoSuggestList, output)
73
    output.close()
74
    output.close()
74
    if options.host !='localhost':
75
    if options.mongoHost !='localhost':
75
        try:
76
        try:
76
            os.system("scp "+filePath +" root@dtr:"+destFilePath)
77
            os.system("scp "+filePath +" root@dtr:"+destFilePath)
77
        except:
78
        except:
78
            pass
79
            shutil.copy2(filePath, destFilePath)
79
    
80
    
80
    
81
    
81
 
82
 
82
def get_mongo_connection(host='localhost', port=27017):
83
def get_mongo_connection(host='localhost', port=27017):
83
    global con
84
    global con