Skip to content

Commit d33f2c0

Browse files
GregBestlandbjmb
authored andcommitted
Added simple Server object to start and stop scassandra
1 parent 3e125bf commit d33f2c0

1 file changed

Lines changed: 29 additions & 0 deletions

File tree

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Copyright 2013-2016 DataStax, Inc.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License
14+
15+
import subprocess
16+
17+
18+
class ScassandraServer(object):
19+
20+
def __init__(self, jar_path, binary_port=8042, admin_port=8043):
21+
self.binary_port = binary_port
22+
self.admin_port = admin_port
23+
self.jar_path = jar_path
24+
25+
def start(self):
26+
self.proc = subprocess.Popen(['java', '-jar', '-Dscassandra.binary.port={0}'.format(self.binary_port), '-Dscassandra.admin.port={0}'.format(self.admin_port), '-Dscassandra.log.level=INFO', self.jar_path], shell=False)
27+
28+
def stop(self):
29+
self.proc.terminate()

0 commit comments

Comments
 (0)