instruction stringclasses 14
values | output stringlengths 105 12.9k | input stringlengths 0 4.12k |
|---|---|---|
generate doc string for following function: | def install(self, build_url):
"""
Installs Couchbase server on Unix machine
:param build_url: build url to get the Couchbase package from
:return: True on successful installation else False
"""
cmd = self.cmds["install"]
if self.shell.nonroot:
cmd = se... | def install(self, build_url):
cmd = self.cmds["install"]
if self.shell.nonroot:
cmd = self.non_root_cmds["install"]
f_name = build_url.split("/")[-1]
cmd = cmd.replace("buildpath", "{}/{}"
.format(self.download_dir, f_name))
self.she... |
generate python code for the following |
def is_couchbase_installed(self):
"""
Check if Couchbase is installed on the remote server.
This checks if the couchbase is installed in default or non default path.
:return: True if Couchbase is installed on the remote server else False
"""
if self.nonroot:
... | Check if Couchbase is installed on the remote server.
This checks if the couchbase is installed in default or non default path.
|
generate doc string for following function: | def delete_info_for_server(server, ipaddr=None):
"""
Delete the info associated with the given server or ipaddr
:param server: server to delete the info for
:param ipaddr: ipaddr to delete the info for
:return: None
"""
ipaddr = ipaddr or server.ip
if ipa... | def delete_info_for_server(server, ipaddr=None):
ipaddr = ipaddr or server.ip
if ipaddr in RemoteMachineShellConnection.__info_dict:
del RemoteMachineShellConnection.__info_dict[ipaddr]
RemoteMachineShellConnection.__info_dict.pop(ipaddr, None) |
give python code to |
def pause_memcached(self, timesleep=30, delay=0):
"""
Pauses the memcached process on remote server
Override method for Windows
:param timesleep: time to wait after pause (in seconds)
:param delay: time to delay pause of memcached process (in seconds)
:return: None
... | Pauses the memcached process on remote server
Override method for Windows
|
generate comment for above | def stop_server(self):
"""
Stops the Couchbase server on the remote server.
The method stops the server from non-default location if it's run as nonroot user. Else from default location.
:param os:
:return: None
"""
o, r = self.execute_command("net stop couchbases... | def stop_server(self):
o, r = self.execute_command("net stop couchbaseserver")
self.log_command_output(o, r) |
generate comment: | def disable_file_size_limit(self):
"""
Change the file size limit to unlimited for indexer process
:return: None
"""
o, r = self.execute_command("prlimit --fsize=unlimited --pid $(pgrep indexer)")
self.log_command_output(o, r) | def disable_file_size_limit(self):
o, r = self.execute_command("prlimit --fsize=unlimited --pid $(pgrep indexer)")
self.log_command_output(o, r) |
Code the following: |
def mount_partition_ext4(self, location):
"""
Mount a partition at the location specified
:param location: Mount location
:return: Output and error message from the mount command
"""
command = "mount -o loop,rw,usrquota,grpquota /usr/disk-img/disk-quota.ext4 {0}; df -Th... | Mount a partition at the location specified
|
generate python code for | import os
import uuid
from subprocess import Popen
from shell_util.remote_machine import RemoteMachineInfo
def extract_remote_info(self):
"""
Extract the remote information about the remote server.
This method is used to extract the following information of the remote server:\n
- type o... | Extract the remote information about the remote server.
This method is used to extract the following information of the remote server:
- type of OS distribution (Linux, Windows, macOS)
- ip address
- OS distribution type
- OS architecture
- OS distribution version
- extension of the packages (.deb, .rpm, .exe etc)
- t... |
give a code to |
def cluster_ip(self):
"""
Returns the ip address of the server. Returns internal ip is available, else the ip address.
:return: ip address of the server
"""
return self.internal_ip or self.ip | Returns the ip address of the server. Returns internal ip is available, else the ip address.
|
generate python code for the above |
def connect_with_user(self, user="root"):
"""
Connect to the remote server with given user
Override method since this is not required for Unix
:param user: user to connect to remote server with
:return: None
"""
return | Connect to the remote server with given user
Override method since this is not required for Unix
|
generate comment for above | def remove_directory(self, remote_path):
"""
Remove the directory specified from system.
:param remote_path: Directory path to remove.
:return: True if the directory was removed else False
"""
if self.remote:
sftp = self._ssh_client.open_sftp()
try... | def remove_directory(self, remote_path):
if self.remote:
sftp = self._ssh_client.open_sftp()
try:
log.info("removing {0} directory...".format(remote_path))
sftp.rmdir(remote_path)
except IOError:
return False
... |
generate comment: | def execute_cbcollect_info(self, file, options=""):
"""
Execute cbcollect command on remote server
:param file: file name to store the cbcollect as
:param options: options for the cbcollect command
:return: output of the cbcollect command
"""
cbcollect_command = "... | def execute_cbcollect_info(self, file, options=""):
cbcollect_command = "%scbcollect_info" % (LINUX_COUCHBASE_BIN_PATH)
if self.nonroot:
cbcollect_command = "%scbcollect_info" % (LINUX_NONROOT_CB_BIN_PATH)
self.extract_remote_info()
if self.info.type.lower() == 'wind... |
generate comment: | def stop_couchbase(self, num_retries=5, poll_interval=10):
"""
Stop couchbase service on remote server
:param num_retries: None
:param poll_interval: None
:return: None
"""
if self.nonroot:
log.info("Stop Couchbase Server with non root method")
... | def stop_couchbase(self, num_retries=5, poll_interval=10):
if self.nonroot:
log.info("Stop Couchbase Server with non root method")
o, r = self.execute_command(
'%s%scouchbase-server -k' % (self.nr_home_path,
LINUX_COUC... |
generate code for the above: |
def __check_if_cb_service_stopped(self, service_name=None):
"""
Check if a couchbase service is stopped
:param service_name: service name to check
:return: True if service is stopped else False
"""
if service_name:
o, r = self.execute_command('sc query {0}'.... | Check if a couchbase service is stopped
|
give a code to | from shell_util.remote_machine import RemoteMachineProcess
def is_process_running(self, process_name):
"""
Check if a process is running currently
Override method for Windows
:param process_name: name of the process to check
:return: True if process is running else False
... | Check if a process is running currently
Override method for Windows
|
generate code for the following |
def param(self, name, *args):
"""
Returns the paramater or a default value
:param name: name of the property
:param args: default value for the property. If no default value is given, an exception is raised
:return: the value of the property
:raises Exception: if the de... | Returns the paramater or a default value
|
give python code to |
def __init__(self):
"""
Creates an instance of TestInput class. This object is used to take input params
for install scripts.
"""
self.servers = list()
self.clusters = dict()
self.test_params = dict()
self.elastic = list()
self.cbbackupmgr = dict... | Creates an instance of TestInput class. This object is used to take input params
for install scripts. |
give a code to |
def execute_commands_inside(self, main_command, query, queries,
bucket1, password, bucket2, source,
subcommands=[], min_output_size=0,
end_msg='', timeout=250):
"""
Override method to handle windows specifi... | Override method to handle windows specific file name |
generate comment: | def terminate_processes(self, info, p_list):
"""
Terminate a list of processes on remote server
Override for Unix systems
:param info: None
:param p_list: List of processes to terminate
:return: None
"""
raise NotImplementedError | def terminate_processes(self, info, p_list):
raise NotImplementedError |
generate comment for above | def get_instances(cls):
"""
Returns a list of instances of the class
:return: generator that yields instances of the class
"""
for ins in cls.__refs__:
yield ins | def get_instances(cls):
for ins in cls.__refs__:
yield ins |
generate comment: | def get_os(info):
"""
Gets os name from info
:param info: server info dictionary to get the data from
:return: os name
"""
os = info.distribution_version.lower()
to_be_replaced = ['\n', ' ', 'gnu/linux']
for _ in to_be_replaced:
if _ in os:
... | def get_os(info):
os = info.distribution_version.lower()
to_be_replaced = ['\n', ' ', 'gnu/linux']
for _ in to_be_replaced:
if _ in os:
os = os.replace(_, '')
if info.deliverable_type == "dmg":
major_version = os.split('.')
os ... |
def main(logger):
"""
Main function of the installation script.
:param logger: logger object to use
:return: status code for the installation process
"""
helper = InstallHelper(logger)
args = helper.parse_command_line_args(sys.argv[1:])
logger.setLevel(args.log_level.upper())
user_in... | def main(logger):
helper = InstallHelper(logger)
args = helper.parse_command_line_args(sys.argv[1:])
logger.setLevel(args.log_level.upper())
user_input = TestInputParser.get_test_input(args)
for server in user_input.servers:
server.install_status = "not_started"
logger.info("Node ... | |
def download_build(self, node_installer, build_url,
non_root_installer=False):
"""
Download the Couchbase build on the remote server
:param node_installer: node installer object
:param build_url: build url to download the Couchbase build from.
:param non_... | Download the Couchbase build on the remote server
| |
generate code for the following |
def create_multiple_dir(self, dir_paths):
"""
This function will remove the automation directory in windows and create directory in the path specified
in dir_paths
:param dir_paths: list of paths to create the directories
:return: None
"""
sftp = self._ssh_clien... | This function will remove the automation directory in windows and create directory in the path specified
in dir_paths
|
generate doc string for following function: | def unpause_memcached(self, os="linux"):
"""
Unpauses the memcached process on remote server
:param os: os type of remote server
:return: None
"""
log.info("*** unpause memcached process ***")
if self.nonroot:
o, r = self.execute_command("killall -SIGC... | def unpause_memcached(self, os="linux"):
log.info("*** unpause memcached process ***")
if self.nonroot:
o, r = self.execute_command("killall -SIGCONT memcached.bin")
else:
o, r = self.execute_command("killall -SIGCONT memcached")
self.log_command_output(o... |
generate doc string for following function: | def start_indexer(self):
"""
Start indexer process on remote server
:return: None
"""
o, r = self.execute_command("kill -SIGCONT $(pgrep indexer)")
self.log_command_output(o, r) | def start_indexer(self):
o, r = self.execute_command("kill -SIGCONT $(pgrep indexer)")
self.log_command_output(o, r) |
generate comment for following function: | def populate_build_url(self):
"""
Populates the build url variable.
:return: None
"""
self.node_install_info.build_url = self.__construct_build_url()
self.log.info("{} - Build url :: {}"
.format(self.node_install_info.server.ip,
... | def populate_build_url(self):
self.node_install_info.build_url = self.__construct_build_url()
self.log.info("{} - Build url :: {}"
.format(self.node_install_info.server.ip,
self.node_install_info.build_url)) |
Code the following: |
def init_cluster(self, node):
"""
Initializes Couchbase cluster
Override method for Unix
:param node: server object
:return: True on success
"""
return True | Initializes Couchbase cluster
Override method for Unix
|
generate code for the following |
def enable_diag_eval_on_non_local_hosts(self, state=True):
"""
Enable diag/eval to be run on non-local hosts.
:param state: enable diag/eval on non-local hosts if True
:return: Command output and error if any.
"""
rest_username = self.server.rest_username
rest_p... | Enable diag/eval to be run on non-local hosts.
|
generate python code for the following |
def start_indexer(self):
"""
Start indexer process on remote server
:return: None
"""
o, r = self.execute_command("kill -SIGCONT $(pgrep indexer)")
self.log_command_output(o, r) | Start indexer process on remote server
|
generate code for the above: |
def change_port_static(self, new_port):
"""
Change Couchbase ports for rest, mccouch, memcached, capi to new port
:param new_port: new port to change the ports to
:return: None
"""
# ADD NON_ROOT user config_details
log.info("=========CHANGE PORTS for REST: %s, ... | Change Couchbase ports for rest, mccouch, memcached, capi to new port
|
generate comment for following function: | def get_windows_system_info(self):
"""
Get system information about a Windows server
:return: Windows info about the server
"""
try:
info = {}
o, _ = self.execute_batch_command('systeminfo')
for line in o:
line_list = line.split... | def get_windows_system_info(self):
try:
info = {}
o, _ = self.execute_batch_command('systeminfo')
for line in o:
line_list = line.split(':')
if len(line_list) > 2:
if line_list[0] == 'Virtual Memory':
... |
generate python code for the above |
def start_memcached(self):
"""
Start memcached process on remote server
:return: None
"""
o, r = self.execute_command("kill -SIGCONT $(pgrep memcached)")
self.log_command_output(o, r, debug=False) | Start memcached process on remote server
|
Code the following: | from time import sleep
def sleep(seconds, msg=""):
"""
Sleep for specified number of seconds. Optionally log a message given
:param seconds: number of seconds to sleep for
:param msg: optional message to log
:return: None
"""
if msg:
log.info(msg)
... | Sleep for specified number of seconds. Optionally log a message given
|
generate code for the following | import urllib.request
def download_build_locally(self, build_url):
"""
Downloads the Couchbase build locally
:param build_url: Download url to download the build from
:return: tuple containing the path to the download build file as well as the resulting HTTPMessage object.
"""
... | Downloads the Couchbase build locally
|
generate python code for |
def start_memcached(self):
"""
Start memcached process on remote server
:return: None
"""
o, r = self.execute_command("taskkill /F /T /IM memcached")
self.log_command_output(o, r, debug=False) | Start memcached process on remote server
|
give a code to |
def is_couchbase_running(self):
"""
Checks if couchbase is currently running on the remote server
:return: True if couchbase is running else False
"""
o = self.is_process_running('beam.smp')
if o is not None:
return True
return False | Checks if couchbase is currently running on the remote server
|
give python code to |
def stop_couchbase(self, num_retries=5, poll_interval=10):
"""
Stop couchbase service on remote server
:param num_retries: Number of times to retry stopping couchbase
:param poll_interval: interval between each retry attempt
:return: None
"""
o, r = self.execute... | Stop couchbase service on remote server
|
generate comment. | def init_cluster(self, node):
"""
Initializes Couchbase cluster
Override method for Unix
:param node: server object
:return: True on success
"""
return True | def init_cluster(self, node):
return True |
generate comment. | def set_environment_variable(self, name, value):
"""
Request an interactive shell session, export custom variable and
restart Couchbase server.
Shell session is necessary because basic SSH client is stateless.
:param name: environment variable
:param value: environment v... | def set_environment_variable(self, name, value):
shell = self._ssh_client.invoke_shell()
shell.send('net stop CouchbaseServer\n')
shell.send('set {0}={1}\n'.format(name, value))
shell.send('net start CouchbaseServer\n')
shell.close() |
generate python code for the following |
def enable_network_delay(self):
"""
Changes network to send requests with a delay of 200 ms using traffic control
:return: None
"""
o, r = self.execute_command("tc qdisc add dev eth0 root netem delay 200ms")
self.log_command_output(o, r) | Changes network to send requests with a delay of 200 ms using traffic control
|
Code the following: |
def configure_log_location(self, new_log_location):
"""
Configure the log location for Couchbase server on remote server
:param new_log_location: path to new location to store logs
:return: None
"""
mv_logs = testconstants.LINUX_LOG_PATH + '/' + new_log_location
... | Configure the log location for Couchbase server on remote server
|
generate python code for the above |
def __init__(self, logger, node_install_info, steps):
"""
Creates an instance of the NodeInstaller object. This object is used to install Couchbase server builds
on remote servers.
:param logger: logger object for logging
:param node_install_info: node install info of type Node... | Creates an instance of the NodeInstaller object. This object is used to install Couchbase server builds
on remote servers.
|
generate python code for the following |
def __init__(self):
"""
Creates an instance of the TestInputMembaseSetting class
"""
self.rest_username = ''
self.rest_password = '' | Creates an instance of the TestInputMembaseSetting class |
generate comment. | def parse_command_line_args(arguments):
"""
Parses the command line arguments for installation
:param arguments: arguments to parse
:return: parsed arguments from ArgumentParser
"""
parser = ArgumentParser(description="Installer for Couchbase-Server")
parser.add_a... | def parse_command_line_args(arguments):
parser = ArgumentParser(description="Installer for Couchbase-Server")
parser.add_argument("--install_tasks",
help="List of tasks to run '-' separated",
default="uninstall"
... |
generate code for the above: |
def kill_goxdcr(self):
"""
Kill XDCR process on remote server
:return: None
"""
o, r = self.execute_command("taskkill /F /T /IM goxdcr*")
self.log_command_output(o, r) | Kill XDCR process on remote server
|
generate comment for above | def get_cbbackupmgr_config(config, section):
"""
Get CB backup manager configuration
:param config: config
:param section: section to get configuration from
:return: dict of configuration options
"""
options = {}
for option in config.options(section):
... | def get_cbbackupmgr_config(config, section):
options = {}
for option in config.options(section):
options[option] = config.get(section, option)
return options |
generate code for the following | from shell_util.remote_machine import RemoteMachineProcess
def is_process_running(self, process_name):
"""
Check if a process is running currently
Override method for Windows
:param process_name: name of the process to check
:return: True if process is running else False
... | Check if a process is running currently
Override method for Windows
|
def __init__(self):
"""
Creates an instance of the TestInputServer class. This object holds the server information required for
installation, cli and rest api calls.
"""
self.ip = ''
self.internal_ip = ''
self.hostname = ''
self.ssh_username = ''
... | Creates an instance of the TestInputServer class. This object holds the server information required for
installation, cli and rest api calls. | |
generate doc string for following function: | def get_test_input(arguments):
"""
Parses the test input arguments to type TestInput object
:param arguments: arguments to parse
:return: TestInput object
"""
params = dict()
if arguments.params:
argument_split = [a.strip() for a in re.split("[,]?([^,=... | def get_test_input(arguments):
params = dict()
if arguments.params:
argument_split = [a.strip() for a in re.split("[,]?([^,=]+)=", arguments.params)[1:]]
pairs = dict(list(zip(argument_split[::2], argument_split[1::2])))
for pair in list(pairs.items()):
... |
generate python code for the following |
def unpause_beam(self):
"""
Unpauses the beam.smp process on remote server
:return:
"""
o, r = self.execute_command("killall -SIGCONT beam.smp")
self.log_command_output(o, r) | Unpauses the beam.smp process on remote server
|
generate doc string for following function: | def get_port_recvq(self, port):
"""
Given a port, extracts address:port of services listening on that port (only ipv4)
:param port: port to listen on
:return: list of addresses and ports of services listening
"""
command = "ss -4anpe | grep :%s | grep 'LISTEN' | awk -F ' ... | def get_port_recvq(self, port):
command = "ss -4anpe | grep :%s | grep 'LISTEN' | awk -F ' ' '{print $5}'" % port
o, r = self.execute_command(command)
self.log_command_output(o, r)
return o |
generate comment for following function: | def _recover_disk_full_failure(self, location):
"""
Recover the disk full failures on remote server
:param location: location of the disk to recover
:return: output and error message from recovering disk
"""
delete_file = "{0}/disk-quota.ext3".format(location)
out... | def _recover_disk_full_failure(self, location):
delete_file = "{0}/disk-quota.ext3".format(location)
output, error = self.execute_command("rm -f {0}".format(delete_file))
return output, error |
generate comment: | def __init__(self):
"""
Creates an instance of the TestInputMembaseSetting class
"""
self.rest_username = ''
self.rest_password = '' | def __init__(self):
self.rest_username = ''
self.rest_password = '' |
generate comment for following function: | def enable_network_delay(self):
"""
Changes network to send requests with a delay of 200 ms using traffic control
:return: None
"""
o, r = self.execute_command("tc qdisc add dev eth0 root netem delay 200ms")
self.log_command_output(o, r) | def enable_network_delay(self):
o, r = self.execute_command("tc qdisc add dev eth0 root netem delay 200ms")
self.log_command_output(o, r) |
generate comment for following function: | def get_memcache_pid(self):
"""
Get the pid of memcached process
:return: pid of memcached process
"""
output, error = self.execute_command('tasklist| grep memcache', debug=False)
if error or output == [""] or output == []:
return None
words = output[0].... | def get_memcache_pid(self):
output, error = self.execute_command('tasklist| grep memcache', debug=False)
if error or output == [""] or output == []:
return None
words = output[0].split(" ")
words = [x for x in words if x != ""]
return words[1] |
Code the following: | from shell_util.shell_conn import ShellConnection
def delete_info_for_server(server, ipaddr=None):
"""
Delete the info associated with the given server or ipaddr
:param server: server to delete the info for
:param ipaddr: ipaddr to delete the info for
:return: None
"""
... | Delete the info associated with the given server or ipaddr
|
generate code for the following |
def get_process_id(self, process_name):
"""
Get the process id for the given process
:param process_name: name of the process to get pid for
:return: pid of the process
"""
process_id, _ = self.execute_command(
"ps -ef | grep \"%s \" | grep -v grep | awk '{p... | Get the process id for the given process
|
generate code for the following |
def file_starts_with(self, remotepath, pattern):
"""
Check if file starting with this pattern is present in remote machine.
:param remotepath: path of the file to check
:param pattern: pattern to check against
:return: True if file starting with this pattern is present in remot... | Check if file starting with this pattern is present in remote machine.
|
generate doc string for following function: | def parse_from_file(file):
"""
Parse the test inputs from file
:param file: path to file to parse
:return: TestInput object
"""
count = 0
start = 0
end = 0
servers = list()
ips = list()
input = TestInput()
config = configpar... | def parse_from_file(file):
count = 0
start = 0
end = 0
servers = list()
ips = list()
input = TestInput()
config = configparser.ConfigParser(interpolation=None)
config.read(file)
sections = config.sections()
global_properties = dict... |
generate doc string for following function: | def get_hostname(self):
"""
Get the hostname of the remote server.
:return: hostname of the remote server if found else None
"""
o, r = self.execute_command_raw('hostname', debug=False)
if o:
return o | def get_hostname(self):
o, r = self.execute_command_raw('hostname', debug=False)
if o:
return o |
generate comment for following function: | def sleep(seconds, msg=""):
"""
Sleep for specified number of seconds. Optionally log a message given
:param seconds: number of seconds to sleep for
:param msg: optional message to log
:return: None
"""
if msg:
log.info(msg)
sleep(seconds) | def sleep(seconds, msg=""):
if msg:
log.info(msg)
sleep(seconds) |
def stop_indexer(self):
"""
Stop indexer process on remote server
:return: None
"""
o, r = self.execute_command("taskkill /F /T /IM indexer*")
self.log_command_output(o, r, debug=False) | Stop indexer process on remote server
| |
generate comment: | def stop_membase(self, num_retries=10, poll_interval=1):
"""
Stop membase process on remote server
:param num_retries: number of retries before giving up
:param poll_interval: wait time between each retry.
:return: None
"""
o, r = self.execute_command("net stop me... | def stop_membase(self, num_retries=10, poll_interval=1):
o, r = self.execute_command("net stop membaseserver")
self.log_command_output(o, r)
o, r = self.execute_command("net stop couchbaseserver")
self.log_command_output(o, r)
retries = num_retries
while retries ... |
generate code for the following |
def __init__(self):
"""
Creates an instance of the TestInputBuild class
"""
self.version = ''
self.url = '' | Creates an instance of the TestInputBuild class |
generate comment: | def kill_memcached(self, num_retries=10, poll_interval=2):
"""
Kill memcached process on remote server
:param num_retries: number of times to retry killing the memcached process
:param poll_interval: time to wait before each retry in seconds
:return: output and error of command k... | def kill_memcached(self, num_retries=10, poll_interval=2):
o, r = self.execute_command("taskkill /F /T /IM memcached*")
self.log_command_output(o, r, debug=False) |
generate comment: | def uninstall(self):
"""
Uninstalls Couchbase server on Unix machine
:return: True on success
"""
self.shell.stop_couchbase()
cmd = self.cmds["uninstall"]
if self.shell.nonroot:
cmd = self.non_root_cmds["uninstall"]
self.shell.execute_command(c... | def uninstall(self):
self.shell.stop_couchbase()
cmd = self.cmds["uninstall"]
if self.shell.nonroot:
cmd = self.non_root_cmds["uninstall"]
self.shell.execute_command(cmd)
return True |
generate python code for |
def check_directory_exists(self, remote_path):
"""
Check if the directory exists in the remote path
:param remote_path: remote path of the directory to be checked
:return: True if the directory exists else False
"""
sftp = self._ssh_client.open_sftp()
try:
... | Check if the directory exists in the remote path
|
give python code to |
def is_couchbase_installed(self):
"""
Check if Couchbase is installed on the remote server.
This checks if the couchbase is installed in default or non default path.
:return: True if Couchbase is installed on the remote server else False
"""
output, error = self.execute... | Check if Couchbase is installed on the remote server.
This checks if the couchbase is installed in default or non default path.
|
give python code to |
def start_and_wait_for_threads(thread_list, timeout):
"""
Start the threads in the thread list and wait for the threads to finish. \n
Wait until the thread finishes or the timeout is reached.
:param thread_list: list of threads to run
:param timeout: timeout to wait till threads are finished
:... | Start the threads in the thread list and wait for the threads to finish.
Wait until the thread finishes or the timeout is reached.
|
generate comment for above | def stop_couchbase(self, num_retries=5, poll_interval=10):
"""
Stop couchbase service on remote server
:param num_retries: None
:param poll_interval: None
:return: None
"""
cb_process = '/Applications/Couchbase\ Server.app/Contents/MacOS/Couchbase\ Server'
... | def stop_couchbase(self, num_retries=5, poll_interval=10):
cb_process = '/Applications/Couchbase\ Server.app/Contents/MacOS/Couchbase\ Server'
cmd = "ps aux | grep {0} | awk '{{print $2}}' | xargs kill -9 "\
.format(cb_process)
o, r = self.execute_command(cmd)
self.l... |
generate python code for the following |
def file_exists(self, remotepath, filename, pause_time=30):
"""
Check if file exists in remote machine
:param remotepath: path of the file to check
:param filename: filename of the file to check
:param pause_time: time between each command execution in seconds
:return: ... | Check if file exists in remote machine
|
generate comment: | def kill_memcached(self, num_retries=10, poll_interval=2):
"""
Kill memcached process on remote server
:param num_retries: number of times to retry killing the memcached process
:param poll_interval: time to wait before each retry in seconds
:return: output and error of command k... | def kill_memcached(self, num_retries=10, poll_interval=2):
# Changed from kill -9 $(ps aux | grep 'memcached' | awk '{print $2}'
# as grep was also returning eventing
# process which was using memcached-cert
o, r = self.execute_command("kill -9 $(ps aux | pgrep 'memcached')"
... |
generate code for the above: |
def is_couchbase_installed(self):
"""
Check if Couchbase is installed on the remote server.
This checks if the couchbase is installed in default or non default path.
:return: True if Couchbase is installed on the remote server else False
"""
if self.file_exists(WIN_CB_P... | Check if Couchbase is installed on the remote server.
This checks if the couchbase is installed in default or non default path.
|
generate python code for |
def unpause_memcached(self, os="linux"):
"""
Unpauses the memcached process on remote server
:param os: os type of remote server
:return: None
"""
log.info("*** unpause memcached process ***")
if self.nonroot:
o, r = self.execute_command("killall -SI... | Unpauses the memcached process on remote server
|
def populate_cb_server_versions(self):
"""
Update the BuildUrl with all versions of Couchbase Server currently available for testing. \n
This method gets the current versions of Couchbase Servers available from the CB server manifest and
updates the missing versions in BuildUrl constants... | def populate_cb_server_versions(self):
cb_server_manifests_url = "https://github.com/couchbase" \
"/manifest/tree/master/couchbase-server/"
raw_content_url = "https://raw.githubusercontent.com/couchbase" \
"/manifest/master/couchbase-s... | |
generate comment for following function: | def terminate_process(self, info=None, process_name=None, force=False):
"""
Terminate a list of processes on remote server
:param info: None
:param p_list: List of processes to terminate
:return: None
"""
if not process_name:
log.info("Please specify p... | def terminate_process(self, info=None, process_name=None, force=False):
if not process_name:
log.info("Please specify process name to be terminated.")
return
o, r = self.execute_command("taskkill /F /T /IM {0}*"\
.format(process_name),... |
generate python code for the following |
def change_log_level(self, new_log_level):
"""
Change the log level of couchbase processes on a remote server
:param new_log_level: new log level to set
:return: None
"""
log.info("CHANGE LOG LEVEL TO %s".format(new_log_level))
# ADD NON_ROOT user config_details... | Change the log level of couchbase processes on a remote server
|
generate code for the above: |
def validate_server_status(self, node_helpers):
"""
Checks if the servers are supported OS for Couchbase installation
:param node_helpers: list of node helpers of type NodeInstallInfo
:return: True if the servers are supported OS for Couchbase installation else False
"""
... | Checks if the servers are supported OS for Couchbase installation
|
generate comment. | def stop_membase(self):
"""
Override method
"""
raise NotImplementedError | def stop_membase(self):
raise NotImplementedError |
give a code to | import os
def find_file(self, remote_path, file):
"""
Check if file exists in remote path
:param remote_path: remote path of the file to be checked
:param file: filename to be checked
:return: file path of the file if exists, None otherwise
"""
sftp = self._ssh_c... | Check if file exists in remote path
|
Code the following: |
def get_processes_binding_to_ip_family(self, ip_family="ipv4"):
"""
Get all the processes binding to a particular ip family
Override method for Windows
:param ip_family: ip family to get processes binding of
:return: list of processes binding to ip family
"""
if... | Get all the processes binding to a particular ip family
Override method for Windows
|
generate comment. | def cleanup_all_configuration(self, data_path):
"""
Deletes the contents of the parent folder that holds the data and config directories.
:param data_path: The path key from the /nodes/self end-point which
looks something like "/opt/couchbase/var/lib/couchbase/data" on
Linux or "... | def cleanup_all_configuration(self, data_path):
# The path returned on both Linux and Windows by the /nodes/self end-point uses forward slashes.
path = data_path.replace("/data", "")
o, r = self.execute_command("rm -rf %s/*" % path)
self.log_command_output(o, r) |
generate comment for following function: | def __init__(self, test_server):
"""
Create an instance of Shell connection for the given test server.
This class is responsible for executing remote shell commands on a remote server.
:param test_server: remote server to connect to. This is an object with following attributes:
... | def __init__(self, test_server):
super(ShellConnection, self).__init__()
ShellConnection.__refs__.append(weakref.ref(self)())
self.ip = test_server.ip
self.port = test_server.port
self.server = test_server
self.remote = (self.ip != "localhost" and self.ip != "1... |
generate code for the following |
def is_couchbase_installed(self):
"""
Check if Couchbase is installed on the remote server.
This checks if the couchbase is installed in default or non default path.
:return: True if Couchbase is installed on the remote server else False
"""
if self.nonroot:
... | Check if Couchbase is installed on the remote server.
This checks if the couchbase is installed in default or non default path.
|
give a code to |
def start_memcached(self):
"""
Start memcached process on remote server
:return: None
"""
o, r = self.execute_command("taskkill /F /T /IM memcached")
self.log_command_output(o, r, debug=False) | Start memcached process on remote server
|
generate code for the above: |
def _check_output(self, word_check, output):
"""
Check if certain word is present in the output
:param word_check: string or list of strings to check
:param output: the output to check against
:return: True if word is present in the output else False
"""
found =... | Check if certain word is present in the output
|
generate python code for the following | import urllib.request
def download_build_locally(self, build_url):
"""
Downloads the Couchbase build locally
:param build_url: Download url to download the build from
:return: tuple containing the path to the download build file as well as the resulting HTTPMessage object.
"""
... | Downloads the Couchbase build locally
|
def get_elastic_config(config, section, global_properties):
"""
Get elasticsearch config from config
:param config: config
:param section: section to get elasticsearch property
:param global_properties: dict of global properties
:return: elasticsearch server
"""
... | def get_elastic_config(config, section, global_properties):
server = TestInputServer()
options = config.options(section)
for option in options:
if option == 'ip':
server.ip = config.get(section, option)
if option == 'port':
server.... | |
give a code to | import re
import configparser
def parse_from_file(file):
"""
Parse the test inputs from file
:param file: path to file to parse
:return: TestInput object
"""
count = 0
start = 0
end = 0
servers = list()
ips = list()
input = TestInp... | Parse the test inputs from file
|
def get_memcache_pid(self):
"""
Get the pid of memcached process
:return: pid of memcached process
"""
o, _ = self.execute_command(
"ps -eo comm,pid | awk '$1 == \"memcached\" { print $2 }'")
return o[0] | def get_memcache_pid(self):
o, _ = self.execute_command(
"ps -eo comm,pid | awk '$1 == \"memcached\" { print $2 }'")
return o[0] | |
def stop_memcached(self):
"""
Stop memcached process on remote server
:return: None
"""
o, r = self.execute_command("kill -SIGSTOP $(pgrep memcached)")
self.log_command_output(o, r, debug=False) | def stop_memcached(self):
o, r = self.execute_command("kill -SIGSTOP $(pgrep memcached)")
self.log_command_output(o, r, debug=False) | |
generate comment for following function: | def __construct_build_url(self, is_debuginfo_build=False):
"""
Constructs the build url for the given node.
This url is used to download the installation package.
:param is_debuginfo_build: gets debug_info build url if True
:return: build url
"""
file_name = None
... | def __construct_build_url(self, is_debuginfo_build=False):
file_name = None
build_version = self.node_install_info.version.split("-")
os_type = self.node_install_info.os_type
node_info = RemoteMachineShellConnection.get_info_for_server(
self.node_install_info.server)... |
generate comment for following function: | def get_membase_build(config, section):
"""
Get the membase build information from the config
:param config: config
:param section: section to get information from
:return: membase build information
"""
membase_build = TestInputBuild()
for option in config... | def get_membase_build(config, section):
membase_build = TestInputBuild()
for option in config.options(section):
if option == 'version':
pass
if option == 'url':
pass
return membase_build |
generate python code for the following |
def install(self, build_url):
"""
Installs Couchbase server on Unix machine
:param build_url: build url to get the Couchbase package from
:return: True on successful installation else False
"""
cmd = self.cmds["install"]
if self.shell.nonroot:
cmd = ... | Installs Couchbase server on Unix machine
|
Code the following: |
def enable_diag_eval_on_non_local_hosts(self, state=True):
"""
Enable diag/eval to be run on non-local hosts.
:param state: enable diag/eval on non-local hosts if True
:return: Command output and error if any.
"""
rest_username = self.server.rest_username
rest_p... | Enable diag/eval to be run on non-local hosts.
|
give a code to |
def get_cbversion(self):
"""
Get the installed version of Couchbase Server installed on the remote server.
This gets the versions from both default path or non-default paths.
Returns in format fv = a.b.c-xxxx, sv = a.b.c, bn = xxxx
:return: full version, main version and the bu... | Get the installed version of Couchbase Server installed on the remote server.
This gets the versions from both default path or non-default paths.
Returns in format fv = a.b.c-xxxx, sv = a.b.c, bn = xxxx
|
generate comment for above | def get_process_statistics(self, process_name=None, process_pid=None):
"""
Get the process statistics for given parameter
Gets process statistics for windows nodes
WMI is required to be intalled on the node
stats_windows_helper should be located on the node
:param paramet... | def get_process_statistics(self, process_name=None, process_pid=None):
self.extract_remote_info()
remote_command = "cd ~; /cygdrive/c/Python27/python stats_windows_helper.py"
if process_name:
remote_command.append(" " + process_name)
elif process_pid:
rem... |
generate comment: | def kill_cbft_process(self):
"""
Kill the full text search process on remote server
:return: output and error of command killing FTS process
"""
o, r = self.execute_command("killall -9 cbft")
self.log_command_output(o, r)
if r and r[0] and "command not found" in r... | def kill_cbft_process(self):
o, r = self.execute_command("killall -9 cbft")
self.log_command_output(o, r)
if r and r[0] and "command not found" in r[0]:
o, r = self.execute_command("pkill cbft")
self.log_command_output(o, r)
return o, r |
def get_instances(cls):
"""
Returns a list of instances of the class
:return: generator that yields instances of the class
"""
for ins in cls.__refs__:
yield ins | Returns a list of instances of the class
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.