instruction
stringclasses
14 values
output
stringlengths
105
12.9k
input
stringlengths
0
4.12k
def is_couchbase_installed(self): """ Check if Couchbase is installed on the remote server. This checks if the couchbase is installed in default or non default path. :return: True if Couchbase is installed on the remote server else False """ if self.nonroot: ...
Check if Couchbase is installed on the remote server. This checks if the couchbase is installed in default or non default path.
generate comment:
def populate_build_url(self): """ Populates the build url variable. :return: None """ self.node_install_info.build_url = self.__construct_build_url() self.log.info("{} - Build url :: {}" .format(self.node_install_info.server.ip, ...
def populate_build_url(self): self.node_install_info.build_url = self.__construct_build_url() self.log.info("{} - Build url :: {}" .format(self.node_install_info.server.ip, self.node_install_info.build_url))
Code the following:
def __init__(self, logger): """ Creates an instance of InstallHelper object :param logger: logger object """ self.log = logger
Creates an instance of InstallHelper object
generate python code for
from shell_util.remote_connection import RemoteMachineShellConnection def check_server_state(self, servers): """ Checks if the servers are reachable :param servers: list of servers to check :return: True if the servers are all reachable else False """ result = True ...
Checks if the servers are reachable
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 python code for the following
def restart_couchbase(self): """ Restarts the Couchbase server on the remote server :return: None """ o, r = self.execute_command("net stop couchbaseserver") self.log_command_output(o, r) o, r = self.execute_command("net start couchbaseserver") self.log_...
Restarts the Couchbase server on the remote server
generate comment for following function:
def get_ram_info(self, win_info=None, mac=False): """ Get ram info of a remote server :param win_info: windows info :param mac: get ram info from macOS if True :return: ram info of remote server """ if win_info: if 'Virtual Memory Max Size' not in win_...
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' o += "Virtual Memory Availa...
give a code to
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(locati...
Unmount the partition at the specified location.
generate doc string for following function:
def kill_memcached(self, num_retries=10, poll_interval=2): """ Kill memcached process on remote server :param num_retries: number of times to retry killing the memcached process :param poll_interval: time to wait before each retry in seconds :return: output and error of command k...
def kill_memcached(self, num_retries=10, poll_interval=2): # Changed from kill -9 $(ps aux | grep 'memcached' | awk '{print $2}' # as grep was also returning eventing # process which was using memcached-cert o, r = self.execute_command("kill -9 $(ps aux | pgrep 'memcached')", ...
generate python code for the above
def pause_memcached(self, timesleep=30, delay=0): """ Pauses the memcached process on remote server :param timesleep: time to wait after pause (in seconds) :param delay: time to delay pause of memcached process (in seconds) :return: None """ log.info("*** pause ...
Pauses the memcached process on remote server
generate code for the above:
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
generate doc string for following function:
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" ...
give python code to
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 following
def get_ram_info(self, win_info=None, mac=False): """ Get ram info of a remote server :param win_info: windows info :param mac: get ram info from macOS if True :return: ram info of remote server """ if win_info: if 'Virtual Memory Max Size' not in wi...
Get ram info of a remote server
generate python code for the above
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 ...
Creats an instance of the NodeInstallInfo class.
Code the following:
def install(self, build_url): """ Installs Couchbase server on Unix machine :param build_url: build url to get the Couchbase package from :return: True on successful installation else False """ cmd = self.cmds["install"] if self.shell.nonroot: cmd = ...
Installs Couchbase server on Unix machine
generate comment for above
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 statistics...
def get_process_statistics_parameter(self, parameter, process_name=None, process_pid=None): if not parameter: self.log.error("parameter cannot be None") parameters_list = self.get_process_statistics(process_name, process_pid) if not ...
generate code for the above:
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 following
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)) sel...
Disables read-only mode for the specified disk location.
def get_processes_binding_to_ip_family(self, ip_family="ipv4"): """ Get all the processes binding to a particular ip family Override method for Windows :param ip_family: ip family to get processes binding of :return: list of processes binding to ip family """ if i...
def get_processes_binding_to_ip_family(self, ip_family="ipv4"): if ip_family == "ipv4": ip_family = "tcp" else: ip_family = "tcpv6" output_win, error = self.execute_command( "netstat -a -b -p {0} | grep exe | sort | uniq | sed \'s/\[//g; s/\]//g;\'". ...
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 python code for 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
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] ...
def install(self, build_url): cmd = self.cmds["install"] f_name = build_url.split("/")[-1] cmd = cmd.replace("buildpath", "{}/{}" .format(self.download_dir, f_name)) self.shell.execute_command(cmd) output, err = self.shell.execute_command(cmd) ...
generate code for 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
def configure_log_location(self, new_log_location): """ Configure the log location for Couchbase server on remote server :param new_log_location: path to new location to store logs :return: None """ mv_logs = testconstants.LINUX_LOG_PATH + '/' + new_log_location ...
Configure the log location for Couchbase server on remote server
generate python code for the following
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: ...
Get the RAM info of the remote server
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 comment for above
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 for above
def create_new_partition(self, location, size=None): """ Create a new partition at the location specified and of the size specified :param location: Location to create the new partition at. :param size: Size of the partition in MB :return: None """ command...
def create_new_partition(self, location, size=None): command = "umount -l {0}".format(location) output, error = self.execute_command(command) command = "rm -rf {0}".format(location) output, error = self.execute_command(command) command = "rm -rf /usr/disk-img/disk-quota....
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 python code to
def create_new_partition(self, location, size=None): """ Create a new partition at the location specified and of the size specified :param location: Location to create the new partition at. :param size: Size of the partition in MB :return: None """ comma...
Create a new partition at the location specified and of the size specified
generate python code for the following
def create_multiple_dir(self, dir_paths): """ This function will remove the automation directory in windows and create directory in the path specified in dir_paths :param dir_paths: list of paths to create the directories :return: None """ sftp = self._ssh_clien...
This function will remove the automation directory in windows and create directory in the path specified in dir_paths
generate python code for the following
def terminate_process(self, info=None, process_name=None, force=False): """ Terminate a list of processes on remote server :param info: None :param p_list: List of processes to terminate :return: None """ if not process_name: log.info("Please specify...
Terminate a list of processes on remote server
generate comment for above
def run(self): """ Runs the NodeInstaller thread to run various installation steps in the remote server :return: None """ installer = InstallSteps(self.log, self.node_install_info) node_installer = installer.get_node_installer( self.node_install_info) ...
def run(self): installer = InstallSteps(self.log, self.node_install_info) node_installer = installer.get_node_installer( self.node_install_info) for step in self.steps: self.log.info("{} - Running '{}'" .format(self.node_install_info.ser...
generate python code for
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 comment.
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)
def start_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 following
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("open /Applications/Couchbase\ Server...
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 stop_couchbase(self, num_retries=5, poll_interval=10): """ Stop couchbase service on remote server :param num_retries: None :param poll_interval: None :return: None """ if self.nonroot: log.info("Stop Couchbase Server with non root method") ...
def stop_couchbase(self, num_retries=5, poll_interval=10): if self.nonroot: log.info("Stop Couchbase Server with non root method") o, r = self.execute_command( '%s%scouchbase-server -k' % (self.nr_home_path, LINUX_COUC...
generate comment:
def pause_memcached(self, timesleep=30, delay=0): """ Pauses the memcached process on remote server :param timesleep: time to wait after pause (in seconds) :param delay: time to delay pause of memcached process (in seconds) :return: None """ log.info("*** pause me...
def pause_memcached(self, timesleep=30, delay=0): log.info("*** pause memcached process ***") if delay: time.sleep(delay) if self.nonroot: o, r = self.execute_command("killall -SIGSTOP memcached.bin") else: o, r = self.execute_command("killall...
generate comment:
def write_remote_file_single_quote(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. ...
def write_remote_file_single_quote(self, remote_path, filename, lines): cmd = 'echo \'%s\' > %s/%s' % (''.join(lines), remote_path, filename) self.execute_command(cmd)
generate code for the following
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.
Code the following:
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
give python code to
from shell_util.shell_conn import ShellConnection def get_info_for_server(server): """ Get info about given server, if available :param server: server to get the information of :return: information of the server if available else None """ if server.ip in RemoteMachineShe...
Get info about given server, if available
generate code for the following
def terminate_processes(self, info, p_list): """ Terminate a list of processes on remote server Override for Unix systems :param info: None :param p_list: List of processes to terminate :return: None """ raise NotImplementedError
Terminate a list of processes on remote server Override for Unix systems
generate python code for
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
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 python code for the above
def __init__(self, logger, node_install_info, steps): """ Creates an instance of the NodeInstaller object. This object is used to install Couchbase server builds on remote servers. :param logger: logger object for logging :param node_install_info: node install info of type Node...
Creates an instance of the NodeInstaller object. This object is used to install Couchbase server builds on remote servers.
give python code to
def kill_erlang(self, os="unix", 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 """ ...
Kill the erlang process in the remote server. If delay is specified, the process is killed after the delay
generate code for the above:
def is_couchbase_installed(self): """ Check if Couchbase is installed on the remote server. This checks if the couchbase is installed in default or non default path. :return: True if Couchbase is installed on the remote server else False """ output, error = self.execute...
Check if Couchbase is installed on the remote server. This checks if the couchbase is installed in default or non default path.
def log_command_output(self, output, error, track_words=(), debug=True): """ Check for errors and tracked words in the output success means that there are no track_words in the output and there are no errors at all, if track_words is not empty if track_words=(), the result is no...
def log_command_output(self, output, error, track_words=(), debug=True): success = True for line in error: if debug: self.log.error(line) if track_words: if "Warning" in line and "hugepages" in line: self.log.info( ...
generate python code for the following
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
generate code for the following
import re import configparser def parse_from_file(file): """ Parse the test inputs from file :param file: path to file to parse :return: TestInput object """ count = 0 start = 0 end = 0 servers = list() ips = list() input = TestInp...
Parse the test inputs from file
give python code to
def pause_memcached(self, timesleep=30, delay=0): """ Pauses the memcached process on remote server Override method for Windows :param timesleep: time to wait after pause (in seconds) :param delay: time to delay pause of memcached process (in seconds) :return: None ...
Pauses the memcached process on remote server Override method for Windows
generate code for the following
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
generate comment.
def log_command_output(self, output, error, track_words=(), debug=True): """ Check for errors and tracked words in the output success means that there are no track_words in the output and there are no errors at all, if track_words is not empty if track_words=(), the result is no...
def log_command_output(self, output, error, track_words=(), debug=True): success = True for line in error: if debug: self.log.error(line) if track_words: if "Warning" in line and "hugepages" in line: self.log.info( ...