instruction stringclasses 14
values | output stringlengths 105 12.9k | input stringlengths 0 4.12k |
|---|---|---|
give a code to | 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 comment: | def execute_batch_command(self, command):
"""
Execute a batch of commands.
This method copies the commands onto a batch file, changes the file type to executable and then executes them
on the remote server
:param command: commands to execute in a batch
:return: output of ... | def execute_batch_command(self, command):
remote_command = "echo \"%s\" > /tmp/cmd.bat ; " \
"chmod u=rwx /tmp/cmd.bat; /tmp/cmd.bat" % command
o, r = self.execute_command_raw(remote_command)
if r and r!=['']:
log.error("Command didn't run successful... |
generate python code for |
def write_remote_file(self, remote_path, filename, lines):
"""
Writes content to a remote file specified by the path.
:param remote_path: Remote path to write the file to.
:param filename: Name of the file to write to.
:param lines: Lines to write to the file.
:return: ... | Writes content to a remote file specified by the path.
|
def __repr__(self):
"""
Returns a string representation of the TestInputServer object with ip, port and ssh_username
:return: A string representation of the TestInputServer object
"""
#ip_str = "ip:{0}".format(self.ip)
ip_str = "ip:{0} port:{1}".format(self.ip, self.por... | Returns a string representation of the TestInputServer object with ip, port and ssh_username
| |
generate comment: | def reset_env_variables(self):
"""
Reset environment previously set and restart couchbase server
:return: None
"""
shell = self._ssh_client.invoke_shell()
if getattr(self, "info", None) is None:
self.info = self.extract_remote_info()
init_file = "couch... | def reset_env_variables(self):
shell = self._ssh_client.invoke_shell()
if getattr(self, "info", None) is None:
self.info = self.extract_remote_info()
init_file = "couchbase-server"
file_path = "/opt/couchbase/bin/"
backupfile = file_path + init_file + ".bak"
... |
generate python code for |
def delete_network_rule(self):
"""
Delete all traffic control rules set for eth0
:return: None
"""
o, r = self.execute_command("tc qdisc del dev eth0 root")
self.log_command_output(o, r) | Delete all traffic control rules set for eth0
|
generate python code for the following |
def cleanup_all_configuration(self, data_path):
"""
Deletes the contents of the parent folder that holds the data and config directories.
Override method for Windows
:param data_path: The path key from the /nodes/self end-point which
looks something like "/opt/couchbase/var/lib... | Deletes the contents of the parent folder that holds the data and config directories.
Override method for Windows
|
generate comment for following function: | def get_server(ip, config):
"""
Get the server information from the config
:param ip: ip to get information for
:param config: config
:return: TestInputServer object
"""
server = TestInputServer()
server.ip = ip
server.bkrs_client = False
f... | def get_server(ip, config):
server = TestInputServer()
server.ip = ip
server.bkrs_client = False
for section in config.sections():
if section == ip:
options = config.options(section)
for option in options:
if option... |
generate python code for |
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) | Change the file size limit to unlimited for indexer process
|
generate doc string for following function: | def kill_goxdcr(self):
"""
Kill XDCR process on remote server
:return: None
"""
o, r = self.execute_command("killall -9 goxdcr")
self.log_command_output(o, r) | def kill_goxdcr(self):
o, r = self.execute_command("killall -9 goxdcr")
self.log_command_output(o, r) |
give python code to | import os
def copy_files_local_to_remote(self, src_path, des_path):
"""
Copy multi files from local to remote server
:param src_path: source path of the files to be copied
:param des_path: destination path of the files to be copied
:return: None
"""
files = os.li... | Copy multi files from local to remote server
|
generate python code for the following | import time
from time import sleep
def monitor_process_memory(self, process_name, duration_in_seconds=180,
end=False):
"""
Monitor this process and return list of memories in 7 secs interval till the duration specified
:param process_name: the name of the process ... | Monitor this process and return list of memories in 7 secs interval till the duration specified
|
Code the following: |
def get_process_statistics_parameter(self, parameter,
process_name=None, process_pid=None):
"""
Get the process statistics for given parameter
:param parameter: parameter to get statistics for
:param process_name: name of process to get statisti... | Get the process statistics for given parameter
|
give a code to |
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):
... | Get CB backup manager configuration
|
generate code for the following |
def get_memcache_pid(self):
"""
Get the pid of memcached process
:return: pid of memcached process
"""
raise NotImplementedError | Get the pid of memcached process
|
generate python code for the following |
def populate_debug_build_url(self):
"""
Populates the debug_info build url variable.
:return: None
"""
self.node_install_info.debug_build_url = self.__construct_build_url(
is_debuginfo_build=True)
self.log.info("{} - Debug build url :: {}"
... | Populates the debug_info build url variable.
|
give a code to |
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. |
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('erl.exe')
if o is not None:
return True
return False | Checks if couchbase is currently running on the remote server
|
generate python code for the following |
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
|
give a code to |
def alt_addr_add_node(self, main_server=None, internal_IP=None,
server_add=None, user="Administrator",
passwd="password", services="kv", cmd_ext=""):
"""
Add node to couchbase cluster using alternative address
:param main_server: couchbase cl... | Add node to couchbase cluster using alternative address
|
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
|
give python code to |
def cleanup_data_config(self, data_path):
"""
Cleans up the data config directory and its contents
Override method for Windows
:param data_path: path to data config directory
:return: None
"""
if "c:/Program Files" in data_path:
data_path = data_path... | Cleans up the data config directory and its contents
Override method for Windows
|
generate python code for |
def start_indexer(self):
"""
Start indexer process on remote server
:return: None
"""
o, r = self.execute_command("taskkill /F /T /IM indexer*")
self.log_command_output(o, r) | Start indexer process on remote server
|
generate comment: | def get_data_file_size(self, path=None):
"""
Get the size of the file in the specified path
:param path: path of the file to get the size of
:return: size of the file in the path
"""
output, error = self.execute_command('du -b {0}'.format(path))
if error:
... | def get_data_file_size(self, path=None):
output, error = self.execute_command('du -b {0}'.format(path))
if error:
return 0
else:
for line in output:
size = line.strip().split('\t')
if size[0].isdigit():
print((s... |
generate python code for the following |
def get_mem_usage_by_process(self, process_name):
"""
Get the memory usage of a process
:param process_name: name of the process to get the memory usage for
:return: the memory usage of the process if available else None
"""
output, error = self.execute_command(
... | Get the memory usage of a process
|
generate comment for above | 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 doc string for following function: | def get_server_ips(config, section):
"""
Get server IPs from config
:param config: config
:param section: section to get server IPs from
:return: list of IP addresses
"""
ips = []
options = config.options(section)
for option in options:
... | def get_server_ips(config, section):
ips = []
options = config.options(section)
for option in options:
ips.append(config.get(section, option))
return ips |
generate comment: | def reconnect_if_inactive(self):
"""
If the SSH channel is inactive, retry the connection
"""
tp = self._ssh_client.get_transport()
if tp and not tp.active:
self.log.warning("%s - SSH connection inactive" % self.ip)
self.ssh_connect_with_retries(self.ip, s... | def reconnect_if_inactive(self):
tp = self._ssh_client.get_transport()
if tp and not tp.active:
self.log.warning("%s - SSH connection inactive" % self.ip)
self.ssh_connect_with_retries(self.ip, self.username,
self.password, self.... |
generate doc string for following function: | 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 comment for following function: | 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 python code for |
def __init__(self, logger):
"""
Creates an instance of InstallHelper object
:param logger: logger object
"""
self.log = logger | Creates an instance of InstallHelper object
|
generate code for the following | 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
|
give a code to |
def get_port_recvq(self, port):
"""
Given a port, extracts address:port of services listening on that port (only ipv4)
Override for Unix systems
:param port: port to listen on
:return: list of addresses and ports of services listening
"""
raise NotImplementedErr... | Given a port, extracts address:port of services listening on that port (only ipv4)
Override for Unix systems
|
def start_server(self):
"""
Starts the Couchbase server on the remote server.
The method runs the sever from non-default location if it's run as nonroot user. Else from default location.
:return: None
"""
if self.is_couchbase_installed():
if self.nonroot:
... | Starts the Couchbase server on the remote server.
The method runs the sever from non-default location if it's run as nonroot user. Else from default location.
| |
generate comment: | def get_ram_info(self, win_info=None, mac=False):
"""
Get the RAM info of the remote server
:param win_info: Windows info in case of windows
:param mac: Get info for macOS if True
:return: RAM info of the remote server if found else None
"""
if win_info:
... | def get_ram_info(self, win_info=None, mac=False):
if win_info:
if 'Virtual Memory Max Size' not in win_info:
win_info = self.create_windows_info()
o = "Virtual Memory Max Size =" \
+ win_info['Virtual Memory Max Size'] + '\n' \
+ "... |
generate comment. | 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.
"""
f_path = "{}/{}"... | def download_build_locally(self, build_url):
f_path = "{}/{}".format(".", build_url.split('/')[-1])
f, r = urllib.request.urlretrieve(build_url, f_path)
return f, r |
give python code to |
def __str__(self):
"""
Returns a string representation of the TestInputServer object with ip, port and ssh_username
:return: A string representation of the TestInputServer object
"""
#ip_str = "ip:{0}".format(self.ip)
ip_str = "ip:{0} port:{1}".format(self.ip, self.port... | Returns a string representation of the TestInputServer object with ip, port and ssh_username
|
generate python code for |
def restart_couchbase(self):
"""
Restarts the Couchbase server on the remote server
:return: None
"""
o, r = self.execute_command("service couchbase-server restart")
self.log_command_output(o, r) | Restarts the Couchbase server on the remote server
|
generate python code for the above |
def remove_folders(self, list):
"""
Remove folders from list provided
:param list: paths of folders to be removed
:return: None
"""
for folder in list:
output, error = self.execute_command(
"rm -rf {0}".format(folder), debug=False)
... | Remove folders from list provided
|
generate doc string for following function: | def start_indexer(self):
"""
Start indexer process on remote server
:return: None
"""
o, r = self.execute_command("taskkill /F /T /IM indexer*")
self.log_command_output(o, r) | def start_indexer(self):
o, r = self.execute_command("taskkill /F /T /IM indexer*")
self.log_command_output(o, r) |
generate python code for |
def remove_folders(self, list):
"""
Remove folders from list provided
:param list: paths of folders to be removed
:return: None
"""
for folder in list:
output, error = self.execute_command(
"rm -rf {0}".format(folder), debug=False)
... | Remove folders from list provided
|
generate comment for following function: | def fill_disk_space(self, location):
"""
Fill up the disk fully at the location specified.
This method creates a junk file of the specified size in the location specified
:param location: Location to fill the disk
:param size: Size of disk space to fill up, in MB
:return:... | def fill_disk_space(self, location):
command = "dd if=/dev/zero of={0}/disk-quota.ext3 count={1}; df -Thl"\
.format(location, 1024000000)
output, error = self.execute_command(command)
return output, error |
generate python code for the following |
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) | Change the file size limit to unlimited for indexer process
|
give a code to |
def get_collection_config(collection, config):
"""
Get collection configuration
:param collection: collection name to get configuration for
:param config: config
:return: dict of collection information
"""
collection_config = {}
for section in config.sec... | Get collection configuration
|
generate python code for the above |
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 conf... | Get the membase build information from the config
|
generate comment for above | def kill_goxdcr(self):
"""
Kill XDCR process on remote server
:return: None
"""
o, r = self.execute_command("killall -9 goxdcr")
self.log_command_output(o, r) | def kill_goxdcr(self):
o, r = self.execute_command("killall -9 goxdcr")
self.log_command_output(o, r) |
give a code to |
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("taskkill /F /T /IM cbft.exe*")
self.log_command_output(o, r) | Kill the full text search process on remote server
|
generate python code for the following | 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
|
generate comment for following function: | def get_processes_binding_to_ip_family(self, ip_family="ipv4"):
"""
Get all the processes binding to a particular ip family
:param ip_family: ip family to get processes binding of
:return: list of processes binding to ip family
"""
output, error = self.execute_command(
... | def get_processes_binding_to_ip_family(self, ip_family="ipv4"):
output, error = self.execute_command(
"lsof -i -P -n | grep LISTEN | grep couchbase| grep -i {0}"
.format(ip_family), debug=True)
self.log_command_output(output, error, debug=True)
return output |
generate python code for 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
|
def cpu_stress(self, stop_time):
"""
Applies CPU stress for a specified duration on the 20 CPU cores.
Override method for Windows
:param stop_time: duration to apply the CPU stress for.
:return: None
"""
raise NotImplementedError | def cpu_stress(self, stop_time):
raise NotImplementedError | |
generate code for the above: |
def file_ends_with(self, remotepath, pattern):
"""
Check if file ending with this pattern is present in remote machine
:param remotepath: path of the file to check
:param pattern: pattern to test against
:return: True if file ending with this pattern is present in remote m... | Check if file ending with this pattern is present in remote machine
|
generate python code for the above |
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
|
give python code to |
def enable_packet_loss(self):
"""
Changes network to lose 25% of packets using traffic control
This is used to simulate a network environment where approximately 25% of packets are lost.
:return: None
"""
o, r = self.execute_command("tc qdisc add dev eth0 root netem los... | Changes network to lose 25% of packets using traffic control
This is used to simulate a network environment where approximately 25% of packets are lost.
|
def delete_files(self, file_location, debug=False):
"""
Delete the files in the specified location
:param file_location: path to files to delete
:param debug: print debug information if True
:return: None
"""
command = "%s%s" % ("rm -rf ", file_location)
... | Delete the files in the specified location
| |
generate python code for the following |
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 following |
def uninstall(self):
"""
Uninstalls Couchbase server on Windows machine
:return: True on success
"""
self.shell.stop_couchbase()
cmd = self.cmds["uninstall"]
self.shell.execute_command(cmd)
return True | Uninstalls Couchbase server on Windows machine
|
generate doc string for following function: | def get_processes_binding_to_ip_family(self, ip_family="ipv4"):
"""
Get all the processes binding to a particular ip family
:param ip_family: ip family to get processes binding of
:return: list of processes binding to ip family
"""
output, error = self.execute_command(
... | def get_processes_binding_to_ip_family(self, ip_family="ipv4"):
output, error = self.execute_command(
"lsof -i -P -n | grep LISTEN | grep couchbase| grep -i {0}"
.format(ip_family), debug=True)
self.log_command_output(output, error, debug=True)
return output |
give python code to |
def get_bkrs_client_config(config, section, global_properties,
ui_settings):
"""
Get back up restore client configuration
:param config: config
:param section: section to get configuration from
:param global_properties: dict of global properties
... | Get back up restore client configuration
|
generate code for the above: |
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
|
Code the following: |
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 ... | Given a port, extracts address:port of services listening on that port (only ipv4)
|
generate comment: | def get_ip_address(self):
"""
Get ip address of a remote server
Override method for Windows
:return: ip address of remote server
"""
raise NotImplementedError | def get_ip_address(self):
raise NotImplementedError |
generate code for the above: |
def kill_eventing_process(self, name):
"""
Kill eventing process on remote server
:param name: name of eventing process
:return: None
"""
o, r = self.execute_command(command="killall -9 {0}".format(name))
self.log_command_output(o, r) | Kill eventing process on remote server
|
give python code to | from subprocess import Popen
def remove_directory_recursive(self, remote_path):
"""
Recursively remove directory in remote machine.
:param remote_path: directory path to remove
:return: True if successful else False
"""
if self.remote:
sftp = self._ssh_client... | Recursively remove directory in remote machine.
|
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) | |
give a code to | from shell_util.remote_connection import RemoteMachineShellConnection
def __init__(self, test_server):
"""
Creates an instance of Linux installer class
:param test_server: server object of type TestInputServer
"""
super(Linux, self).__init__()
self.shell = RemoteMachineS... | Creates an instance of Linux installer class
|
generate code for the above: |
def get_ip_address(self):
"""
Get ip address of a remote server
Override method for Windows
:return: ip address of remote server
"""
raise NotImplementedError | Get ip address of a remote server
Override method for Windows
|
generate comment for following function: | def uninstall(self):
"""
Uninstalls Couchbase server on Linux machine
:return: True on success
"""
self.shell.stop_couchbase()
cmd = self.cmds
if self.shell.nonroot:
cmd = self.non_root_cmds
cmd = cmd[self.shell.info.deliverable_type]["uninstal... | def uninstall(self):
self.shell.stop_couchbase()
cmd = self.cmds
if self.shell.nonroot:
cmd = self.non_root_cmds
cmd = cmd[self.shell.info.deliverable_type]["uninstall"]
self.shell.execute_command(cmd)
return True |
def pause_beam(self):
"""
Pauses the beam.smp process on remote server
:return: None
"""
o, r = self.execute_command("killall -SIGSTOP beam.smp")
self.log_command_output(o, r) | def pause_beam(self):
o, r = self.execute_command("killall -SIGSTOP beam.smp")
self.log_command_output(o, r) | |
generate python code for the following |
def get_port_recvq(self, port):
"""
Given a port, extracts address:port of services listening on that port (only ipv4)
Override for Unix systems
:param port: port to listen on
:return: list of addresses and ports of services listening
"""
raise NotImplementedErr... | Given a port, extracts address:port of services listening on that port (only ipv4)
Override for Unix systems
|
generate doc string for following function: | 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) | def start_memcached(self):
o, r = self.execute_command("kill -SIGCONT $(pgrep memcached)")
self.log_command_output(o, r, debug=False) |
give a code to |
def get_data_file_size(self, path=None):
"""
Get the size of the file in the specified path
:param path: path of the file to get the size of
:return: size of the file in the path
"""
output, error = self.execute_command('du -b {0}'.format(path))
if error:
... | Get the size of the file in the specified path
|
generate code for the above: |
def get_download_dir(node_installer):
"""
Gets the download directory for the given node.
Returns non-root download directory in case of nonroot installation. Else returns the default
download directory.
:param node_installer: node installer object
:return: download dir... | Gets the download directory for the given node.
Returns non-root download directory in case of nonroot installation. Else returns the default
download directory.
|
give a code to |
def install(self, build_url):
"""
Installs Couchbase server on Linux machine
:param build_url: build url to get the Couchbase package from
:return: True on successful installation else False
"""
cmd = self.cmds
if self.shell.nonroot:
cmd = self.non_r... | Installs Couchbase server on Linux machine
|
generate python code for the above |
def remove_folders(self, list):
"""
Remove folders from list provided
:param list: paths of folders to be removed
:return: None
"""
for folder in list:
output, error = self.execute_command(
"rm -rf {0}".format(folder), debug=False)
... | Remove folders from list provided
|
generate python 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 | import os
def get_server_options(servers, membase_settings, global_properties):
"""
Set the various server properties from membase and global properties
:param servers: list of servers to set the values of
:param membase_settings: TestInputMembaseSetting object with membase settings
... | Set the various server properties from membase and global properties
|
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('erl.exe')
if o is not None:
return True
return False | Checks if couchbase is currently running on the remote server
|
generate python code for the above | from typing import re
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".forma... | Recover the disk full failures on remote server
|
generate comment: | def start_membase(self):
"""
Start membase process on remote server
:return: None
"""
o, r = self.execute_command("net start membaseserver")
self.log_command_output(o, r) | def start_membase(self):
o, r = self.execute_command("net start membaseserver")
self.log_command_output(o, r) |
Code the following: |
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 check_build_url_status(self):
"""
Checks the build url status. Checks if the url is reachable and valid.
:return: None
"""
self.check_url_status(self.node_install_info.build_url) | def check_build_url_status(self):
self.check_url_status(self.node_install_info.build_url) | |
def unmount_partition(self, location):
"""
Unmount the partition at the specified location.
:param location: Location of the partition which has to be unmounted
:return: Output and error message from the umount command
"""
command = "umount -l {0}; df -Th".format(location... | def unmount_partition(self, location):
command = "umount -l {0}; df -Th".format(location)
output, error = self.execute_command(command)
return output, error | |
give a code to |
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... | Kill the full text search process on remote server
|
generate python code for the above |
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
|
Code the following: |
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... | Kill the full text search process on remote server
|
generate python code for the following |
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.
|
give a code to |
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 python code for the above |
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 conf... | Get the membase build information from the config
|
def get_server_options(servers, membase_settings, global_properties):
"""
Set the various server properties from membase and global properties
:param servers: list of servers to set the values of
:param membase_settings: TestInputMembaseSetting object with membase settings
:param... | def get_server_options(servers, membase_settings, global_properties):
for server in servers:
if server.ssh_username == '' and 'username' in global_properties:
server.ssh_username = global_properties['username']
if server.ssh_password == '' and 'passwo... | |
generate comment: | def __init__(self, test_server, info=None):
"""
Creates a new shell connection for Unix based platforms
:param test_server: test server to create the shell connection for
:param info: None
"""
super(Unix, self).__init__(test_server)
self.nonroot = False
se... | def __init__(self, test_server, info=None):
super(Unix, self).__init__(test_server)
self.nonroot = False
self.info = info |
generate code for the above: |
def start_server(self):
"""
Starts the Couchbase server on the remote server.
The method runs the sever from non-default location if it's run as nonroot user. Else from default location.
:return: None
"""
o, r = self.execute_command("net start couchbaseserver")
... | Starts the Couchbase server on the remote server.
The method runs the sever from non-default location if it's run as nonroot user. Else from default location.
|
generate comment for above | def disable_disk_readonly(self, disk_location):
"""
Disables read-only mode for the specified disk location.
:param disk_location: disk location to disable read-only mode.
:return: None
"""
o, r = self.execute_command("chmod -R 777 {}".format(disk_location))
self.... | def disable_disk_readonly(self, disk_location):
o, r = self.execute_command("chmod -R 777 {}".format(disk_location))
self.log_command_output(o, r) |
generate python code for the above |
def is_enterprise(self):
"""
Check if the couchbase installed is enterprise edition or not
:return: True if couchbase installed is enterprise edition else False
"""
enterprise = False
runtime_file_path = ""
if self.nonroot:
if self.file_exists("%s/op... | Check if the couchbase installed is enterprise edition or not
|
generate code for the following |
def disable_firewall(self):
"""
Clear firewall rules on the remote server
:return: None
"""
output, error = self.execute_command('netsh advfirewall set publicprofile state off')
self.log_command_output(output, error)
output, error = self.execute_command('netsh a... | Clear firewall rules on the remote server
|
give python code to | import os
def copy_files_local_to_remote(self, src_path, des_path):
"""
Copy multi files from local to remote server
:param src_path: source path of the files to be copied
:param des_path: destination path of the files to be copied
:return: None
"""
files = os.li... | Copy multi files from local to remote server
|
give python code to |
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... | Deletes the contents of the parent folder that holds the data and config directories.
|
give a code to |
def handle_command_line_u_or_v(option, argument):
"""
Parse command line arguments for -u or -v
:param option: option to parse
:param argument: argument to check
:return: parsed arguments as TestInputBuild
"""
input_build = TestInputBuild()
if option == ... | Parse command line arguments for -u or -v
|
give a code to |
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... | Kill the full text search process on remote server
|
generate comment. | def disable_file_limit_desc(self):
"""
Change the file limit for all processes to 1606494
:return:
"""
o, r = self.execute_command("sysctl -w fs.file-max=1606494;sysctl -p")
self.log_command_output(o, r) | def disable_file_limit_desc(self):
o, r = self.execute_command("sysctl -w fs.file-max=1606494;sysctl -p")
self.log_command_output(o, r) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.