instruction
stringclasses
14 values
output
stringlengths
105
12.9k
input
stringlengths
0
4.12k
give python code to
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 python code for
def stop_network(self, stop_time): """ Stop the network for given time period and then restart the network on the machine. Override method for Windows :param stop_time: Time duration for which the network service needs to be down in the machine :return: None ...
Stop the network for given time period and then restart the network on the machine. Override method for Windows
generate code for the above:
def post_install(self): """ Post installation steps on a Unix server :return: True on successful post installation steps run else False """ cmds = self.cmds if self.shell.nonroot: cmds = self.non_root_cmds cmd = cmds["post_install"] retry_cmd...
Post installation steps on a Unix server
generate python code for the following
import re 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...
Parses the test input arguments to type TestInput object
generate comment for above
def reboot_node(self): """ Reboot the remote server :return: None """ o, r = self.execute_command("reboot") self.log_command_output(o, r)
def reboot_node(self): o, r = self.execute_command("reboot") self.log_command_output(o, r)
give python 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 doc string for following function:
def __init__(self, test_server): """ Creates an instance of Unix installer class :param test_server: server object of type TestInputServer """ super(Unix, self).__init__() self.shell = RemoteMachineShellConnection(test_server)
def __init__(self, test_server): super(Unix, self).__init__() self.shell = RemoteMachineShellConnection(test_server)
generate comment for following function:
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 ...
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 ...
Stop membase process on remote server
generate python code for
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 python code for the above
import os from subprocess import Popen from typing import re def execute_commands_inside(self, main_command, query, queries, bucket1, password, bucket2, source, subcommands=[], min_output_size=0, end_msg='', timeout=250): ...
def reboot_node(self): """ Reboot the remote server :return: None """ o, r = self.execute_command("shutdown -r -f -t 0") self.log_command_output(o, r)
Reboot the remote server
generate python code for
def cbbackupmgr_param(self, name, *args): """ Returns the config value from the ini whose key matches 'name' and is stored under the 'cbbackupmgr' section heading. :param name: the key under which an expected value is stored. :param args: expects a single parameter which will b...
Returns the config value from the ini whose key matches 'name' and is stored under the 'cbbackupmgr' section heading.
generate python code for the above
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
generate comment for above
def stop_memcached(self): """ Stop 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)
def stop_memcached(self): o, r = self.execute_command("taskkill /F /T /IM memcached*") self.log_command_output(o, r, debug=False)
generate python code for the above
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 python 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
from shell_util.remote_machine import RemoteMachineProcess def get_running_processes(self): """ Retrieves a list of running processes on the system. :return: list of running processes on the system """ # if its linux ,then parse each line # 26989 ? 00:00:51 pdflus...
Retrieves a list of running processes on the system.
generate 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 python code for the above
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 python code for the above
def cpu_stress(self, stop_time): """ Applies CPU stress for a specified duration on the 20 CPU cores. :param stop_time: duration to apply the CPU stress for. :return: None """ o, r = self.execute_command("stress --cpu 20 --timeout {}".format(stop_time)) self.lo...
Applies CPU stress for a specified duration on the 20 CPU cores.
generate python code for the following
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 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 python code for the following
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)
Stop memcached process on remote server
generate code for the following
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
generate comment.
def set_node_name(self, name): """ Edit couchbase-server shell script in place and set custom node name. This is necessary for cloud installations where nodes have both private and public addresses. It only works on Unix-like OS. Reference: http://bit.ly/couchbase-bestp...
def set_node_name(self, name): # Stop server self.stop_couchbase() # Edit _start function cmd = r"sed -i 's/\(.*\-run ns_bootstrap.*\)/\1\n\t-name ns_1@{0} \\/' \ /opt/couchbase/bin/couchbase-server".format(name) self.execute_command(cmd) # Cle...
generate comment for above
def get_running_processes(self): """ Get the list of processes currently running in the remote server if its linux ,then parse each line 26989 ? 00:00:51 pdflush ps -Ao pid,comm :return: List of processes currently running. Each process includes information of the ...
def get_running_processes(self): processes = [] output, error = self.execute_command('ps -Ao pid,comm,vsz,rss,args', debug=False) if output: for line in output: # split to words words = line.strip()...
generate comment.
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 remote ...
def file_starts_with(self, remotepath, pattern): sftp = self._ssh_client.open_sftp() files_matched = [] try: file_names = sftp.listdir(remotepath) for name in file_names: if name.startswith(pattern): files_matched.append("{0}/{...
generate python code for
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.
generate comment:
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, MC...
def change_port_static(self, new_port): # ADD NON_ROOT user config_details log.info("=========CHANGE PORTS for REST: %s, MCCOUCH: %s,MEMCACHED: %s, CAPI: %s===============" % (new_port, new_port + 1, new_port + 2, new_port + 4)) output, error = self.execute_command("sed...
generate comment for above
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
def stop_membase(self): """ Override method """ raise NotImplementedError
Override method
generate python 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
Code the following:
def reboot_node(self): """ Reboot the remote server :return: None """ o, r = self.execute_command("reboot") self.log_command_output(o, r)
Reboot the remote server
def unpause_memcached(self): """ Unpauses the memcached process on remote server Override method for Windows :param os: os type of remote server :return: None """ self.log.info("*** unpause memcached process ***") cmd = "pssuspend -r $(tasklist | grep m...
Unpauses the memcached process on remote server Override method for Windows
generate python code for
def get_disk_info(self, win_info=None, mac=False): """ Get disk info of the remote server :param win_info: Windows info in case of windows :param mac: Get info for macOS if True :return: Disk info of the remote server if found else None """ if win_info: ...
Get disk info of the remote server
generate comment for above
def execute_non_sudo_command(self, command, info=None, debug=True, use_channel=False): """ Execute command in non-sudo mode. :param command: command to be executed :param info: None :param debug: print debug information in logs if True :pa...
def execute_non_sudo_command(self, command, info=None, debug=True, use_channel=False): return self.execute_command_raw(command, debug=debug, use_channel=use_channel)
generate doc string 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...
give a code to
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 = "cou...
Reset environment previously set and restart couchbase server
give python code to
def enable_disk_readonly(self, disk_location): """ Enables read-only mode for the specified disk location. Override method for Windows :param disk_location: disk location to enable read-only mode. :return: None """ raise NotImplementedError
Enables read-only mode for the specified disk location. Override method for Windows
def disable_file_limit(self): """ Change the file limite to 200000 for indexer process :return: None """ o, r = self.execute_command("prlimit --nofile=200000 --pid $(pgrep indexer)") self.log_command_output(o, r)
Change the file limite to 200000 for indexer process
generate python code for the above
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
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 python code for the above
def start_couchbase(self): """ Starts couchbase on remote server :return: None """ retry = 0 running = self.is_couchbase_running() while not running and retry < 3: self.log.info("Starting couchbase server") o, r = self.execute_command("op...
Starts couchbase on remote server
give python code to
def stop_indexer(self): """ Stop indexer process on remote server :return: None """ o, r = self.execute_command("kill -SIGSTOP $(pgrep indexer)") self.log_command_output(o, r, debug=False)
Stop indexer process on remote server
generate comment:
def __init__(self, server, server_info, os_type, version, edition): """ Creats an instance of the NodeInstallInfo class. :param server: server object of type TestInputServer :param server_info: server info with information of the server :param os_type: OS type of the server ...
def __init__(self, server, server_info, os_type, version, edition): self.server = server self.server_info = server_info self.os_type = os_type self.version = version self.edition = edition self.build_url = None self.debug_build_url = None self.n...
generate python code for the above
def delete_file(self, remotepath, filename): """ Delete a file from the remote path :param remotepath: remote path of the file to be deleted :param filename: name of the file to be deleted :return: True if the file was successfully deleted else False """ sftp = ...
Delete a file from the remote path
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 python code for the following
def get_process_id(self, process_name): """ Get the process id for the given process Override method for Windows :param process_name: name of the process to get pid for :return: pid of the process """ raise NotImplementedError
Get the process id for the given process Override method for Windows
generate code for the above:
def __init__(self): """ Creates an instance of the TestInputMembaseSetting class """ self.rest_username = '' self.rest_password = ''
Creates an instance of the TestInputMembaseSetting class
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 doc string for following function:
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/opt/...
def is_enterprise(self): enterprise = False runtime_file_path = "" if self.nonroot: if self.file_exists("%s/opt/couchbase/etc/" % self.nr_home_path, "runtime.ini"): runtime_file_path = "%s/opt/couchbase/etc/" % self.nr_home_pat...
generate python code for
def restart_couchbase(self): """ Restarts the Couchbase server on the remote server :return: None """ o, r = self.execute_command("open /Applications/Couchbase\ Server.app") self.log_command_output(o, r)
Restarts the Couchbase server on the remote server
generate comment.
def wait_till_process_ended(self, process_name, timeout_in_seconds=600): """ Wait until the process is completed or killed or terminated :param process_name: name of the process to be checked :param timeout_in_seconds: wait time in seconds until the process is completed :return: ...
def wait_till_process_ended(self, process_name, timeout_in_seconds=600): if process_name[-1:] == "-": process_name = process_name[:-1] end_time = time.time() + float(timeout_in_seconds) process_ended = False process_running = False count_process_not_run = 0 ...
give python code to
def windows_process_utils(self, ps_name_or_id, cmd_file_name, option=""): """ Windows process utility. This adds firewall rules to Windows system. If a previously suspended process is detected, it continues with the process instead. :param ps_name_or_id: process name or process id ...
Windows process utility. This adds firewall rules to Windows system. If a previously suspended process is detected, it continues with the process instead.
give a code to
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.
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 code for the following
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)
Checks the build url status. Checks if the url is reachable and valid.
generate comment:
def execute_command(self, command, info=None, debug=True, use_channel=False, timeout=600, get_exit_code=False): """ Executes a given command on the remote machine. :param command: The command to execute. :param info: Additional information for execution (optional...
def execute_command(self, command, info=None, debug=True, use_channel=False, timeout=600, get_exit_code=False): if getattr(self, "info", None) is None and info is not None : self.info = info if self.info.type.lower() == 'windows': self.use_sudo =...
generate comment for following function:
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 buil...
def get_cbversion(self): fv = sv = bn = "" if self.file_exists(WIN_CB_PATH_PARA, VERSION_FILE): output = self.read_remote_file(WIN_CB_PATH_PARA, VERSION_FILE) if output: for x in output: x = x.strip() if x and x[:5]...
generate comment for 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 = F...
def _check_output(self, word_check, output): found = False if len(output) >= 1: if isinstance(word_check, list): for ele in word_check: for x in output: if ele.lower() in str(x.lower()): log.info...
generate python code for
def terminate_processes(self, info, p_list): """ Terminate a list of processes on remote server :param info: None :param p_list: List of processes to terminate :return: None """ for process in p_list: # set debug=False if does not want to show log ...
Terminate a list of processes on remote server
generate python code for
def get_ip_address(self): """ Get ip address of a remote server :return: ip address of remote server """ ip_type = "inet \K[\d.]" ipv6_server = False if "ip6" in self.ip or self.ip.startswith("["): ipv6_server = True ip_type = "inet6 \K[0-...
Get ip address of a remote server
generate python code for the following
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...
generate comment.
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...
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: ...
Gets os name from info
def stop_indexer(self): """ Stop indexer process on remote server :return: None """ o, r = self.execute_command("kill -SIGSTOP $(pgrep indexer)") self.log_command_output(o, r, debug=False)
def stop_indexer(self): o, r = self.execute_command("kill -SIGSTOP $(pgrep indexer)") self.log_command_output(o, r, debug=False)
give a code to
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 o...
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
give python code to
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 python code to
from shell_util.remote_machine import RemoteMachineProcess def get_running_processes(self): """ Retrieves a list of running processes on the system. :return: list of running processes on the system """ # if its linux ,then parse each line # 26989 ? 00:00:51 pdflus...
Retrieves a list of running processes on the system.
generate comment:
def read_remote_file(self, remote_path, filename): """ Reads the content of a remote file specified by the path. :param remote_path: Remote path to read the file from :param filename: Name of the file to read. :return: string content of the file """ if self.file_e...
def read_remote_file(self, remote_path, filename): if self.file_exists(remote_path, filename): if self.remote: sftp = self._ssh_client.open_sftp() remote_file = sftp.open('{0}/{1}'.format(remote_path, filename)) try: out = ...
generate python code for
def __init__(self): """ Creates an instance of the TestInputBuild class """ self.version = '' self.url = ''
Creates an instance of the TestInputBuild class
generate python code for
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 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)
Code the following:
from subprocess import Popen 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_clie...
Remove the directory specified from system.
generate doc string for following function:
def kill_erlang(self, delay=0): """ Kill the erlang process in the remote server. If delay is specified, the process is killed after the delay :param delay: time to delay the process kill :return: output and error of executing process kill command """ if delay: ...
def kill_erlang(self, delay=0): if delay: time.sleep(delay) o, r = self.execute_command("killall -9 beam.smp") if r and r[0] and "command not found" in r[0]: o, r = self.execute_command("pkill beam.smp") self.log_command_output(o, r) self.log_...
give python code to
import getopt def parse_from_command_line(argv): """ Parse command line arguments :param argv: command line arguments :return: parsed command line arguments as TestInput """ input = TestInput() try: # -f : won't be parse here anynore # -s...
Parse command line arguments
def unpause_memcached(self): """ Unpauses the memcached process on remote server Override method for Windows :param os: os type of remote server :return: None """ self.log.info("*** unpause memcached process ***") cmd = "pssuspend -r $(tasklist | grep m...
Unpauses the memcached process on remote server Override method for Windows
generate code for the above:
def enable_disk_readonly(self, disk_location): """ Enables read-only mode for the specified disk location. Override method for Windows :param disk_location: disk location to enable read-only mode. :return: None """ raise NotImplementedError
Enables read-only mode for the specified disk location. Override method for Windows
def print_install_status(thread_list, logger): """ Print the installation status of the threads in the thread list. :param thread_list: list of threads to check :param logger: logger object to use :return: None """ status_msg = "\n" for tem_thread in thread_list: node_ip = tem_th...
def print_install_status(thread_list, logger): status_msg = "\n" for tem_thread in thread_list: node_ip = tem_thread.node_install_info.server.ip t_state = tem_thread.node_install_info.state if tem_thread.result: status_msg += " {}: Complete".format(node_ip) else...
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/c...
def cleanup_all_configuration(self, data_path): path = data_path.replace("/data", "") if "c:/Program Files" in path: path = path.replace("c:/Program Files", "/cygdrive/c/Program\ Files") o, r = self.execute_command(f"rm -rf {path}/*") self.log_command_output(o, r)
generate code for the above:
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
give a code to
def cleanup_data_config(self, data_path): """ Cleans up the data config directory and its contents :param data_path: path to data config directory :return: None """ self.extract_remote_info() o, r = self.execute_command("rm -rf {0}/*".format(data_path)) ...
Cleans up the data config directory and its contents
generate doc string 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 python code for the following
def stop_membase(self): """ Override method """ raise NotImplementedError
Override method
generate comment:
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 direc...
def get_download_dir(node_installer): if node_installer.shell.nonroot: return node_installer.nonroot_download_dir return node_installer.download_dir
generate python code for the following
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)
Stop memcached process on remote server
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 defa...
def param(self, name, *args): if name in self.test_params: return TestInput._parse_param(self.test_params[name]) elif len(args) == 1: return args[0] else: raise Exception("Parameter `{}` must be set " "in the test configura...
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
generate doc string for following function:
def terminate_processes(self, info, p_list): """ Terminate a list of processes on remote server :param info: None :param p_list: List of processes to terminate :return: None """ for process in p_list: self.terminate_process(info, process, force=True)
def terminate_processes(self, info, p_list): for process in p_list: self.terminate_process(info, process, force=True)
Code the following:
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
import sys from install_util.constants.build import BuildUrl from install_util.install_lib.helper import InstallHelper from install_util.install_lib.node_helper import NodeInstaller from install_util.install_lib.node_helper import NodeInstallInfo from install_util.test_input import TestInputParser from shell_util.remot...
Main function of the installation script.
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)
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
generate code for the above:
def ram_stress(self, stop_time): """ Applies memory stress for a specified duration with 3 workers each of size 2.5G. Override method for Windows :param stop_time: duration to apply the memory stress for. :return: None """ raise NotImplementedError
Applies memory stress for a specified duration with 3 workers each of size 2.5G. Override method for Windows
generate doc string for following function:
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 python 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
generate doc string for following function:
def __init__(self, test_server, info=None): """ Creates a new shell connection for Linux based platforms :param test_server: test server to create the shell connection for :param info: None """ super(Linux, self).__init__(test_server) self.nonroot = False ...
def __init__(self, test_server, info=None): super(Linux, self).__init__(test_server) self.nonroot = False self.use_sudo = False self.info = info
Code the following:
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
def create_windows_info(self): """ Create info dictionary about the Windows server This method retrieves OS, OS version, and OS architecture of the Windows server. The method also stores the information in the remote server as a text file. :return: windows info dictionary ...
Create info dictionary about the Windows server This method retrieves OS, OS version, and OS architecture of the Windows server. The method also stores the information in the remote server as a text file.