instruction stringclasses 14
values | output stringlengths 105 12.9k | input stringlengths 0 4.12k |
|---|---|---|
generate comment for following function: | def __init__(self, server, server_info, os_type, version, edition):
"""
Creats an instance of the NodeInstallInfo class.
:param server: server object of type TestInputServer
:param server_info: server info with information of the server
:param os_type: OS type of the server
... | def __init__(self, server, server_info, os_type, version, edition):
self.server = server
self.server_info = server_info
self.os_type = os_type
self.version = version
self.edition = edition
self.build_url = None
self.debug_build_url = None
self.n... |
generate python code for the following |
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
|
generate code for the above: |
def is_couchbase_installed(self):
"""
Check if Couchbase is installed on the remote server.
This checks if the couchbase is installed in default or non default path.
:return: True if Couchbase is installed on the remote server else False
"""
if self.file_exists(WIN_CB_P... | Check if Couchbase is installed on the remote server.
This checks if the couchbase is installed in default or non default path.
|
Code the following: |
def get_full_hostname(self):
"""
Get the full hostname of the remote server
Override method for windows
:return: full hostname if domain is set, else None
"""
if not self.info.domain:
return None
return '%s.%s' % (self.info.hostname[0], self.info.dom... | Get the full hostname of the remote server
Override method for windows
|
def cbbackupmgr_param(self, name, *args):
"""
Returns the config value from the ini whose key matches 'name' and is stored under the 'cbbackupmgr'
section heading.
:param name: the key under which an expected value is stored.
:param args: expects a single parameter which will b... | Returns the config value from the ini whose key matches 'name' and is stored under the 'cbbackupmgr'
section heading.
| |
give python 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 comment for above | def pause_memcached(self, timesleep=30, delay=0):
"""
Pauses the memcached process on remote server
:param timesleep: time to wait after pause (in seconds)
:param delay: time to delay pause of memcached process (in seconds)
:return: None
"""
log.info("*** pause me... | def pause_memcached(self, timesleep=30, delay=0):
log.info("*** pause memcached process ***")
if delay:
time.sleep(delay)
if self.nonroot:
o, r = self.execute_command("killall -SIGSTOP memcached.bin")
else:
o, r = self.execute_command("killall... |
generate comment for above | def start_indexer(self):
"""
Start indexer process on remote server
:return: None
"""
o, r = self.execute_command("taskkill /F /T /IM indexer*")
self.log_command_output(o, r) | def start_indexer(self):
o, r = self.execute_command("taskkill /F /T /IM indexer*")
self.log_command_output(o, r) |
generate code for the following |
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
|
give python code to |
def set_environment_variable(self, name, value):
"""Request an interactive shell session, export custom variable and
restart Couchbase server.
Shell session is necessary because basic SSH client is stateless.
:param name: environment variable
:param value: environment variable... | Request an interactive shell session, export custom variable and
restart Couchbase server.
Shell session is necessary because basic SSH client is stateless.
|
give a 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 comment for above | def get_collection_config(collection, config):
"""
Get collection configuration
:param collection: collection name to get configuration for
:param config: config
:return: dict of collection information
"""
collection_config = {}
for section in config.secti... | def get_collection_config(collection, config):
collection_config = {}
for section in config.sections():
if section == collection:
options = config.options(section)
for option in options:
if option == 'bucket':
... |
give python code to |
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.
|
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
|
generate python code for |
def pause_beam(self):
"""
Pauses the beam.smp process on remote server
:return: None
"""
o, r = self.execute_command("killall -SIGSTOP beam.smp")
self.log_command_output(o, r) | Pauses the beam.smp process on remote server
|
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()
init_file = "couchbase-server"
file_path = "/opt/couchbase/bin/"
environmentVariables = ""
backupfile = file_path + init_file + ".bak"
sourceFile = file_path ... |
generate comment. | 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 comment for following function: | def get_info_for_server(server):
"""
Get info about given server, if available
:param server: server to get the information of
:return: information of the server if available else None
"""
if server.ip in RemoteMachineShellConnection.__info_dict:
return Remote... | def get_info_for_server(server):
if server.ip in RemoteMachineShellConnection.__info_dict:
return RemoteMachineShellConnection.__info_dict[server.ip] |
give python code to |
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
|
Code the following: |
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... | Create a remote file from input string
|
generate doc string 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... |
generate python code for the following |
def get_ip_address(self):
"""
Get ip address of a remote server
:return: ip address of remote server
"""
ip_type = "inet \K[\d.]"
ipv6_server = False
if "ip6" in self.ip or self.ip.startswith("["):
ipv6_server = True
ip_type = "inet6 \K[0-... | Get ip address of a remote server
|
generate comment for above | def __init__(self, test_server, info=None):
"""
Creates a new shell connection for Unix based platforms
:param test_server: test server to create the shell connection for
:param info: None
"""
super(Unix, self).__init__(test_server)
self.nonroot = False
se... | def __init__(self, test_server, info=None):
super(Unix, self).__init__(test_server)
self.nonroot = False
self.info = info |
generate python code for the above |
def stop_membase(self):
"""
Override method
"""
raise NotImplementedError | Override method |
generate comment for following function: | 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 doc string for following function: | def get_collection_config(collection, config):
"""
Get collection configuration
:param collection: collection name to get configuration for
:param config: config
:return: dict of collection information
"""
collection_config = {}
for section in config.secti... | def get_collection_config(collection, config):
collection_config = {}
for section in config.sections():
if section == collection:
options = config.options(section)
for option in options:
if option == 'bucket':
... |
def populate_cb_server_versions(self):
"""
Update the BuildUrl with all versions of Couchbase Server currently available for testing. \n
This method gets the current versions of Couchbase Servers available from the CB server manifest and
updates the missing versions in BuildUrl constants... | def populate_cb_server_versions(self):
cb_server_manifests_url = "https://github.com/couchbase" \
"/manifest/tree/master/couchbase-server/"
raw_content_url = "https://raw.githubusercontent.com/couchbase" \
"/manifest/master/couchbase-s... | |
generate python code for the following |
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
|
give a code to |
def ram_stress(self, stop_time):
"""
Applies memory stress for a specified duration with 3 workers each of size 2.5G.
:param stop_time: duration to apply the memory stress for.
:return: None
"""
o, r = self.execute_command("stress --vm 3 --vm-bytes 2.5G --timeout {}".f... | Applies memory stress for a specified duration with 3 workers each of size 2.5G.
|
generate python code for the following |
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
|
generate python code for the following | from shell_util.shell_conn import ShellConnection
def get_info_for_server(server):
"""
Get info about given server, if available
:param server: server to get the information of
:return: information of the server if available else None
"""
if server.ip in RemoteMachineShe... | Get info about given server, if available
|
generate python code for the above |
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 comment for above | def __init__(self, logger):
"""
Creates an instance of InstallHelper object
:param logger: logger object
"""
self.log = logger | def __init__(self, logger):
self.log = logger |
generate code for the above: |
def cleanup_all_configuration(self, data_path):
"""
Deletes the contents of the parent folder that holds the data and config directories.
Override method for Windows
:param data_path: The path key from the /nodes/self end-point which
looks something like "/opt/couchbase/var/lib... | Deletes the contents of the parent folder that holds the data and config directories.
Override method for Windows
|
Code the following: |
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 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.
|
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 code for the above: | from time import sleep
def sleep(seconds, msg=""):
"""
Sleep for specified number of seconds. Optionally log a message given
:param seconds: number of seconds to sleep for
:param msg: optional message to log
:return: None
"""
if msg:
log.info(msg)
... | Sleep for specified number of seconds. Optionally log a message given
|
generate python code for |
def terminate_processes(self, info, p_list):
"""
Terminate a list of processes on remote server
:param info: None
:param p_list: List of processes to terminate
:return: None
"""
for process in p_list:
# set debug=False if does not want to show log
... | Terminate a list of processes on remote server
|
generate python code for |
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("op... | Starts couchbase on remote server
|
generate doc string for following function: | 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 | def disable_disk_readonly(self, disk_location):
raise NotImplementedError |
generate comment for following function: | 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 |
generate python 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.
|
generate code for the above: | import re
import configparser
def parse_from_file(file):
"""
Parse the test inputs from file
:param file: path to file to parse
:return: TestInput object
"""
count = 0
start = 0
end = 0
servers = list()
ips = list()
input = TestInp... | Parse the test inputs from file
|
give a code to |
def reboot_node(self):
"""
Reboot the remote server
:return: None
"""
o, r = self.execute_command("shutdown -r -f -t 0")
self.log_command_output(o, r) | Reboot the remote server
|
Code the following: |
def reboot_node(self):
"""
Reboot the remote server
:return: None
"""
o, r = self.execute_command("shutdown -r -f -t 0")
self.log_command_output(o, r) | Reboot the remote server
|
def __init__(self, test_server, info=None):
"""
Creates a new shell connection for Linux based platforms
:param test_server: test server to create the shell connection for
:param info: None
"""
super(Linux, self).__init__(test_server)
self.nonroot = False
... | def __init__(self, test_server, info=None):
super(Linux, self).__init__(test_server)
self.nonroot = False
self.use_sudo = False
self.info = info | |
generate doc string for following function: | 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) | def stop_indexer(self):
o, r = self.execute_command("kill -SIGSTOP $(pgrep indexer)")
self.log_command_output(o, r, debug=False) |
generate python code for the above |
def reconnect_if_inactive(self):
"""
If the SSH channel is inactive, retry the connection
:return: None
"""
tp = self._ssh_client.get_transport()
if tp and not tp.active:
log.warning("SSH connection to {} inactive, reconnecting...".format(self.ip))
... | If the SSH channel is inactive, retry the connection
|
def wait_till_file_added(self, remotepath, filename, timeout_in_seconds=180):
"""
Wait until the remote file in remote path is created
:param remotepath: remote path of the file to be created
:param filename: name of the file to be created
:param timeout_in_seconds: wait time i... | Wait until the remote file in remote path is created
| |
generate python code for the following |
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) | Terminate a list of processes on remote server
|
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 |
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 a code to |
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 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.
|
generate comment. | 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
... | def copy_file_local_to_remote(self, src_path, des_path):
result = True
sftp = self._ssh_client.open_sftp()
try:
sftp.put(src_path, des_path)
except IOError:
self.log.error('Can not copy file')
result = False
finally:
sftp.c... |
generate python code for |
def get_cbbackupmgr_config(config, section):
"""
Get CB backup manager configuration
:param config: config
:param section: section to get configuration from
:return: dict of configuration options
"""
options = {}
for option in config.options(section):
... | Get CB backup manager configuration
|
Code 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.
|
generate doc string for following function: | def get_server(ip, config):
"""
Get the server information from the config
:param ip: ip to get information for
:param config: config
:return: TestInputServer object
"""
server = TestInputServer()
server.ip = ip
server.bkrs_client = False
f... | def get_server(ip, config):
server = TestInputServer()
server.ip = ip
server.bkrs_client = False
for section in config.sections():
if section == ip:
options = config.options(section)
for option in options:
if option... |
def unpause_memcached(self, os="linux"):
"""
Unpauses the memcached process on remote server
:param os: os type of remote server
:return: None
"""
log.info("*** unpause memcached process ***")
if self.nonroot:
o, r = self.execute_command("killall -SI... | Unpauses the memcached process on remote server
| |
generate python code for the above |
def get_full_hostname(self):
"""
Get the full hostname of the remote server
Override method for windows
:return: full hostname if domain is set, else None
"""
if not self.info.domain:
return None
return '%s.%s' % (self.info.hostname[0], self.info.dom... | Get the full hostname of the remote server
Override method for windows
|
generate comment. | def start_memcached(self):
"""
Start memcached process on remote server
:return: None
"""
o, r = self.execute_command("taskkill /F /T /IM memcached")
self.log_command_output(o, r, debug=False) | def start_memcached(self):
o, r = self.execute_command("taskkill /F /T /IM memcached")
self.log_command_output(o, r, debug=False) |
generate code for the above: |
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... | Reads the content of a remote file specified by the path.
|
generate comment: | def kill_memcached(self, num_retries=10, poll_interval=2):
"""
Kill memcached process on remote server
:param num_retries: number of times to retry killing the memcached process
:param poll_interval: time to wait before each retry in seconds
:return: output and error of command k... | def kill_memcached(self, num_retries=10, poll_interval=2):
o, r = self.execute_command("taskkill /F /T /IM memcached*")
self.log_command_output(o, r, debug=False) |
generate code for the above: |
def kill_memcached(self, num_retries=10, poll_interval=2):
"""
Kill memcached process on remote server
:param num_retries: number of times to retry killing the memcached process
:param poll_interval: time to wait before each retry in seconds
:return: output and error of command... | Kill memcached process on remote server
|
generate comment for above | def set_environment_variable(self, name, value):
"""
Request an interactive shell session, export custom variable and
restart Couchbase server.
Shell session is necessary because basic SSH client is stateless.
:param name: environment variable
:param value: environment v... | def set_environment_variable(self, name, value):
shell = self._ssh_client.invoke_shell()
shell.send('net stop CouchbaseServer\n')
shell.send('set {0}={1}\n'.format(name, value))
shell.send('net start CouchbaseServer\n')
shell.close() |
generate comment. | def get_domain(self, win_info=None):
"""
Get the domain of the remote server.
:param win_info: Windows info in case of windows server
:return: domain of the remote server if found else None
"""
if win_info:
o, _ = self.execute_batch_command('ipconfig')
... | def get_domain(self, win_info=None):
if win_info:
o, _ = self.execute_batch_command('ipconfig')
""" remove empty element |
give python code to |
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
|
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 python code to |
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
|
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 comment for above | def copy_files_local_to_remote(self, src_path, des_path):
"""
Copy multi files from local to remote server
:param src_path: source path of the files to be copied
:param des_path: destination path of the files to be copied
:return: None
"""
files = os.listdir(src_p... | def copy_files_local_to_remote(self, src_path, des_path):
files = os.listdir(src_path)
self.log.info("copy files from {0} to {1}".format(src_path, des_path))
# self.execute_batch_command("cp -r {0}/* {1}".format(src_path, des_path))
for file in files:
if file.find("... |
generate python code for the above |
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/op... | Check if the couchbase installed is enterprise edition or not
|
generate comment for following function: | 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 to monitor the process till, in sec... | def monitor_process(self, process_name, duration_in_seconds=120):
end_time = time.time() + float(duration_in_seconds)
last_reported_pid = None
while time.time() < end_time:
process = self.is_process_running(process_name)
if process:
if not last_re... |
give python code to |
def unpause_memcached(self, os="linux"):
"""
Unpauses the memcached process on remote server
:param os: os type of remote server
:return: None
"""
log.info("*** unpause memcached process ***")
if self.nonroot:
o, r = self.execute_command("killall -SI... | Unpauses the memcached process on remote server
|
generate python code for |
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 execute_command(self, command, info=None, debug=True,
use_channel=False, timeout=600, get_exit_code=False):
"""
Executes a given command on the remote machine.
:param command: The command to execute.
:param info: Additional information for execution (option... | Executes a given command on the remote machine.
|
generate code for the following |
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 python code for the above | import urllib.request
def download_build_locally(self, build_url):
"""
Downloads the Couchbase build locally
:param build_url: Download url to download the build from
:return: tuple containing the path to the download build file as well as the resulting HTTPMessage object.
"""
... | Downloads the Couchbase build locally
|
give python code to |
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 doc string for following function: | 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) |
generate comment. | def cbbackupmgr_param(self, name, *args):
"""
Returns the config value from the ini whose key matches 'name' and is stored under the 'cbbackupmgr'
section heading.
:param name: the key under which an expected value is stored.
:param args: expects a single parameter which will be ... | def cbbackupmgr_param(self, name, *args):
if name in self.cbbackupmgr:
return TestInput._parse_param(self.cbbackupmgr[name])
if len(args) == 1:
return args[0]
if self.cbbackupmgr["name"] != "local_bkrs":
raise Exception(f"Parameter '{name}' must be se... |
generate doc string for following function: | 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(location... | def unmount_partition(self, location):
command = "umount -l {0}; df -Th".format(location)
output, error = self.execute_command(command)
return output, error |
generate doc string for following function: | 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 = F... | def _check_output(self, word_check, output):
found = False
if len(output) >= 1:
if isinstance(word_check, list):
for ele in word_check:
for x in output:
if ele.lower() in str(x.lower()):
log.info... |
Code 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
|
Code the following: |
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 python code for the following |
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 code for the following |
def reset_env_variables(self):
"""
Reset environment previously set and restart couchbase server
:return: None
"""
shell = self._ssh_client.invoke_shell()
if getattr(self, "info", None) is None:
self.info = self.extract_remote_info()
init_file = "cou... | Reset environment previously set and restart couchbase server
|
generate code for the above: |
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
|
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:
... | def get_os(info):
os = info.distribution_version.lower()
to_be_replaced = ['\n', ' ', 'gnu/linux']
for _ in to_be_replaced:
if _ in os:
os = os.replace(_, '')
if info.deliverable_type == "dmg":
major_version = os.split('.')
os ... | |
generate comment: | 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 wi... | def get_disk_info(self, win_info=None, mac=False):
if win_info:
if 'Total Physical Memory' not in win_info:
win_info = self.create_windows_info()
o = "Total Physical Memory =" + win_info['Total Physical Memory'] + '\n'
o += "Available Physical Memory ... |
generate python code for the above |
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 python code for |
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
|
generate comment for following function: | def cpu_stress(self, stop_time):
"""
Applies CPU stress for a specified duration on the 20 CPU cores.
:param stop_time: duration to apply the CPU stress for.
:return: None
"""
o, r = self.execute_command("stress --cpu 20 --timeout {}".format(stop_time))
self.log_... | def cpu_stress(self, stop_time):
o, r = self.execute_command("stress --cpu 20 --timeout {}".format(stop_time))
self.log_command_output(o, r) |
def execute_batch_command(self, command):
"""
Execute a batch of commands.
This method copies the commands onto a batch file, changes the file type to executable and then executes them
on the remote server
:param command: commands to execute in a batch
:return: output o... | Execute a batch of commands.
This method copies the commands onto a batch file, changes the file type to executable and then executes them
on the remote server
| |
generate python code for the above |
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 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
|
generate comment. | 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 code for the above: |
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 for above | def mount_partition(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.ext3 {0}; df -Thl".form... | def mount_partition(self, location):
command = "mount -o loop,rw,usrquota,grpquota /usr/disk-img/disk-quota.ext3 {0}; df -Thl".format(location)
output, error = self.execute_command(command)
return output, error |
End of preview. Expand in Data Studio
README.md exists but content is empty.
- Downloads last month
- 11