Skip to content

Commit 3ed1dda

Browse files
committed
add changes, release steps; try to get indexTaxis.py working from an install
1 parent 7ad1a6a commit 3ed1dda

File tree

4 files changed

+54
-22
lines changed

4 files changed

+54
-22
lines changed

CHANGES.txt

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
0.1.1
2+
get scripts/indexTaxis.py working from an installation
3+
4+
0.1.0 on 8/1/2016
5+
first (binary) release

RELEASE.txt

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
2+
make sure tests pass
3+
4+
./build.py package -version x.y.z
5+
6+
install it, confirm scripts/indexTaxis.py works
7+
8+
after:
9+
- bump version constants in indexTaxis.py and build.py

build.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
]
2828

2929
LUCENE_VERSION = '6.2.0-SNAPSHOT'
30-
LUCENE_SERVER_BASE_VERSION = '0.1.0'
30+
LUCENE_SERVER_BASE_VERSION = '0.1.1'
3131
LUCENE_SERVER_VERSION = '%s-SNAPSHOT' % LUCENE_SERVER_BASE_VERSION
3232

3333
luceneDeps = ('core',
@@ -457,6 +457,7 @@ def main():
457457
if os.path.exists(libDir):
458458
for name in os.listdir(libDir):
459459
z.write('%s/%s' % (libDir, name), '%s/lib/%s' % (rootDirName, name))
460+
z.write('scripts/indexTaxis.py', '%s/scripts/indexTaxis.py' % rootDirName)
460461

461462
print('\nWrote %s (%.1f MB)\n' % (destFileName, os.path.getsize(destFileName)/1024./1024.))
462463

scripts/indexTaxis.py

+38-21
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,18 @@
1212
import getpass
1313
import urllib.request
1414

15+
LUCENE_SERVER_BASE_VERSION = '0.1.1'
16+
1517
# killall java; ssh 10.17.4.12 killall java; rm -rf /c/taxis; ssh 10.17.4.12 "rm -rf /l/taxis"; python3 -u scripts/indexTaxis.py -rebuild -ip 10.17.4.92 -installPath /c/taxis -replica 10.17.4.12:/l/taxis
1618

1719
# TODO
1820
# - index lat/lon as geopoint!
1921

2022
LOCALHOST = '127.0.0.1'
2123

24+
IS_INSTALLED = os.path.exists('lib/luceneserver-%s.jar' % LUCENE_SERVER_BASE_VERSION) or \
25+
os.path.exists('lib/luceneserver-%s-SNAPSHOT.jar' % LUCENE_SERVER_BASE_VERSION)
26+
2227
DEFAULT_PORT = 4000
2328

2429
PACKAGE_FILE = os.path.abspath('build/luceneserver-0.1.0-SNAPSHOT.zip')
@@ -45,24 +50,29 @@ def close(self):
4550
self.socket.close()
4651

4752
def launchServer(host, installDir, port, ip=None):
48-
zipFileName = os.path.split(PACKAGE_FILE)[1]
4953

50-
# copy install bits over
51-
if host != LOCALHOST:
52-
run('scp %s %s@%s:/tmp' % (PACKAGE_FILE, USER_NAME, host))
53-
# unzip it
54-
run('ssh %s@%s "mkdir -p %s; cd %s; unzip /tmp/%s"' % (USER_NAME, host, installDir, installDir, zipFileName))
54+
if IS_INSTALLED:
55+
cwd = '.'
5556
else:
56-
os.makedirs(installDir)
57-
run('cd %s; unzip %s' % (installDir, PACKAGE_FILE))
5857

59-
serverDirName = zipFileName[:-4]
58+
zipFileName = os.path.split(PACKAGE_FILE)[1]
59+
# copy install bits over
60+
if host != LOCALHOST:
61+
run('scp %s %s@%s:/tmp' % (PACKAGE_FILE, USER_NAME, host))
62+
# unzip it
63+
run('ssh %s@%s "mkdir -p %s; cd %s; unzip /tmp/%s"' % (USER_NAME, host, installDir, installDir, zipFileName))
64+
else:
65+
os.makedirs(installDir)
66+
run('cd %s; unzip %s' % (installDir, PACKAGE_FILE))
67+
68+
serverDirName = zipFileName[:-4]
69+
cwd = '%s/%s' % (installDir, serverDirName)
6070

6171
if host != LOCALHOST:
62-
command = r'ssh %s@%s "cd %s/%s; java -Xms4g -Xmx4g -cp lib/\* org.apache.lucene.server.Server -stateDir %s/state -ipPort %s:%s"' % (USER_NAME, host, installDir, serverDirName, installDir, host, port)
72+
command = r'ssh %s@%s "cd %s; java -Xms4g -Xmx4g -cp lib/\* org.apache.lucene.server.Server -stateDir %s/state -ipPort %s:%s"' % (USER_NAME, host, cwd, installDir, host, port)
6373
else:
64-
#command = r'cd %s/%s; java -XX:MaxInlineSize=0 -agentlib:yjpagent=sampling -Xms4g -Xmx4g -cp lib/\* org.apache.lucene.server.Server -stateDir %s/state -ipPort %s:%s' % (installDir, serverDirName, installDir, host, port)
65-
command = r'cd %s/%s; java -Xms4g -Xmx4g -cp lib/\* org.apache.lucene.server.Server -stateDir %s/state -ipPort %s:%s' % (installDir, serverDirName, installDir, host, port)
74+
#command = r'cd %s; java -XX:MaxInlineSize=0 -agentlib:yjpagent=sampling -Xms4g -Xmx4g -cp lib/\* org.apache.lucene.server.Server -stateDir %s/state -ipPort %s:%s' % (cwd, installDir, host, port)
75+
command = r'cd %s; java -Xms4g -Xmx4g -cp lib/\* org.apache.lucene.server.Server -stateDir %s/state -ipPort %s:%s' % (cwd, installDir, host, port)
6676

6777
if ip is not None:
6878
command += ' -ipPort %s:%s' % (ip, port)
@@ -147,27 +157,35 @@ def getFlag(option):
147157

148158
def main():
149159

150-
if not os.path.exists('src/java/org/apache/lucene/server/Server.java'):
151-
print('\nERROR: please run this from the luceneserver working directory\n')
160+
if not os.path.exists('src/java/org/apache/lucene/server/Server.java') and not IS_INSTALLED:
161+
print('\nERROR: please run this from the luceneserver working directory (git clone) or an installation\n')
152162
sys.exit(1)
153163

154-
if getFlag('-rebuild') or not os.path.exists('build/luceneserver-0.1.0-SNAPSHOT.zip'):
164+
if IS_INSTALLED:
165+
if getFlag('-rebuild'):
166+
raise RuntimeError('cannot rebuild from a binary installation')
167+
primaryInstallPath = '.'
168+
elif getFlag('-rebuild') or not os.path.exists('build/luceneserver-%s-SNAPSHOT.zip' % LUCENE_SERVER_BASE_VERSION):
155169
print('Building server release artifact...')
156170
run('python3 -u build.py package')
157171

158-
primaryInstallPath = getArg('-installPath')
159-
if primaryInstallPath is None:
160-
primaryInstallPath = os.path.abspath('install')
172+
primaryInstallPath = getArg('-installPath')
173+
if primaryInstallPath is None:
174+
primaryInstallPath = os.path.abspath('install')
175+
176+
if os.path.exists(primaryInstallPath):
177+
raise RuntimeError('primary install path %s already exists; please remove it and rerun' % primaryInstallPath)
161178

162-
if os.path.exists(primaryInstallPath):
163-
raise RuntimeError('primary install path %s already exists; please remove it and rerun' % primaryInstallPath)
179+
os.makedirs(primaryInstallPath)
164180

165181
replicas = []
166182
primaryIP = getArg('-ip')
167183

168184
while True:
169185
s = getArg('-replica')
170186
if s is not None:
187+
if IS_INSTALLED:
188+
raise RuntimeError('-replica does not yet work when installed; try running from a git clone instead')
171189
if primaryIP is None:
172190
raise RuntimeError('you must specify -ip if there are any -replica')
173191
tup = s.split(':')
@@ -185,7 +203,6 @@ def main():
185203
if 'no such file or directory' not in s.lower():
186204
raise RuntimeError('path %s on replica %s already exists; please remove it and rerun' % (installPath, host))
187205

188-
os.makedirs(primaryInstallPath)
189206
for host, port, path in replicas:
190207
print('mkdir %s on %s' % (path, host))
191208
run('ssh %s@%s mkdir -p %s' % (USER_NAME, host, path))

0 commit comments

Comments
 (0)