instruction
stringclasses
14 values
output
stringlengths
105
12.9k
input
stringlengths
0
4.12k
generate code for the above:
import install_util.constants from install_util.constants.build import BuildUrl from shell_util.remote_connection import RemoteMachineShellConnection def __construct_build_url(self, is_debuginfo_build=False): """ Constructs the build url for the given node. This url is used to download the inst...
Constructs the build url for the given node. This url is used to download the installation package.
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
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 python code for the above
def get_data_file_size(self, path=None): """ Get the size of the file in the specified path :param path: path of the file to get the size of :return: size of the file in the path """ output, error = self.execute_command('du -b {0}'.format(path)) if error: ...
Get the size of the file in the specified path
give a code to
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 python code for
def stop_membase(self, num_retries=10, poll_interval=1): """ Stop membase process on remote server :param num_retries: number of retries before giving up :param poll_interval: wait time between each retry. :return: None """ o, r = self.execute_command("net stop ...
Stop membase process on remote server
give a code to
def is_enterprise(self): """ Check if the couchbase installed is enterprise edition or not Override method for Windows :return: True if couchbase installed is enterprise edition else False """ raise NotImplementedError
Check if the couchbase installed is enterprise edition or not Override method for Windows
generate python code for 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 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.
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.log...
def enable_disk_readonly(self, disk_location): o, r = self.execute_command("chmod -R 444 {}".format(disk_location)) self.log_command_output(o, r)
generate python code for the following
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: ...
Check if the directory exists in the remote path
generate python code for
from subprocess import Popen def remove_directory_recursive(self, remote_path): """ Recursively remove directory in remote machine. :param remote_path: directory path to remove :return: True if successful else False """ if self.remote: sftp = self._ssh_client...
Recursively remove directory in remote machine.
give a code to
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 comment.
def start_couchbase(self): """ Starts couchbase on remote server :return: None """ retry = 0 running = self.is_couchbase_running() while not running and retry < 3: log.info("Starting couchbase server") o, r = self.execute_command("net start...
def start_couchbase(self): retry = 0 running = self.is_couchbase_running() while not running and retry < 3: log.info("Starting couchbase server") o, r = self.execute_command("net start couchbaseserver") self.log_command_output(o, r) self.s...
generate comment.
def enable_diag_eval_on_non_local_hosts(self, state=True): """ Enable diag/eval to be run on non-local hosts. :param state: enable diag/eval on non-local hosts if True :return: Command output and error if any. """ rest_username = self.server.rest_username rest_pas...
def enable_diag_eval_on_non_local_hosts(self, state=True): rest_username = self.server.rest_username rest_password = self.server.rest_password protocol = "https://" if self.port == "18091" else "http://" command = "curl --silent --show-error {4}{0}:{1}@localhost:{2}/diag/eval -...
give a code to
from subprocess import Popen def remove_directory_recursive(self, remote_path): """ Recursively remove directory in remote machine. :param remote_path: directory path to remove :return: True if successful else False """ if self.remote: sftp = self._ssh_client...
Recursively remove directory in remote machine.
def file_exists(self, remotepath, filename, pause_time=30): """ Check if file exists in remote machine :param remotepath: path of the file to check :param filename: filename of the file to check :param pause_time: time between each command execution in seconds :return: ...
Check if file exists in remote machine
give a 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 python code for the following
def file_exists(self, remotepath, filename, pause_time=30): """ Check if file exists in remote machine :param remotepath: path of the file to check :param filename: filename of the file to check :param pause_time: time between each command execution in seconds :return: ...
Check if file exists in remote machine
generate comment.
def stop_server(self): """ Stops the Couchbase server on the remote server. The method stops the server from non-default location if it's run as nonroot user. Else from default location. :param os: :return: None """ o, r = self.execute_command("net stop couchbases...
def stop_server(self): o, r = self.execute_command("net stop couchbaseserver") self.log_command_output(o, r)
Code the following:
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/" back...
Reset environment previously set and restart couchbase server
Code the following:
def stop_network(self, stop_time): """ Stop the network for given time period and then restart the network on the machine. :param stop_time: Time duration for which the network service needs to be down in the machine :return: None """ command = "nohup se...
Stop the network for given time period and then restart the network on the machine.
generate code for the following
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
Code the following:
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 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.
give a code to
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 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...
generate comment for following function:
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 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.
give a code to
def populate_debug_build_url(self): """ Populates the debug_info build url variable. :return: None """ self.node_install_info.debug_build_url = self.__construct_build_url( is_debuginfo_build=True) self.log.info("{} - Debug build url :: {}" ...
Populates the debug_info build url variable.
generate comment for above
def 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 p...
def configure_log_location(self, new_log_location): mv_logs = testconstants.LINUX_LOG_PATH + '/' + new_log_location print((" MV LOGS %s" % mv_logs)) error_log_tag = "error_logger_mf_dir" # ADD NON_ROOT user config_details log.info("CHANGE LOG LOCATION TO %s".format(mv_lo...
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
give python code to
def get_bkrs_client_config(config, section, global_properties, ui_settings): """ Get back up restore client configuration :param config: config :param section: section to get configuration from :param global_properties: dict of global properties ...
Get back up restore client configuration
give a code to
def 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 python code for
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
Code the following:
def start_indexer(self): """ Start indexer process on remote server :return: None """ o, r = self.execute_command("kill -SIGCONT $(pgrep indexer)") self.log_command_output(o, r)
Start indexer process on remote server
def read_remote_file(self, remote_path, filename): """ Reads the content of a remote file specified by the path. :param remote_path: Remote path to read the file from :param filename: Name of the file to read. :return: string content of the file """ if self.file_e...
def read_remote_file(self, remote_path, filename): if self.file_exists(remote_path, filename): if self.remote: sftp = self._ssh_client.open_sftp() remote_file = sftp.open('{0}/{1}'.format(remote_path, filename)) try: out = ...
generate python code for the above
def windows_process_utils(self, ps_name_or_id, cmd_file_name, option=""): """ Windows process utility. This adds firewall rules to Windows system. If a previously suspended process is detected, it continues with the process instead. :param ps_name_or_id: process name or process id ...
Windows process utility. This adds firewall rules to Windows system. If a previously suspended process is detected, it continues with the process instead.
give python code to
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
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.
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 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 python code for the following
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 comment for 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 """ i...
def kill_erlang(self, os="unix", delay=0): if delay: time.sleep(delay) o, r = self.execute_command("taskkill /F /T /IM epmd.exe*") self.log_command_output(o, r) o, r = self.execute_command("taskkill /F /T /IM erl.exe*") self.log_command_output(o, r) o...
generate python code for
def populate_build_url(self): """ Populates the build url variable. :return: None """ self.node_install_info.build_url = self.__construct_build_url() self.log.info("{} - Build url :: {}" .format(self.node_install_info.server.ip, ...
Populates the build url variable.
generate python code for
def get_disk_info(self, win_info=None, mac=False): """ Get disk info of the remote server :param win_info: Windows info in case of windows :param mac: Get info for macOS if True :return: Disk info of the remote server if found else None """ if win_info: ...
Get disk info of the remote server
generate code for the following
def stop_network(self, stop_time): """ Stop the network for given time period and then restart the network on the machine. :param stop_time: Time duration for which the network service needs to be down in the machine :return: None """ command = "nohup se...
Stop the network for given time period and then restart the network on the machine.
generate python code for the above
def get_bkrs_client_config(config, section, global_properties, ui_settings): """ Get back up restore client configuration :param config: config :param section: section to get configuration from :param global_properties: dict of global properties ...
Get back up restore client configuration
Code the following:
def enable_disk_readonly(self, disk_location): """ Enables read-only mode for the specified disk location. Override method for Windows :param disk_location: disk location to enable read-only mode. :return: None """ raise NotImplementedError
Enables read-only mode for the specified disk location. Override method for Windows
def 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.
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/" back...
Reset environment previously set and restart couchbase server
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)
def check_build_url_status(self): self.check_url_status(self.node_install_info.build_url)
give a code to
def start_couchbase(self): """ Starts couchbase on remote server :return: None """ retry = 0 running = self.is_couchbase_running() while not running and retry < 3: log.info("Starting couchbase server") o, r = self.execute_command("net sta...
Starts couchbase on remote server
generate python 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
def reconnect_if_inactive(self): """ If the SSH channel is inactive, retry the connection """ tp = self._ssh_client.get_transport() if tp and not tp.active: self.log.warning("%s - SSH connection inactive" % self.ip) self.ssh_connect_with_retries(self.ip, s...
def reconnect_if_inactive(self): tp = self._ssh_client.get_transport() if tp and not tp.active: self.log.warning("%s - SSH connection inactive" % self.ip) self.ssh_connect_with_retries(self.ip, self.username, self.password, self....
give python code to
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
generate code for the following
import time from time import sleep def monitor_process_memory(self, process_name, duration_in_seconds=180, end=False): """ Monitor this process and return list of memories in 7 secs interval till the duration specified :param process_name: the name of the process ...
Monitor this process and return list of memories in 7 secs interval till the duration specified
give a code to
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 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.
give a code to
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 code for the following
from shell_util.remote_machine import RemoteMachineProcess def get_running_processes(self): """ Get the list of processes currently running in the remote server if its linux ,then parse each line 26989 ? 00:00:51 pdflush ps -Ao pid,comm :return: List of processes ...
Get the list of processes currently running in the remote server if its linux ,then parse each line 26989 ? 00:00:51 pdflush ps -Ao pid,comm
generate python code for the 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 statisti...
Get the process statistics for given parameter
generate python code for
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_...
Change environment variables mentioned in dictionary and restart Couchbase server
generate comment for above
def stop_membase(self): """ Override method """ raise NotImplementedError
def stop_membase(self): raise NotImplementedError
give a 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 comment for following function:
def stop_couchbase(self, num_retries=5, poll_interval=10): """ Stop couchbase service on remote server :param num_retries: None :param poll_interval: None :return: None """ cb_process = '/Applications/Couchbase\ Server.app/Contents/MacOS/Couchbase\ Server' ...
def stop_couchbase(self, num_retries=5, poll_interval=10): cb_process = '/Applications/Couchbase\ Server.app/Contents/MacOS/Couchbase\ Server' cmd = "ps aux | grep {0} | awk '{{print $2}}' | xargs kill -9 "\ .format(cb_process) o, r = self.execute_command(cmd) self.l...
def __init__(self): """ Creates an instance of the TestInputBuild class """ self.version = '' self.url = ''
def __init__(self): self.version = '' self.url = ''
generate python code for
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
Code 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
give a 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
Code the following:
def check_build_url_status(self): """ Checks the build url status. Checks if the url is reachable and valid. :return: None """ self.check_url_status(self.node_install_info.build_url)
Checks the build url status. Checks if the url is reachable and valid.
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
generate comment for above
def unpause_beam(self): """ Unpauses the beam.smp process on remote server :return: """ o, r = self.execute_command("killall -SIGCONT beam.smp") self.log_command_output(o, r)
def unpause_beam(self): o, r = self.execute_command("killall -SIGCONT beam.smp") self.log_command_output(o, r)
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 doc string for following function:
def __init__(self): """ Creates an instance of the TestInputServer class. This object holds the server information required for installation, cli and rest api calls. """ self.ip = '' self.internal_ip = '' self.hostname = '' self.ssh_username = '' s...
def __init__(self): self.ip = '' self.internal_ip = '' self.hostname = '' self.ssh_username = '' self.ssh_password = '' self.ssh_key = '' self.rest_username = '' self.rest_password = '' self.services = '' self.port = '' sel...
Code the following:
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
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 stop_server(self): """ Stops the Couchbase server on the remote server. The method stops the server from non-default location if it's run as nonroot user. Else from default location. :param os: :return: None """ o, r = self.execute_command("net stop couchbases...
def stop_server(self): o, r = self.execute_command("net stop couchbaseserver") self.log_command_output(o, r)
generate comment for above
def disable_file_limit(self): """ Change the file limite to 200000 for indexer process :return: None """ o, r = self.execute_command("prlimit --nofile=200000 --pid $(pgrep indexer)") self.log_command_output(o, r)
def disable_file_limit(self): o, r = self.execute_command("prlimit --nofile=200000 --pid $(pgrep indexer)") self.log_command_output(o, r)
Code the following:
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...
Get all the processes binding to a particular ip family Override method for Windows
generate comment for above
def create_file(self, remote_path, file_data): """ Create a remote file from input string :param remote_path: remote path of the file to be created :param file_data: file data to be written to the file :return: None """ output, error = self.execute_command("echo '...
def create_file(self, remote_path, file_data): output, error = self.execute_command("echo '{0}' > {1}".format(file_data, remote_path))
generate python code for
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 doc string for following function:
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 config...
def get_membase_build(config, section): membase_build = TestInputBuild() for option in config.options(section): if option == 'version': pass if option == 'url': pass return membase_build
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...
Get all the processes binding to a particular ip family Override method for Windows
generate code for the above:
def param(self, name, *args): """ Returns the paramater or a default value :param name: name of the property :param args: default value for the property. If no default value is given, an exception is raised :return: the value of the property :raises Exception: if the de...
Returns the paramater or a default value
generate doc string for following function:
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)
def disable_file_limit_desc(self): o, r = self.execute_command("sysctl -w fs.file-max=1606494;sysctl -p") self.log_command_output(o, r)
generate python code for the following
def stop_server(self, os="unix"): """ Stops the Couchbase server on the remote server. The method stops the server from non-default location if it's run as nonroot user. Else from default location. :param os: :return: None """ if self.is_couchbase_installed(): ...
Stops the Couchbase server on the remote server. The method stops the server from non-default location if it's run as nonroot user. Else from default location.
generate code for the following
def delete_file(self, remotepath, filename): """ Delete a file from the remote path :param remotepath: remote path of the file to be deleted :param filename: name of the file to be deleted :return: True if the file was successfully deleted else False """ sftp = ...
Delete a file from the remote path
give a code to
import install_util.constants from install_util.constants.build import BuildUrl from shell_util.remote_connection import RemoteMachineShellConnection def __construct_build_url(self, is_debuginfo_build=False): """ Constructs the build url for the given node. This url is used to download the inst...
Constructs the build url for the given node. This url is used to download the installation package.
generate doc string for following function:
def fill_disk_space(self, location): """ Fill up the disk fully at the location specified. This method creates a junk file of the specified size in the location specified :param location: Location to fill the disk :param size: Size of disk space to fill up, in MB :return:...
def fill_disk_space(self, location): command = "dd if=/dev/zero of={0}/disk-quota.ext3 count={1}; df -Thl"\ .format(location, 1024000000) output, error = self.execute_command(command) return output, error
generate python code for the above
def windows_process_utils(self, ps_name_or_id, cmd_file_name, option=""): """ Windows process utility. This adds firewall rules to Windows system. If a previously suspended process is detected, it continues with the process instead. :param ps_name_or_id: process name or process id ...
Windows process utility. This adds firewall rules to Windows system. If a previously suspended process is detected, it continues with the process instead.
give a code to
def reboot_node(self): """ Reboot the remote server :return: None """ o, r = self.execute_command("reboot") self.log_command_output(o, r)
Reboot the remote server
give python 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 python code for the following
def get_ip_address(self): """ Get ip address of a remote server Override method for Windows :return: ip address of remote server """ raise NotImplementedError
Get ip address of a remote server Override method for Windows
generate code for the above:
def stop_server(self): """ Stops the Couchbase server on the remote server. The method stops the server from non-default location if it's run as nonroot user. Else from default location. :param os: :return: None """ o, r = self.execute_command("net stop couchbas...
Stops the Couchbase server on the remote server. The method stops the server from non-default location if it's run as nonroot user. Else from default location.
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
def terminate_processes(self, info, p_list): raise NotImplementedError
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 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 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
generate python code for the above
import os def find_file(self, remote_path, file): """ Check if file exists in remote path :param remote_path: remote path of the file to be checked :param file: filename to be checked :return: file path of the file if exists, None otherwise """ sftp = self._ssh_c...
Check if file exists in remote path