instruction
stringclasses
14 values
output
stringlengths
105
12.9k
input
stringlengths
0
4.12k
generate comment for following function:
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: ...
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 python code for
def mount_partition_ext4(self, location): """ Mount a partition at the location specified :param location: Mount location :return: Output and error message from the mount command """ command = "mount -o loop,rw,usrquota,grpquota /usr/disk-img/disk-quota.ext4 {0}; df -Th...
Mount a partition at the location specified
give python 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
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
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
def __init__(self): """ Creates an instance of RemoteMachineProcess class """ self.pid = '' self.name = '' self.vsz = 0 self.rss = 0 self.args = ''
def __init__(self): self.pid = '' self.name = '' self.vsz = 0 self.rss = 0 self.args = ''
generate python code for 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.
from shell_util.shell_conn import ShellConnection def delete_info_for_server(server, ipaddr=None): """ Delete the info associated with the given server or ipaddr :param server: server to delete the info for :param ipaddr: ipaddr to delete the info for :return: None """ ...
Delete the info associated with the given server or ipaddr
generate 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]
Code 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.
def get_ip_address(self): """ Get ip address of a remote server Override method for Windows :return: ip address of remote server """ raise NotImplementedError
def get_ip_address(self): raise NotImplementedError
generate python code for the following
def wait_till_file_added(self, remotepath, filename, timeout_in_seconds=180): """ Wait until the remote file in remote path is created :param remotepath: remote path of the file to be created :param filename: name of the file to be created :param timeout_in_seconds: wait time i...
Wait until the remote file in remote path is created
generate 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 comment.
def check_directory_exists(self, remote_path): """ Check if the directory exists in the remote path :param remote_path: remote path of the directory to be checked :return: True if the directory exists else False """ sftp = self._ssh_client.open_sftp() try: ...
def check_directory_exists(self, remote_path): sftp = self._ssh_client.open_sftp() try: log.info("Checking if the directory {0} exists or not.".format(remote_path)) sftp.stat(remote_path) except IOError as e: log.info(f'Directory at {remote_path} DOES...
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
Code 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.
give a code to
def unpause_memcached(self, os="linux"): """ Unpauses the memcached process on remote server :param os: os type of remote server :return: None """ log.info("*** unpause memcached process ***") if self.nonroot: o, r = self.execute_command("killall -SI...
Unpauses the memcached process on remote server
generate python code for the above
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 doc string for following function:
def __init__(self): """ Creates an instance of the TestInputMembaseSetting class """ self.rest_username = '' self.rest_password = ''
def __init__(self): self.rest_username = '' self.rest_password = ''
generate doc string for following function:
def execute_batch_command(self, command): """ Execute a batch of commands. This method copies the commands onto a batch file, changes the file type to executable and then executes them on the remote server :param command: commands to execute in a batch :return: output of ...
def execute_batch_command(self, command): remote_command = "echo \"%s\" > /tmp/cmd.bat ; " \ "chmod u=rwx /tmp/cmd.bat; /tmp/cmd.bat" % command o, r = self.execute_command_raw(remote_command) if r and r!=['']: log.error("Command didn't run successful...
give a code to
def get_memcache_pid(self): """ Get the pid of memcached process :return: pid of memcached process """ raise NotImplementedError
Get the pid of memcached process
generate 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 for following function:
def main(logger): """ Main function of the installation script. :param logger: logger object to use :return: status code for the installation process """ helper = InstallHelper(logger) args = helper.parse_command_line_args(sys.argv[1:]) logger.setLevel(args.log_level.upper()) user_in...
def main(logger): helper = InstallHelper(logger) args = helper.parse_command_line_args(sys.argv[1:]) logger.setLevel(args.log_level.upper()) user_input = TestInputParser.get_test_input(args) for server in user_input.servers: server.install_status = "not_started" logger.info("Node ...
generate python code for the above
from shell_util.shell_conn import ShellConnection def delete_info_for_server(server, ipaddr=None): """ Delete the info associated with the given server or ipaddr :param server: server to delete the info for :param ipaddr: ipaddr to delete the info for :return: None """ ...
Delete the info associated with the given server or ipaddr
generate code for the above:
def ram_stress(self, stop_time): """ Applies memory stress for a specified duration with 3 workers each of size 2.5G. :param stop_time: duration to apply the memory stress for. :return: None """ o, r = self.execute_command("stress --vm 3 --vm-bytes 2.5G --timeout {}".f...
Applies memory stress for a specified duration with 3 workers each of size 2.5G.
def wait_till_file_added(self, remotepath, filename, timeout_in_seconds=180): """ Wait until the remote file in remote path is created :param remotepath: remote path of the file to be created :param filename: name of the file to be created :param timeout_in_seconds: wait time i...
Wait until the remote file in remote path is created
generate comment for following function:
def start_memcached(self): """ Start memcached process on remote server :return: None """ o, r = self.execute_command("kill -SIGCONT $(pgrep memcached)") self.log_command_output(o, r, debug=False)
def start_memcached(self): o, r = self.execute_command("kill -SIGCONT $(pgrep memcached)") self.log_command_output(o, r, debug=False)
give a code to
def 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) ...
Runs the NodeInstaller thread to run various installation steps in the remote server
generate comment for above
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.listdir(src_p...
def copy_files_local_to_remote(self, src_path, des_path): files = os.listdir(src_path) self.log.info("copy files from {0} to {1}".format(src_path, des_path)) # self.execute_batch_command("cp -r {0}/* {1}".format(src_path, des_path)) for file in files: if file.find("...
generate comment for above
def stop_couchbase(self, num_retries=5, poll_interval=10): """ Stop couchbase service on remote server :param num_retries: Number of times to retry stopping couchbase :param poll_interval: interval between each retry attempt :return: None """ o, r = self.execute_c...
def stop_couchbase(self, num_retries=5, poll_interval=10): o, r = self.execute_command("net stop couchbaseserver") self.log_command_output(o, r) is_server_stopped = False retries = num_retries while not is_server_stopped and retries > 0: self.sleep(poll_inter...
def start_membase(self): """ Start membase process on remote server :return: None """ o, r = self.execute_command("net start membaseserver") self.log_command_output(o, r)
def start_membase(self): o, r = self.execute_command("net start membaseserver") self.log_command_output(o, r)
generate doc string for following function:
def execute_batch_command(self, command): """ Execute a batch of commands. This method copies the commands onto a batch file, changes the file type to executable and then executes them on the remote server :param command: commands to execute in a batch :return: output of ...
def execute_batch_command(self, command): remote_command = "echo \"%s\" > /tmp/cmd.bat ; " \ "chmod u=rwx /tmp/cmd.bat; /tmp/cmd.bat" % command o, r = self.execute_command_raw(remote_command) if r and r!=['']: log.error("Command didn't run successful...
generate code for the above:
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 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 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
def enable_packet_loss(self): """ Changes network to lose 25% of packets using traffic control This is used to simulate a network environment where approximately 25% of packets are lost. :return: None """ o, r = self.execute_command("tc qdisc add dev eth0 root netem los...
Changes network to lose 25% of packets using traffic control This is used to simulate a network environment where approximately 25% of packets are lost.
def 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 code for the above:
def wait_for_couchbase_started(self, num_retries=5, poll_interval=5, message="Waiting for couchbase startup finish."): """ Waits for Couchbase server to start within the specified timeout period. :param num_retries: Number of times to wait for the Couchbase s...
Waits for Couchbase server to start within the specified timeout period.
generate comment for above
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( ...
def get_mem_usage_by_process(self, process_name): output, error = self.execute_command( 'ps -e -o %mem,cmd|grep {0}'.format(process_name), debug=False) if output: for line in output: if not 'grep' in line.strip().split(' '): ...
Code the following:
def get_instances(cls): """ Returns a list of instances of the class :return: generator that yields instances of the class """ for ins in cls.__refs__: yield ins
Returns a list of instances of the class
give python code to
def is_couchbase_installed(self): """ Check if Couchbase is installed on the remote server. This checks if the couchbase is installed in default or non default path. :return: True if Couchbase is installed on the remote server else False """ output, error = self.execute...
Check if Couchbase is installed on the remote server. This checks if the couchbase is installed in default or non default path.
Code the following:
def kill_cbft_process(self): """ Kill the full text search process on remote server :return: output and error of command killing FTS process """ o, r = self.execute_command("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.
generate python code for the above
from shell_util.shell_conn import ShellConnection def __new__(cls, *args, **kwargs): """ Create a new RemoteMachineShellConnection instance with given parameters. """ server = args[0] if server.ip in RemoteMachineShellConnection.__info_dict: info = RemoteMachineShell...
Create a new RemoteMachineShellConnection instance with given parameters.
generate python code for the above
def change_system_time(self, time_change_in_seconds): """ Change the system time by specified number of seconds Note that time change may be positive or negative :param time_change_in_seconds: number of seconds to change the system time by :return: True if change was successful...
Change the system time by specified number of seconds Note that time change may be positive or negative
generate comment:
def kill_memcached(self, num_retries=10, poll_interval=2): """ Kill memcached process on remote server :param num_retries: number of times to retry killing the memcached process :param poll_interval: time to wait before each retry in seconds :return: output and error of command k...
def kill_memcached(self, num_retries=10, poll_interval=2): # Changed from kill -9 $(ps aux | grep 'memcached' | awk '{print $2}' # as grep was also returning eventing # process which was using memcached-cert o, r = self.execute_command("kill -9 $(ps aux | pgrep 'memcached')" ...
give a code to
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): ...
generate python code for the following
def start_memcached(self): """ Start memcached process on remote server :return: None """ o, r = self.execute_command("kill -SIGCONT $(pgrep memcached)") self.log_command_output(o, r, debug=False)
Start memcached process on remote server
generate doc string 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...
generate comment for following function:
def __init__(self, test_server, info=None): """ Creates a new shell connection for Unix based platforms :param test_server: test server to create the shell connection for :param info: None """ super(Unix, self).__init__(test_server) self.nonroot = False se...
def __init__(self, test_server, info=None): super(Unix, self).__init__(test_server) self.nonroot = False self.info = info
generate python code for
def wait_for_couchbase_started(self, num_retries=5, poll_interval=5, message="Waiting for couchbase startup finish."): """ Waits for Couchbase server to start within the specified timeout period. :param num_retries: Number of times to wait for the Couchbase s...
Waits for Couchbase server to start within the specified timeout period.
Code 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 for following function:
def get_ram_info(self, win_info=None, mac=False): """ Get the RAM info of the remote server :param win_info: Windows info in case of windows :param mac: Get info for macOS if True :return: RAM info of the remote server if found else None """ if win_info: ...
def get_ram_info(self, win_info=None, mac=False): if win_info: if 'Virtual Memory Max Size' not in win_info: win_info = self.create_windows_info() o = "Virtual Memory Max Size =" \ + win_info['Virtual Memory Max Size'] + '\n' \ + "...
generate code for the following
def __repr__(self): """ Returns a string representation of the TestInputServer object with ip, port and ssh_username :return: A string representation of the TestInputServer object """ #ip_str = "ip:{0}".format(self.ip) ip_str = "ip:{0} port:{1}".format(self.ip, self.por...
Returns a string representation of the TestInputServer object with ip, port and ssh_username
generate comment for following function:
def list_files(self, remote_path): """ List files in remote machine for a given directory :param remote_path: path of the directory to list :return: List of file paths found in remote machine and directory """ if self.remote: sftp = self._ssh_client.open_sftp(...
def list_files(self, remote_path): if self.remote: sftp = self._ssh_client.open_sftp() files = [] try: file_names = sftp.listdir(remote_path) for name in file_names: files.append({'path': remote_path, 'file': name})...
give python code to
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
generate code for the above:
def change_port_static(self, new_port): """ Change Couchbase ports for rest, mccouch, memcached, capi to new port :param new_port: new port to change the ports to :return: None """ # ADD NON_ROOT user config_details log.info("=========CHANGE PORTS for REST: %s, ...
Change Couchbase ports for rest, mccouch, memcached, capi to new port
generate code for 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
generate code for the above:
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
give a code to
def get_cbversion(self): """ Get the installed version of Couchbase Server installed on the remote server. This gets the versions from both default path or non-default paths. Returns in format fv = a.b.c-xxxx, sv = a.b.c, bn = xxxx :return: full version, main version and the bu...
Get the installed version of Couchbase Server installed on the remote server. This gets the versions from both default path or non-default paths. Returns in format fv = a.b.c-xxxx, sv = a.b.c, bn = xxxx
generate python code for the above
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
generate python code for
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 python code for the above
import json import re from urllib.request import urlopen from install_util.constants.build import BuildUrl 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 ...
Update the BuildUrl with all versions of Couchbase Server currently available for testing. This method gets the current versions of Couchbase Servers available from the CB server manifest and updates the missing versions in BuildUrl constants accordingly.
generate python code for the following
import time from time import sleep def monitor_process(self, process_name, duration_in_seconds=120): """ Monitor the given process till the given duration to check if it crashed or restarted :param process_name: the name of the process to monitor :param duration_in_seconds: the duration...
Monitor the given process till the given duration to check if it crashed or restarted
generate python code for the following
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 the above
import urllib.request def download_build_locally(self, build_url): """ Downloads the Couchbase build locally :param build_url: Download url to download the build from :return: tuple containing the path to the download build file as well as the resulting HTTPMessage object. """ ...
Downloads the Couchbase build locally
generate python code for
def restart_couchbase(self): """ Restarts the Couchbase server on the remote server :return: None """ o, r = self.execute_command("service couchbase-server restart") self.log_command_output(o, r)
Restarts the Couchbase server on the remote server
generate comment:
def reset_env_variables(self): """ Reset environment previously set and restart couchbase server :return: None """ shell = self._ssh_client.invoke_shell() init_file = "service_start.bat" file_path = "/cygdrive/c/Program\ Files/Couchbase/Server/bin/" backup...
def reset_env_variables(self): shell = self._ssh_client.invoke_shell() init_file = "service_start.bat" file_path = "/cygdrive/c/Program\ Files/Couchbase/Server/bin/" backupfile = file_path + init_file + ".bak" sourceFile = file_path + init_file o, r = self.execut...
generate comment:
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 ...
def windows_process_utils(self, ps_name_or_id, cmd_file_name, option=""): success = False files_path = "cygdrive/c/utils/suspend/" # check to see if suspend files exist in server file_existed = self.file_exists(files_path, cmd_file_name) if file_existed: comm...
give a code to
def diag_eval(self, diag_eval_command): """ Executes a diag eval command on remote server :param diag_eval_command: diag eval command to execute e.g. "gen_server:cast(ns_cluster, leave)." :return: None """ self.execute_command( "curl -X POST localhos...
Executes a diag eval command on remote server
generate code for the following
def cleanup_all_configuration(self, data_path): """ Deletes the contents of the parent folder that holds the data and config directories. Override method for Windows :param data_path: The path key from the /nodes/self end-point which looks something like "/opt/couchbase/var/lib...
Deletes the contents of the parent folder that holds the data and config directories. Override method for Windows
give python 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 python code for the following
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 ...
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 not important, and we return True
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 =...
Code the following:
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 comment:
def change_env_variables(self, dict): """ Change environment variables mentioned in dictionary and restart Couchbase server :param dict: key value pair of environment variables and their values to change to :return: None """ prefix = "\\n " shell = self._ssh_cl...
def change_env_variables(self, dict): prefix = "\\n " shell = self._ssh_client.invoke_shell() init_file = "couchbase-server" file_path = "/opt/couchbase/bin/" environmentVariables = "" backupfile = file_path + init_file + ".bak" sourceFile = file_path ...
give a code to
def diag_eval(self, diag_eval_command): """ Executes a diag eval command on remote server :param diag_eval_command: diag eval command to execute e.g. "gen_server:cast(ns_cluster, leave)." :return: None """ self.execute_command( "curl -X POST localhos...
Executes a diag eval command on remote server
give a code to
def get_mem_usage_by_process(self, process_name): """ Get the memory usage of a process :param process_name: name of the process to get the memory usage for :return: the memory usage of the process if available else None """ output, error = self.execute_command( ...
Get the memory usage of a process
generate comment for following function:
def populate_build_url(self): """ Populates the build url variable. :return: None """ self.node_install_info.build_url = self.__construct_build_url() self.log.info("{} - Build url :: {}" .format(self.node_install_info.server.ip, ...
def populate_build_url(self): self.node_install_info.build_url = self.__construct_build_url() self.log.info("{} - Build url :: {}" .format(self.node_install_info.server.ip, self.node_install_info.build_url))
Code the following:
def __init__(self): """ Creates an instance of the TestInputBuild class """ self.version = '' self.url = ''
Creates an instance of the TestInputBuild class
give python code to
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 doc string for following function:
def install(self, build_url): """ Installs Couchbase server on Unix machine :param build_url: build url to get the Couchbase package from :return: True on successful installation else False """ cmd = self.cmds["install"] if self.shell.nonroot: cmd = se...
def install(self, build_url): cmd = self.cmds["install"] if self.shell.nonroot: cmd = self.non_root_cmds["install"] f_name = build_url.split("/")[-1] cmd = cmd.replace("buildpath", "{}/{}" .format(self.download_dir, f_name)) self.she...
generate code for the above:
from time import sleep def sleep(seconds, msg=""): """ Sleep for specified number of seconds. Optionally log a message given :param seconds: number of seconds to sleep for :param msg: optional message to log :return: None """ if msg: log.info(msg) ...
Sleep for specified number of seconds. Optionally log a message given
generate python code for the above
import os def stop_current_python_running(self, mesg): """ Stop the current python process that's running this script. :param mesg: message to display before killing the process :return: None """ os.system("ps aux | grep python | grep %d " % os.getpid()) log.info...
Stop the current python process that's running this script.
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
def get_hostname(self): """ Get the hostname of the remote server. :return: hostname of the remote server if found else None """ o, r = self.execute_command_raw('hostname', debug=False) if o: return o
Get the hostname of the remote server.
generate code for the following
def disable_file_limit_desc(self): """ Change the file limit for all processes to 1606494 :return: """ o, r = self.execute_command("sysctl -w fs.file-max=1606494;sysctl -p") self.log_command_output(o, r)
Change the file limit for all processes to 1606494
generate comment for above
def start_indexer(self): """ Start indexer process on remote server :return: None """ o, r = self.execute_command("taskkill /F /T /IM indexer*") self.log_command_output(o, r)
def start_indexer(self): o, r = self.execute_command("taskkill /F /T /IM indexer*") self.log_command_output(o, r)
generate python code for
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
generate python code for the following
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
Code the following:
def change_log_level(self, new_log_level): """ Change the log level of couchbase processes on a remote server :param new_log_level: new log level to set :return: None """ log.info("CHANGE LOG LEVEL TO %s".format(new_log_level)) # ADD NON_ROOT user config_details...
Change the log level of couchbase processes on a remote server
generate 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 code for the above:
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 comment for following function:
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 python code for
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.
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 python code for
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:
def wait_till_file_deleted(self, remotepath, filename, timeout_in_seconds=180): """ Wait until the remote file in remote path is deleted :param remotepath: remote path of the file to be deleted :param filename: name of the file to be deleted :param timeout_in_seconds: wait time i...
def wait_till_file_deleted(self, remotepath, filename, timeout_in_seconds=180): end_time = time.time() + float(timeout_in_seconds) deleted = False log.info("file {0} checked at {1}".format(filename, remotepath)) while time.time() < end_time and not deleted: # get the...
generate python code for the following
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
from typing import re def _recover_disk_full_failure(self, location): """ Recover the disk full failures on remote server :param location: location of the disk to recover :return: output and error message from recovering disk """ delete_file = "{0}/disk-quota.ext3".forma...
Recover the disk full failures on remote server