instruction
stringclasses
14 values
output
stringlengths
105
12.9k
input
stringlengths
0
4.12k
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("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.
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
def get_process_id(self, process_name): raise NotImplementedError
generate comment:
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(mesg) ...
def stop_current_python_running(self, mesg): os.system("ps aux | grep python | grep %d " % os.getpid()) log.info(mesg) self.sleep(5, "==== delay kill pid %d in 5 seconds to printout message ==="\ % os.getpid()) ...
generate python code for
def pause_beam(self): """ Pauses the beam.smp process on remote server Override method for Windows :return: None """ raise NotImplementedError
Pauses the beam.smp process on remote server Override method for Windows
generate 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
give python 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 following
def cleanup_data_config(self, data_path): """ Cleans up the data config directory and its contents Override method for Windows :param data_path: path to data config directory :return: None """ if "c:/Program Files" in data_path: data_path = data_path...
Cleans up the data config directory and its contents Override method for Windows
give python code to
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 specifi...
Override method to handle windows specific file name
generate comment for above
def kill_erlang(self, delay=0): """ Kill the erlang process in the remote server. If delay is specified, the process is killed after the delay :param delay: time to delay the process kill :return: output and error of executing process kill command """ if delay: ...
def kill_erlang(self, delay=0): if delay: time.sleep(delay) o, r = self.execute_command("killall -9 beam.smp") if r and r[0] and "command not found" in r[0]: o, r = self.execute_command("pkill beam.smp") self.log_command_output(o, r) self.log_...
generate comment for following function:
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 = [] ...
def handle_command_line_s(argument): #ip:port:username:password:clipath ips = argument.split(",") servers = [] for ip in ips: server = TestInputServer() if ip.find(":") == -1: pass else: info = ip.split(":") ...
generate code for the above:
def restart_couchbase(self): """ Restarts the Couchbase server on the remote server :return: None """ o, r = self.execute_command("open /Applications/Couchbase\ Server.app") self.log_command_output(o, r)
Restarts the Couchbase server on the remote server
generate comment for following function:
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 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...
Change the directory permission of the location mentioned to include couchbase as the user
def copy_build_to_server(self, node_installer, build_url): """ Copies the downloaded Couchbase build from local to remote server :param node_installer: node installer object :param build_url: build url to download the Couchbase build from. This is used to get the file name to sto...
def copy_build_to_server(self, node_installer, build_url): f_path = "{}/{}".format(".", build_url.split('/')[-1]) result = node_installer.shell.copy_file_local_to_remote( f_path, node_installer.shell.download_dir) node_installer.shell.disconnect() return result
generate python code for
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.
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 the following
def get_memcache_pid(self): """ Get the pid of memcached process :return: pid of memcached process """ raise NotImplementedError
Get the pid of memcached process
generate python code for the above
def __init__(self): """ Creates an instance of the TestInputBuild class """ self.version = '' self.url = ''
Creates an instance of the TestInputBuild class
generate code for the above:
def kill_eventing_process(self, name): """ Kill eventing process on remote server :param name: name of eventing process :return: None """ o, r = self.execute_command(command="killall -9 {0}".format(name)) self.log_command_output(o, r)
Kill eventing process on remote server
give a code to
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
from shell_util.remote_connection import RemoteMachineShellConnection def __init__(self, test_server): """ Creates an instance of Linux installer class :param test_server: server object of type TestInputServer """ super(Linux, self).__init__() self.shell = RemoteMachineS...
Creates an instance of Linux installer class
generate doc string for following function:
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
def get_hostname(self): o, r = self.execute_command_raw('hostname', debug=False) if o: return o
Code the following:
def cleanup_data_config(self, data_path): """ Cleans up the data config directory and its contents :param data_path: path to data config directory :return: None """ self.extract_remote_info() o, r = self.execute_command("rm -rf {0}/*".format(data_path)) ...
Cleans up the data config directory and its contents
Code the following:
def flush_os_caches(self): """ Flush OS caches on remote server :return: None """ o, r = self.execute_command("sync") self.log_command_output(o, r) o, r = self.execute_command("/sbin/sysctl vm.drop_caches=3") self.log_command_output(o, r)
Flush OS caches on remote server
def stop_indexer(self): """ Stop indexer process on remote server :return: None """ o, r = self.execute_command("taskkill /F /T /IM indexer*") self.log_command_output(o, r, debug=False)
Stop indexer process on remote server
def uninstall(self): """ Uninstalls Couchbase server on Unix machine :return: True on success """ self.shell.stop_couchbase() cmd = self.cmds["uninstall"] if self.shell.nonroot: cmd = self.non_root_cmds["uninstall"] self.shell.execute_command(c...
def uninstall(self): self.shell.stop_couchbase() cmd = self.cmds["uninstall"] if self.shell.nonroot: cmd = self.non_root_cmds["uninstall"] self.shell.execute_command(cmd) return True
def unpause_memcached(self, os="linux"): """ Unpauses the memcached process on remote server :param os: os type of remote server :return: None """ log.info("*** unpause memcached process ***") if self.nonroot: o, r = self.execute_command("killall -SI...
Unpauses the memcached process on remote server
def stop_membase(self, num_retries=10, poll_interval=1): """ Stop membase process on remote server :param num_retries: number of retries before giving up :param poll_interval: wait time between each retry. :return: None """ o, r = self.execute_command("net stop me...
def stop_membase(self, num_retries=10, poll_interval=1): o, r = self.execute_command("net stop membaseserver") self.log_command_output(o, r) o, r = self.execute_command("net stop couchbaseserver") self.log_command_output(o, r) retries = num_retries while retries ...
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 connect_with_user(self, user="root"): """ Connect to the remote server with given user Override method since this is not required for Unix :param user: user to connect to remote server with :return: None """ return
Connect to the remote server with given user Override method since this is not required for Unix
generate code for the following
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 ...
Get disk info of a remote server
give python code to
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 execute_non_sudo_command(self, command, info=None, debug=True, use_channel=False): """ Execute command in non-sudo mode. :param command: command to be executed :param info: None :param debug: print debug information in logs if True :pa...
def execute_non_sudo_command(self, command, info=None, debug=True, use_channel=False): return self.execute_command_raw(command, debug=debug, use_channel=use_channel)
generate doc string for following function:
def 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_c...
def is_couchbase_installed(self): output, error = self.execute_command('ls %s%s' % (self.cb_path, self.version_file)) self.log_command_output(output, error) for line in output: if line.find('No such file or directory'...
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
give a code to
def enable_file_limit_desc(self): """ Change the file limit for all processes to 100 :return: None """ o, r = self.execute_command("sysctl -w fs.file-max=100;sysctl -p") self.log_command_output(o, r)
Change the file limit for all processes to 100
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. :param data_path: The path key from the /nodes/self end-point which looks something like "/opt/couchbase/var/lib/couchbase/data" on Linux or...
Deletes the contents of the parent folder that holds the data and config directories.
generate comment for above
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)
def reboot_node(self): o, r = self.execute_command("shutdown -r -f -t 0") self.log_command_output(o, r)
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 a code to
def alt_addr_add_node(self, main_server=None, internal_IP=None, server_add=None, user="Administrator", passwd="password", services="kv", cmd_ext=""): """ Add node to couchbase cluster using alternative address :param main_server: couchbase cl...
Add node to couchbase cluster using alternative address
generate code for the 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.
generate python code for
def file_starts_with(self, remotepath, pattern): """ Check if file starting with this pattern is present in remote machine. :param remotepath: path of the file to check :param pattern: pattern to check against :return: True if file starting with this pattern is present in remot...
Check if file starting with this pattern is present in remote machine.
give python code to
def pause_beam(self): """ Pauses the beam.smp process on remote server Override method for Windows :return: None """ raise NotImplementedError
Pauses the beam.smp process on remote server Override method for Windows
generate doc string for following function:
def terminate_processes(self, info, p_list): """ Terminate a list of processes on remote server :param info: None :param p_list: List of processes to terminate :return: None """ for process in p_list: self.terminate_process(info, process, force=True)
def terminate_processes(self, info, p_list): for process in p_list: self.terminate_process(info, process, force=True)
generate python code for the above
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 comment for following function:
def stop_schedule_tasks(self): """ Stop the scheduled tasks. Stops installme, removeme and upgrademe processes on remote server :return: None """ self.log.info("STOP SCHEDULE TASKS: installme, removeme & upgrademe") for task in ["installme", "removeme", "upgrademe"]: ...
def stop_schedule_tasks(self): self.log.info("STOP SCHEDULE TASKS: installme, removeme & upgrademe") for task in ["installme", "removeme", "upgrademe"]: output, error = self.execute_command("cmd /c schtasks /end /tn %s" % task) ...
generate code for the following
def validate_server_status(self, node_helpers): """ Checks if the servers are supported OS for Couchbase installation :param node_helpers: list of node helpers of type NodeInstallInfo :return: True if the servers are supported OS for Couchbase installation else False """ ...
Checks if the servers are supported OS for Couchbase installation
give a code to
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 a code to
def execute_cbcollect_info(self, file, options=""): """ Execute cbcollect command on remote server :param file: file name to store the cbcollect as :param options: options for the cbcollect command :return: output of the cbcollect command """ cbcollect_command =...
Execute cbcollect command on remote server
generate code for the above:
def stop_memcached(self): """ Stop memcached process on remote server :return: None """ o, r = self.execute_command("taskkill /F /T /IM memcached*") self.log_command_output(o, r, debug=False)
Stop memcached process on remote server
give python code to
def reset_env_variables(self): """ Reset environment previously set and restart couchbase server :return: None """ shell = self._ssh_client.invoke_shell() if getattr(self, "info", None) is None: self.info = self.extract_remote_info() init_file = "cou...
Reset environment previously set and restart couchbase server
generate code for the above:
def get_process_statistics(self, process_name=None, process_pid=None): """ Get the process statistics for given parameter Gets process statistics for windows nodes WMI is required to be intalled on the node stats_windows_helper should be located on the node :param param...
Get the process statistics for given parameter Gets process statistics for windows nodes WMI is required to be intalled on the node stats_windows_helper should be located on the node
generate code for the above:
import sys from install_util.constants.build import BuildUrl from install_util.install_lib.helper import InstallHelper from install_util.install_lib.node_helper import NodeInstaller from install_util.install_lib.node_helper import NodeInstallInfo from install_util.test_input import TestInputParser from shell_util.remot...
Main function of the installation script.
generate doc string for following function:
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 python code for
def check_build_url_status(self): """ Checks the build url status. Checks if the url is reachable and valid. :return: None """ self.check_url_status(self.node_install_info.build_url)
Checks the build url status. Checks if the url is reachable and valid.
generate python code for
def stop_membase(self): """ Override method """ raise NotImplementedError
Override method
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 enable_disk_readonly(self, disk_location): """ Enables read-only mode for the specified disk location. :param disk_location: disk location to enable read-only mode. :return: None """ o, r = self.execute_command("chmod -R 444 {}".format(disk_location)) self.l...
Enables read-only mode for the specified disk location.
give python code to
def delete_files(self, file_location, debug=False): """ Delete the files in the specified location :param file_location: path to files to delete :param debug: print debug information if True :return: None """ command = "%s%s" % ("rm -rf ", file_location) ...
Delete the files in the specified location
generate python code for
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 comment for following function:
def pause_beam(self): """ Pauses the beam.smp process on remote server Override method for Windows :return: None """ raise NotImplementedError
def pause_beam(self): raise NotImplementedError
generate python code for
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)
Kill eventing process on remote server
generate code for the following
def kill_eventing_process(self, name): """ Kill eventing process on remote server :param name: name of eventing process :return: None """ o, r = self.execute_command(command="killall -9 {0}".format(name)) self.log_command_output(o, r)
Kill eventing process on remote server
give a code to
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
generate comment for above
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() environmentVariables = "" init_file = "service_start.bat" file_path = "\"/cygdrive/c/Program Files/Couchbase/Server/bin/\"" prefix = "\\n" backupfile = file_p...
generate doc string for following function:
def __init__(self): """ Creates an instance of RemoteMachineInfo class """ self.type = '' self.ip = '' self.distribution_type = '' self.architecture_type = '' self.distribution_version = '' self.deliverable_type = '' self.ram = '' s...
def __init__(self): self.type = '' self.ip = '' self.distribution_type = '' self.architecture_type = '' self.distribution_version = '' self.deliverable_type = '' self.ram = '' self.cpu = '' self.disk = '' self.hostname = ''
generate python code for the following
import weakref import paramiko def __init__(self, test_server): """ Create an instance of Shell connection for the given test server. This class is responsible for executing remote shell commands on a remote server. :param test_server: remote server to connect to. This is an object with...
Create an instance of Shell connection for the given test server. This class is responsible for executing remote shell commands on a remote server.
Code the following:
def get_data_file_size(self, path=None): """ Get the size of the file in the specified path :param path: path of the file to get the size of :return: size of the file in the path """ output, error = self.execute_command('du -b {0}'.format(path)) if error: ...
Get the size of the file in the specified path
generate python code for the following
def 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 code for the above:
def kill_eventing_process(self, name): """ Kill eventing process on remote server :param name: name of eventing process :return: None """ o, r = self.execute_command(command="taskkill /F /T /IM {0}*".format(name)) self.log_command_output(o, r)
Kill eventing process on remote server
generate python code for the following
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 code for the following
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 doc string 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' \ + "...
Code the following:
def get_membase_build(config, section): """ Get the membase build information from the config :param config: config :param section: section to get information from :return: membase build information """ membase_build = TestInputBuild() for option in conf...
Get the membase build information from the config
generate doc string for following function:
def kill_goxdcr(self): """ Kill XDCR process on remote server :return: None """ o, r = self.execute_command("taskkill /F /T /IM goxdcr*") self.log_command_output(o, r)
def kill_goxdcr(self): o, r = self.execute_command("taskkill /F /T /IM goxdcr*") self.log_command_output(o, r)
give a code to
def __init__(self, logger, node_install_info): """ Creates an instance of the InstallSteps class. :param logger: :param node_install_info: """ self.log = logger self.node_install_info = node_install_info self.result = True
Creates an instance of the InstallSteps class.
generate comment:
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 python code for
import os import uuid from subprocess import Popen from shell_util.remote_machine import RemoteMachineInfo def extract_remote_info(self): """ Extract the remote information about the remote server. This method is used to extract the following information of the remote server:\n - type o...
Extract the remote information about the remote server. This method is used to extract the following information of the remote server: - type of OS distribution (Linux, Windows, macOS) - ip address - OS distribution type - OS architecture - OS distribution version - extension of the packages (.deb, .rpm, .exe etc) - t...
generate python code for
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 comment for following function:
def cleanup_all_configuration(self, data_path): """ Deletes the contents of the parent folder that holds the data and config directories. Override method for Windows :param data_path: The path key from the /nodes/self end-point which looks something like "/opt/couchbase/var/lib/c...
def cleanup_all_configuration(self, data_path): path = data_path.replace("/data", "") if "c:/Program Files" in path: path = path.replace("c:/Program Files", "/cygdrive/c/Program\ Files") o, r = self.execute_command(f"rm -rf {path}/*") self.log_command_output(o, r)
generate code for the above:
def start_server(self): """ Starts the Couchbase server on the remote server. The method runs the sever from non-default location if it's run as nonroot user. Else from default location. :return: None """ if self.is_couchbase_installed(): if self.nonroot: ...
Starts the Couchbase server on the remote server. The method runs the sever from non-default location if it's run as nonroot user. Else from default location.
generate comment.
def is_enterprise(self): """ Check if the couchbase installed is enterprise edition or not :return: True if couchbase installed is enterprise edition else False """ enterprise = False runtime_file_path = "" if self.nonroot: if self.file_exists("%s/opt/...
def is_enterprise(self): enterprise = False runtime_file_path = "" if self.nonroot: if self.file_exists("%s/opt/couchbase/etc/" % self.nr_home_path, "runtime.ini"): runtime_file_path = "%s/opt/couchbase/etc/" % self.nr_home_pat...
give python code to
def stop_indexer(self): """ Stop indexer process on remote server :return: None """ o, r = self.execute_command("kill -SIGSTOP $(pgrep indexer)") self.log_command_output(o, r, debug=False)
Stop indexer process on remote server
generate code for the above:
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 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. Override method for Windows :param stop_time: Time duration for which the network service needs to be down in the machine :return: None ...
Stop the network for given time period and then restart the network on the machine. Override method for Windows
give python code to
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:
def connect_with_user(self, user="root"): """ Connect to the remote server with given user Override method since this is not required for Unix :param user: user to connect to remote server with :return: None """ return
def connect_with_user(self, user="root"): return
give python code to
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
generate python code for the following
def get_full_hostname(self): """ Get full hostname of a server. :return: hostname string """ if not info.domain: return None self.log.info("%s - Hostname is %s" % (self.ip, info.hostname[0])) if info.domain[0]: if info.domain[0][0]: ...
Get full hostname of a server.
generate doc string for following function:
def change_port_static(self, new_port): """ Change Couchbase ports for rest, mccouch, memcached, capi to new port :param new_port: new port to change the ports to :return: None """ # ADD NON_ROOT user config_details log.info("=========CHANGE PORTS for REST: %s, MC...
def change_port_static(self, new_port): # ADD NON_ROOT user config_details log.info("=========CHANGE PORTS for REST: %s, MCCOUCH: %s,MEMCACHED: %s, CAPI: %s===============" % (new_port, new_port + 1, new_port + 2, new_port + 4)) output, error = self.execute_command("sed...
generate python code for
def execute_non_sudo_command(self, command, info=None, debug=True, use_channel=False): """ Execute command in non-sudo mode. :param command: command to be executed :param info: None :param debug: print debug information in logs if True :...
Execute command in non-sudo mode.
generate code for the above:
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 above
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 doc string for following function:
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 ...
from shell_util.remote_machine import RemoteMachineProcess def is_process_running(self, process_name): """ Check if a process is running currently Override method for Windows :param process_name: name of the process to check :return: True if process is running else False ...
Check if a process is running currently Override method for Windows
generate comment for following function:
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 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
Code the following:
import time from time import sleep def monitor_process_memory(self, process_name, duration_in_seconds=180, end=False): """ Monitor this process and return list of memories in 7 secs interval till the duration specified :param process_name: the name of the process ...
Monitor this process and return list of memories in 7 secs interval till the duration specified
generate code for the following
import os import paramiko import signal from time import sleep def ssh_connect_with_retries(self, ip, ssh_username, ssh_password, ssh_key, exit_on_failure=False, max_attempts_connect=5, backoff_time=10): """ Connect to the remote server ...
Connect to the remote server with given user and password, with exponential backoff delay
def get_memcache_pid(self): """ Get the pid of memcached process :return: pid of memcached process """ o, _ = self.execute_command( "ps -eo comm,pid | awk '$1 == \"memcached\" { print $2 }'") return o[0]
def get_memcache_pid(self): o, _ = self.execute_command( "ps -eo comm,pid | awk '$1 == \"memcached\" { print $2 }'") return o[0]