instruction
stringclasses
14 values
output
stringlengths
105
12.9k
input
stringlengths
0
4.12k
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 code for the above:
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
give a code to
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...
Get the pid of memcached process
generate doc string for following function:
def get_aws_public_hostname(self): """ Get aws meta data like public hostnames of an instance from shell :return: curl output as a list of strings containing public hostnames """ output, _ = self.execute_command( "curl -s http://169.254.169.254/latest/meta-data/public...
def get_aws_public_hostname(self): output, _ = self.execute_command( "curl -s http://169.254.169.254/latest/meta-data/public-hostname") return output[0]
generate doc string for following function:
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 ...
generate comment for following function:
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 ...
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.
give a code to
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
give a 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
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 above
def stop_network(self, stop_time): """ Stop the network for given time period and then restart the network on the machine. :param stop_time: Time duration for which the network service needs to be down in the machine :return: None """ command = "nohup se...
Stop the network for given time period and then restart the network on the machine.
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
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
generate python code for
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
give a code to
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 code for the following
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
give python 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
generate comment for above
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 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]
generate python code for
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, ...
Populates the build url variable.
give python code to
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 comment:
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 :re...
def start_and_wait_for_threads(thread_list, timeout): okay = True for tem_thread in thread_list: tem_thread.start() for tem_thread in thread_list: tem_thread.join(timeout) okay = okay and tem_thread.result return okay
Code the following:
def get_full_hostname(self): """ Get the full hostname of the remote server Override method for windows :return: full hostname if domain is set, else None """ if not self.info.domain: return None return '%s.%s' % (self.info.hostname[0], self.info.dom...
Get the full hostname of the remote server Override method for windows
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 to monitor :param duration_i...
def monitor_process_memory(self, process_name, duration_in_seconds=180, end=False): end_time = time.time() + float(duration_in_seconds) count = 0 vsz = [] rss = [] while time.time() < end_time and not end: # get the process list...
generate comment:
def __init__(self): """ Creates an instance of the TestInputBuild class """ self.version = '' self.url = ''
def __init__(self): self.version = '' self.url = ''
give a code to
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 = "netstat -a -b -p tcp | grep :%s | grep 'LISTEN...
Given a port, extracts address:port of services listening on that port (only ipv4)
give a code to
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)
Stop memcached process on remote server
generate comment for 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="taskkill /F /T /IM {0}*".format(name)) self.log_command_output(o, r)
def kill_eventing_process(self, name): o, r = self.execute_command(command="taskkill /F /T /IM {0}*".format(name)) self.log_command_output(o, r)
give python code to
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 comment for above
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 code for the above:
def handle_command_line_s(argument): """ Parse command line argument for -s option (servers) :param argument: argument to parse :return: list of server TestInputServer objects """ #ip:port:username:password:clipath ips = argument.split(",") servers = []...
Parse command line argument for -s option (servers)
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)
give a code to
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 code for the following
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' ...
Stop couchbase service on remote server
give python code to
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.
generate comment for 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)
def start_memcached(self): o, r = self.execute_command("kill -SIGCONT $(pgrep memcached)") self.log_command_output(o, r, debug=False)
generate python code for the following
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
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 specific ...
def execute_commands_inside(self, main_command, query, queries, bucket1, password, bucket2, source, subcommands=[], min_output_size=0, end_msg='', timeout=250): filename = "/cygdrive/c/tmp/test.txt" ...
generate doc string for following function:
def give_directory_permissions_to_couchbase(self, location): """ Change the directory permission of the location mentioned to include couchbase as the user :param location: Directory location whoes permissions has to be changed :return: None """ command = "chown '...
def give_directory_permissions_to_couchbase(self, location): command = "chown 'couchbase' {0}".format(location) output, error = self.execute_command(command) command = "chmod 777 {0}".format(location) output, error = self.execute_command(command)
generate code for the above:
def enable_file_limit(self): """ Change the file limit to 100 for indexer process :return: None """ o, r = self.execute_command("prlimit --nofile=100 --pid $(pgrep indexer)") self.log_command_output(o, r)
Change the file limit to 100 for indexer process
generate python code for the following
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
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 = RemoteMachineShellConnection(test_server)
def __init__(self, test_server): super(Linux, self).__init__() self.shell = RemoteMachineShellConnection(test_server)
Code the following:
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 variable...
Request an interactive shell session, export custom variable and restart Couchbase server. Shell session is necessary because basic SSH client is stateless.
generate python code for the above
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 """...
Get elasticsearch config from config
def execute_command_raw(self, command, debug=True, use_channel=False, timeout=600, get_exit_code=False): """ Implementation to execute a given command on the remote machine or on local machine. :param command: The raw command to execute. :param debug: Enables...
def execute_command_raw(self, command, debug=True, use_channel=False, timeout=600, get_exit_code=False): self.log.debug("%s - Running command.raw: %s" % (self.ip, command)) self.reconnect_if_inactive() output = [] error = [] temp = '' ...
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-bes...
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-bestpractice-cloud-ip
generate comment for following function:
def stop_network(self, stop_time): """ Stop the network for given time period and then restart the network on the machine. :param stop_time: Time duration for which the network service needs to be down in the machine :return: None """ command = "nohup serv...
def stop_network(self, stop_time): command = "nohup service network stop && sleep {} " \ "&& service network start &" output, error = self.execute_command(command.format(stop_time)) self.log_command_output(output, error)
give python code to
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
Applies CPU stress for a specified duration on the 20 CPU cores. 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
generate python code for 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 comment for following function:
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)
generate code for the above:
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.
generate comment for above
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)
def stop_indexer(self): o, r = self.execute_command("taskkill /F /T /IM indexer*") self.log_command_output(o, r, debug=False)
generate comment for above
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 specific ...
def execute_commands_inside(self, main_command, query, queries, bucket1, password, bucket2, source, subcommands=[], min_output_size=0, end_msg='', timeout=250): filename = "/cygdrive/c/tmp/test.txt" ...
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 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
generate code for the above:
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 comment for above
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 '{pri...
def get_process_id(self, process_name): process_id, _ = self.execute_command( "ps -ef | grep \"%s \" | grep -v grep | awk '{print $2}'" % process_name) return process_id[0].strip()
generate 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
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
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 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: ...
Get server IPs from config
Code the following:
from time import sleep def sleep(self, timeout, msg=None): """ Sleep for given amount of time. Optionally print the message to log. :param timeout: amount of time to sleep in seconds :param msg: message to log :return: None """ if msg: self.log.info(m...
Sleep for given amount of time. Optionally print the message to log.
generate comment for following function:
def get_disk_info(self, win_info=None, mac=False): """ Get disk info of a remote server :param win_info: windows info :param mac: get disk info from macOS if True :return: disk info of remote server """ if win_info: if 'Total Physical Memory' not in wi...
def get_disk_info(self, win_info=None, mac=False): if win_info: if 'Total Physical Memory' not in win_info: win_info = self.create_windows_info() o = "Total Physical Memory =" + win_info['Total Physical Memory'] + '\n' o += "Available Physical Memory ...
generate comment for above
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 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)
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)
generate python code for the above
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 python code for the following
def stop_network(self, stop_time): """ Stop the network for given time period and then restart the network on the machine. :param stop_time: Time duration for which the network service needs to be down in the machine :return: None """ command = "nohup se...
Stop the network for given time period and then restart the network on the machine.
generate code for the following
def get_aws_public_hostname(self): """ Get aws meta data like public hostnames of an instance from shell :return: curl output as a list of strings containing public hostnames """ output, _ = self.execute_command( "curl -s http://169.254.169.254/latest/meta-data/publ...
Get aws meta data like public hostnames of an instance from shell
generate 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): ...
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
generate comment for 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("open...
def start_couchbase(self): retry = 0 running = self.is_couchbase_running() while not running and retry < 3: self.log.info("Starting couchbase server") o, r = self.execute_command("open /Applications/Couchbase\ Server.app") self.log_command_output(o, r...
generate code for the following
def install(self, build_url): """ Installs Couchbase server on Windows machine :param build_url: build url to get the Couchbase package from :return: True on successful installation else False """ cmd = self.cmds["install"] f_name = build_url.split("/")[-1] ...
Installs Couchbase server on Windows machine
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
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 comment.
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)
def disable_file_limit(self): o, r = self.execute_command("prlimit --nofile=200000 --pid $(pgrep indexer)") self.log_command_output(o, r)
generate code for the following
def change_stat_periodicity(self, ticks): """ Change the stat periodicity of the logs to specified ticks :param ticks: periodicity to change to (in seconds) :return: None """ # ADD NON_ROOT user config_details log.info("CHANGE STAT PERIODICITY TO every %s second...
Change the stat periodicity of the logs to specified ticks
generate comment:
def get_node_installer(node_install_info): """ Gets the correct node installer object based on the OS. :param node_install_info: node info of type NodeInstallInfo :return: node installer object for given OS type """ t_class = None if node_install_info.os_type in L...
def get_node_installer(node_install_info): t_class = None if node_install_info.os_type in LINUX_DISTROS: t_class = Linux elif node_install_info.os_type in MACOS_VERSIONS: t_class = Unix elif node_install_info.os_type in WINDOWS_SERVER: t_class...
generate comment.
def get_domain(self, win_info=None): """ Get the domain of the remote server. :param win_info: Windows info in case of windows server :return: domain of the remote server if found else None """ if win_info: o, _ = self.execute_batch_command('ipconfig') ...
def get_domain(self, win_info=None): if win_info: o, _ = self.execute_batch_command('ipconfig') """ remove empty element
give a code to
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
give python code to
def __init__(self): """ Creates an instance of RemoteMachineProcess class """ self.pid = '' self.name = '' self.vsz = 0 self.rss = 0 self.args = ''
Creates an instance of RemoteMachineProcess class
generate code for the following
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-bes...
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-bestpractice-cloud-ip
generate comment.
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: No...
def write_remote_file(self, remote_path, filename, lines): cmd = 'echo "%s" > %s/%s' % (''.join(lines), remote_path, filename) self.execute_command(cmd)
generate comment:
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)) se...
def cleanup_data_config(self, data_path): self.extract_remote_info() o, r = self.execute_command("rm -rf {0}/*".format(data_path)) self.log_command_output(o, r) o, r = self.execute_command( "rm -rf {0}/*".format(data_path.replace("data", "config"))) self.log_...
Code the following:
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 python code for
def is_enterprise(self): """ Check if the couchbase installed is enterprise edition or not Override method for Windows :return: True if couchbase installed is enterprise edition else False """ raise NotImplementedError
Check if the couchbase installed is enterprise edition or not Override method for Windows
generate python code for
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 code for the following
def copy_file_local_to_remote(self, src_path, des_path): """ Copy file from local to remote server :param src_path: source path of the file to be copied :param des_path: destination path of the file to be copied :return: True if the file was successfully copied else False ...
Copy file from local to remote server
generate code for 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 __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 above
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 :: {}" ...
def populate_debug_build_url(self): self.node_install_info.debug_build_url = self.__construct_build_url( is_debuginfo_build=True) self.log.info("{} - Debug build url :: {}" .format(self.node_install_info.server.ip, self.node_instal...
generate comment for following function:
def get_domain(self, win_info=None): """ Get the domain of the remote server. :param win_info: Windows info in case of windows server :return: domain of the remote server if found else None """ if win_info: o, _ = self.execute_batch_command('ipconfig') ...
def get_domain(self, win_info=None): if win_info: o, _ = self.execute_batch_command('ipconfig') """ remove empty element
generate doc string for following function:
def _parse_param(value): """ Parses the parameter to integers, floats, booleans and strings. The method tries to fit the value to integer, float, boolean in sequence. If the value fits, return the corresponding type of value, else return the string value as is. :param value: valu...
def _parse_param(value): try: return int(value) except ValueError: pass try: return float(value) except ValueError: pass if value.lower() == "false": return False if value.lower() == "true": ...
generate python code for
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)
Kill XDCR process on remote server
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
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 a code to
def rmtree(self, sftp, remote_path, level=0): """ Recursively remove all files and directories in the specified path tree. :param sftp: SFTP connection object :param remote_path: remote path to remove :param level: current level of the directory with respect to original directo...
Recursively remove all files and directories in the specified path tree.
generate comment for 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") se...
def start_server(self): o, r = self.execute_command("net start couchbaseserver") self.log_command_output(o, r)
generate comment.
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)
def stop_indexer(self): o, r = self.execute_command("taskkill /F /T /IM indexer*") self.log_command_output(o, r, debug=False)