instruction
stringclasses
14 values
output
stringlengths
105
12.9k
input
stringlengths
0
4.12k
generate python code for the above
def cluster_ip(self): """ Returns the ip address of the server. Returns internal ip is available, else the ip address. :return: ip address of the server """ return self.internal_ip or self.ip
Returns the ip address of the server. Returns internal ip is available, else the ip address.
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.
generate doc string for following function:
def _parse_param(value): """ Parses the parameter to integers, floats, booleans and strings. The method tries to fit the value to integer, float, boolean in sequence. If the value fits, return the corresponding type of value, else return the string value as is. :param value: valu...
def _parse_param(value): try: return int(value) except ValueError: pass try: return float(value) except ValueError: pass if value.lower() == "false": return False if value.lower() == "true": ...
generate comment for above
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 -SIGC...
def unpause_memcached(self, os="linux"): log.info("*** unpause memcached process ***") if self.nonroot: o, r = self.execute_command("killall -SIGCONT memcached.bin") else: o, r = self.execute_command("killall -SIGCONT memcached") self.log_command_output(o...
generate python code for 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('beam.smp') if o is not None: return True return False
Checks if couchbase is currently running on the remote server
generate python code for 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
Code the following:
def init_cluster(self, node): """ Initializes Couchbase cluster Override method for Unix :param node: server object :return: True on success """ return True
Initializes Couchbase cluster Override method for Unix
def __find_windows_info(self): """ Get information about a Windows server :return: Windows info about the server """ if self.remote: found = self.find_file("/cygdrive/c/tmp", "windows_info.txt") if isinstance(found, str): if self.remote: ...
Get information about a Windows server
generate python code for
def get_download_dir(node_installer): """ Gets the download directory for the given node. Returns non-root download directory in case of nonroot installation. Else returns the default download directory. :param node_installer: node installer object :return: download dir...
Gets the download directory for the given node. Returns non-root download directory in case of nonroot installation. Else returns the default download directory.
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('beam.smp') if o is not None: return True return False
def is_couchbase_running(self): o = self.is_process_running('beam.smp') if o is not None: return True return False
generate python code for the following
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 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
Code the following:
def remove_folders(self, list): """ Remove folders from list provided :param list: paths of folders to be removed :return: None """ for folder in list: output, error = self.execute_command( "rm -rf {0}".format(folder), debug=False) ...
Remove folders from list provided
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 download_build(self, node_installer, build_url, non_root_installer=False): """ Download the Couchbase build on the remote server :param node_installer: node installer object :param build_url: build url to download the Couchbase build from. :param non_...
Download the Couchbase build on the remote server
give python code to
def 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 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 = TestInput() config = configpar...
def parse_from_file(file): count = 0 start = 0 end = 0 servers = list() ips = list() input = TestInput() config = configparser.ConfigParser(interpolation=None) config.read(file) sections = config.sections() global_properties = dict...
def log_command_output(self, output, error, track_words=(), debug=True): """ Check for errors and tracked words in the output success means that there are no track_words in the output and there are no errors at all, if track_words is not empty if track_words=(), the result is no...
def log_command_output(self, output, error, track_words=(), debug=True): success = True for line in error: if debug: self.log.error(line) if track_words: if "Warning" in line and "hugepages" in line: self.log.info( ...
def post_install(self): """ Post installation steps on a Windows server :return: True on successful post installation steps run else False """ cmds = self.cmds cmd = cmds["post_install"] retry_cmd = cmds["post_install_retry"] if cmd is None: ...
Post installation steps on a Windows server
generate 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 doc string for following function:
def get_file(self, remotepath, filename, todir): """ Downloads a file from a remote location to a local path. :param remotepath: Remote path to download the file from. :param filename: Name of the file to download. :param todir: Directory to save the file to. :return: Tru...
def get_file(self, remotepath, filename, todir): if self.file_exists(remotepath, filename): if self.remote: sftp = self._ssh_client.open_sftp() try: filenames = sftp.listdir(remotepath) for name in filenames: ...
generate comment for following function:
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: ...
def start_server(self): if self.is_couchbase_installed(): if self.nonroot: cmd = '%s%scouchbase-server \-- -noinput -detached '\ % (self.nr_home_path, LINUX_COUCHBASE_BIN_PATH) else: cmd = "systemctl start couchbase-server.se...
generate python code for
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 stop_couchbase(self, num_retries=5, poll_interval=10): """ Stop couchbase service on remote server :param num_retries: None :param poll_interval: None :return: None """ cb_process = '/Applications/Couchbase\ Server.app/Contents/MacOS/Couchbase\ Server' ...
Stop couchbase service on remote server
generate python code for
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 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 python code for the above
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 comment:
def remove_folders(self, list): """ Remove folders from list provided :param list: paths of folders to be removed :return: None """ for folder in list: output, error = self.execute_command( "rm -rf {0}".format(folder), debug=False) ...
def remove_folders(self, list): for folder in list: output, error = self.execute_command( "rm -rf {0}".format(folder), debug=False) self.log_command_output(output, error)
generate comment:
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 paramet...
def get_process_statistics(self, process_name=None, process_pid=None): self.extract_remote_info() remote_command = "cd ~; /cygdrive/c/Python27/python stats_windows_helper.py" if process_name: remote_command.append(" " + process_name) elif process_pid: rem...
generate python code for
def disable_disk_readonly(self, disk_location): """ Disables read-only mode for the specified disk location. Override method for Windows :param disk_location: disk location to disable read-only mode. :return: None """ raise NotImplementedError
Disables read-only mode for the specified disk location. Override method for Windows
generate doc string for following function:
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}'.fo...
def __check_if_cb_service_stopped(self, service_name=None): if service_name: o, r = self.execute_command('sc query {0}'.format(service_name)) for res in o: if "STATE" in res: info = res.split(":") is_stopped = "STOPPED" in...
generate code for the following
def is_couchbase_installed(self): """ Check if Couchbase is installed on the remote server. This checks if the couchbase is installed in default or non default path. :return: True if Couchbase is installed on the remote server else False """ if self.nonroot: ...
Check if Couchbase is installed on the remote server. This checks if the couchbase is installed in default or non default path.
generate 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
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
generate python code for the above
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 enable_file_limit(self): """ Change the file limit to 100 for indexer process :return: None """ o, r = self.execute_command("prlimit --nofile=100 --pid $(pgrep indexer)") self.log_command_output(o, r)
Change the file limit to 100 for indexer process
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 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
def disable_firewall(self): """ Clear firewall rules on the remote server :return: None """ command_1 = "/sbin/iptables -F" command_2 = "/sbin/iptables -t nat -F" if self.nonroot: log.info("Non root user has no right to disable firewall, " ...
def disable_firewall(self): command_1 = "/sbin/iptables -F" command_2 = "/sbin/iptables -t nat -F" if self.nonroot: log.info("Non root user has no right to disable firewall, " "switching over to root") self.connect_with_user(user="root") ...
generate code for the above:
import re def get_test_input(arguments): """ Parses the test input arguments to type TestInput object :param arguments: arguments to parse :return: TestInput object """ params = dict() if arguments.params: argument_split = [a.strip() for a in re.split...
Parses the test input arguments to type TestInput object
give a code to
import os def get_server_options(servers, membase_settings, global_properties): """ Set the various server properties from membase and global properties :param servers: list of servers to set the values of :param membase_settings: TestInputMembaseSetting object with membase settings ...
Set the various server properties from membase and global properties
give python code to
def get_disk_info(self, win_info=None, mac=False): """ Get disk info of the remote server :param win_info: Windows info in case of windows :param mac: Get info for macOS if True :return: Disk info of the remote server if found else None """ if win_info: ...
Get disk info of the remote server
give python code to
import os def copy_files_local_to_remote(self, src_path, des_path): """ Copy multi files from local to remote server :param src_path: source path of the files to be copied :param des_path: destination path of the files to be copied :return: None """ files = os.li...
Copy multi files from local to remote server
generate comment:
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}'.fo...
def __check_if_cb_service_stopped(self, service_name=None): if service_name: o, r = self.execute_command('sc query {0}'.format(service_name)) for res in o: if "STATE" in res: info = res.split(":") is_stopped = "STOPPED" in...
generate code for the above:
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...
Code the following:
def post_install(self): """ Post installation steps on a Windows server :return: True on successful post installation steps run else False """ cmds = self.cmds cmd = cmds["post_install"] retry_cmd = cmds["post_install_retry"] if cmd is None: ...
Post installation steps on a Windows server
Code 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 code for the above:
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 comment:
def get_test_input(arguments): """ Parses the test input arguments to type TestInput object :param arguments: arguments to parse :return: TestInput object """ params = dict() if arguments.params: argument_split = [a.strip() for a in re.split("[,]?([^,=...
def get_test_input(arguments): params = dict() if arguments.params: argument_split = [a.strip() for a in re.split("[,]?([^,=]+)=", arguments.params)[1:]] pairs = dict(list(zip(argument_split[::2], argument_split[1::2]))) for pair in list(pairs.items()): ...
generate comment for following function:
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
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.
give a code to
def post_install(self): """ Post installation steps on a Unix server :return: True on successful post installation steps run else False """ cmds = self.cmds if self.shell.nonroot: cmds = self.non_root_cmds cmd = cmds["post_install"] retry_cmd...
Post installation steps on a Unix server
generate python code for the following
def kill_goxdcr(self): """ Kill XDCR process on remote server :return: None """ o, r = self.execute_command("killall -9 goxdcr") self.log_command_output(o, r)
Kill XDCR process on remote server
generate 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
generate comment for above
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 python code for the above
def start_couchbase(self): """ Starts couchbase on remote server :return: None """ running = self.is_couchbase_running() retry = 0 while not running and retry < 3: log.info("Starting couchbase server") if self.nonroot: log...
Starts couchbase on remote server
generate python code for
def enable_network_delay(self): """ Changes network to send requests with a delay of 200 ms using traffic control :return: None """ o, r = self.execute_command("tc qdisc add dev eth0 root netem delay 200ms") self.log_command_output(o, r)
Changes network to send requests with a delay of 200 ms using traffic control
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 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 comment.
def post_install(self): """ Post installation steps on a Unix server :return: True on successful post installation steps run else False """ cmds = self.cmds if self.shell.nonroot: cmds = self.non_root_cmds cmd = cmds["post_install"] retry_cmd =...
def post_install(self): cmds = self.cmds if self.shell.nonroot: cmds = self.non_root_cmds cmd = cmds["post_install"] retry_cmd = cmds["post_install_retry"] if cmd is None: return True output, err = self.shell.execute_command(cmd) ...
generate comment for following function:
def run(self): """ Runs the NodeInstaller thread to run various installation steps in the remote server :return: None """ installer = InstallSteps(self.log, self.node_install_info) node_installer = installer.get_node_installer( self.node_install_info) ...
def run(self): installer = InstallSteps(self.log, self.node_install_info) node_installer = installer.get_node_installer( self.node_install_info) for step in self.steps: self.log.info("{} - Running '{}'" .format(self.node_install_info.ser...
generate python code for the above
def create_new_partition(self, location, size=None): """ Create a new partition at the location specified and of the size specified :param location: Location to create the new partition at. :param size: Size of the partition in MB :return: None """ comma...
Create a new partition at the location specified and of the size specified
generate code for the above:
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 comment:
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)
def restart_couchbase(self): o, r = self.execute_command("open /Applications/Couchbase\ Server.app") self.log_command_output(o, r)
generate comment.
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)
generate comment.
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 following
def start_server(self): """ Starts the Couchbase server on the remote server. The method runs the sever from non-default location if it's run as nonroot user. Else from default location. :return: None """ o, r = self.execute_command("open /Applications/Couchbase\ Server...
Starts the Couchbase server on the remote server. The method runs the sever from non-default location if it's run as nonroot user. Else from default location.
generate comment:
def 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....
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.
generate comment.
def disconnect(self): """ Disconnect the ssh connection to remote machine. :return: None """ ShellConnection.disconnections += 1 self._ssh_client.close()
def disconnect(self): ShellConnection.disconnections += 1 self._ssh_client.close()
def __str__(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.port) ...
def __str__(self): #ip_str = "ip:{0}".format(self.ip) ip_str = "ip:{0} port:{1}".format(self.ip, self.port) ssh_username_str = "ssh_username:{0}".format(self.ssh_username) return "{0} {1}".format(ip_str, ssh_username_str)
generate python code for 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
generate python code for the following
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 following function:
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.open_sftp() try: ...
def remove_directory_recursive(self, remote_path): if self.remote: sftp = self._ssh_client.open_sftp() try: log.info("removing {0} directory...".format(remote_path)) self.rmtree(sftp, remote_path) except IOError: return...
generate doc string for following function:
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 ram_stress(self, stop_time): """ Applies memory stress for a specified duration with 3 workers each of size 2.5G. Override method for Windows :param stop_time: duration to apply the memory stress for. :return: None """ raise NotImplementedError
Applies memory stress for a specified duration with 3 workers each of size 2.5G. Override method for Windows
give 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_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 ...
def stop_network(self, stop_time): command = "net stop Netman && timeout {} && net start Netman" output, error = self.execute_command(command.format(stop_time)) self.log_command_output(output, error)
def stop_network(self, stop_time): """ Stop the network for given time period and then restart the network on the machine. :param stop_time: Time duration for which the network service needs to be down in the machine :return: None """ command = "nohup serv...
def stop_network(self, stop_time): command = "nohup service network stop && sleep {} " \ "&& service network start &" output, error = self.execute_command(command.format(stop_time)) self.log_command_output(output, error)
generate code for the following
def start_memcached(self): """ Start memcached process on remote server :return: None """ o, r = self.execute_command("taskkill /F /T /IM memcached") self.log_command_output(o, r, debug=False)
Start memcached process on remote server
generate python code for the following
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
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.
generate code for the above:
def uninstall(self): """ Uninstalls Couchbase server on Linux machine :return: True on success """ self.shell.stop_couchbase() cmd = self.cmds if self.shell.nonroot: cmd = self.non_root_cmds cmd = cmd[self.shell.info.deliverable_type]["uninst...
Uninstalls Couchbase server on Linux machine
generate comment.
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 -SIGC...
def unpause_memcached(self, os="linux"): log.info("*** unpause memcached process ***") if self.nonroot: o, r = self.execute_command("killall -SIGCONT memcached.bin") else: o, r = self.execute_command("killall -SIGCONT memcached") self.log_command_output(o...
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: self.log.info("Starting couchbase server") o, r = self.execute_command("open...
def start_couchbase(self): retry = 0 running = self.is_couchbase_running() while not running and retry < 3: self.log.info("Starting couchbase server") o, r = self.execute_command("open /Applications/Couchbase\ Server.app") self.log_command_output(o, r...
generate python code for the following
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.
def get_membase_settings(config, section): """ Get the membase settings information from the config :param config: config :param section: section to get information from :return: membase settings information """ membase_settings = TestInputMembaseSetting() ...
Get the membase settings information from the config
generate code for the following
def _check_output(self, word_check, output): """ Check if certain word is present in the output :param word_check: string or list of strings to check :param output: the output to check against :return: True if word is present in the output else False """ found =...
Check if certain word is present in the output
generate python code for
def _check_output(self, word_check, output): """ Check if certain word is present in the output :param word_check: string or list of strings to check :param output: the output to check against :return: True if word is present in the output else False """ found =...
Check if certain word is present in the output
def copy_file_remote_to_local(self, rem_path, des_path): """ Copy file from remote server to local :param rem_path: remote 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 ...
def copy_file_remote_to_local(self, rem_path, des_path): result = True sftp = self._ssh_client.open_sftp() try: sftp.get(rem_path, des_path) except IOError as e: self.log.error('Can not copy file', e) result = False finally: ...
generate python code for the following
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 above
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 doc string 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})...
generate comment for 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
def uninstall(self): self.shell.stop_couchbase() cmd = self.cmds["uninstall"] self.shell.execute_command(cmd) return True
generate python code for the above
def unpause_memcached(self): """ Unpauses the memcached process on remote server Override method for Windows :param os: os type of remote server :return: None """ self.log.info("*** unpause memcached process ***") cmd = "pssuspend -r $(tasklist | grep m...
Unpauses the memcached process on remote server Override method for Windows
generate comment:
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_co...
def restart_couchbase(self): o, r = self.execute_command("net stop couchbaseserver") self.log_command_output(o, r) o, r = self.execute_command("net start couchbaseserver") self.log_command_output(o, r)
generate code for 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
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("killall -9 cbft") self.log_command_output(o, r) if r and r[0] and "command not found" in...
Kill the full text search process on remote server
give a code to
def delete_network_rule(self): """ Delete all traffic control rules set for eth0 :return: None """ o, r = self.execute_command("tc qdisc del dev eth0 root") self.log_command_output(o, r)
Delete all traffic control rules set for eth0
generate comment:
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)