instruction stringclasses 14
values | output stringlengths 105 12.9k | input stringlengths 0 4.12k |
|---|---|---|
Code the following: |
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 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 install(self, build_url):
"""
Installs Couchbase server on Unix machine
:param build_url: build url to get the Couchbase package from
:return: True on successful installation else False
"""
cmd = self.cmds["install"]
if self.shell.nonroot:
cmd = se... | def install(self, build_url):
cmd = self.cmds["install"]
if self.shell.nonroot:
cmd = self.non_root_cmds["install"]
f_name = build_url.split("/")[-1]
cmd = cmd.replace("buildpath", "{}/{}"
.format(self.download_dir, f_name))
self.she... | |
generate code for the following |
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.
|
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
|
generate python code for the following |
def __init__(self, logger, node_install_info, steps):
"""
Creates an instance of the NodeInstaller object. This object is used to install Couchbase server builds
on remote servers.
:param logger: logger object for logging
:param node_install_info: node install info of type Node... | Creates an instance of the NodeInstaller object. This object is used to install Couchbase server builds
on remote servers.
|
generate comment for above | 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 python code for the following |
def __init__(self, logger, node_install_info):
"""
Creates an instance of the InstallSteps class.
:param logger:
:param node_install_info:
"""
self.log = logger
self.node_install_info = node_install_info
self.result = True | Creates an instance of the InstallSteps class.
|
generate python code for |
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
|
Code 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_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-9a... | def get_ip_address(self):
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-9a-zA-Z:]"
cmd = "ifconfig | grep -Po '{0}+'".format(ip_type)
o, r = self.execute_comma... | |
generate comment for above | def __construct_build_url(self, is_debuginfo_build=False):
"""
Constructs the build url for the given node.
This url is used to download the installation package.
:param is_debuginfo_build: gets debug_info build url if True
:return: build url
"""
file_name = None
... | def __construct_build_url(self, is_debuginfo_build=False):
file_name = None
build_version = self.node_install_info.version.split("-")
os_type = self.node_install_info.os_type
node_info = RemoteMachineShellConnection.get_info_for_server(
self.node_install_info.server)... |
generate python code for the above |
def start_and_wait_for_threads(thread_list, timeout):
"""
Start the threads in the thread list and wait for the threads to finish. \n
Wait until the thread finishes or the timeout is reached.
:param thread_list: list of threads to run
:param timeout: timeout to wait till threads are finished
:... | Start the threads in the thread list and wait for the threads to finish.
Wait until the thread finishes or the timeout is reached.
|
generate python code for |
def execute_commands_inside(self, main_command, query, queries,
bucket1, password, bucket2, source,
subcommands=[], min_output_size=0,
end_msg='', timeout=250):
"""
Override method to handle windows specifi... | Override method to handle windows specific file name |
generate comment. | def start_memcached(self):
"""
Start memcached process on remote server
:return: None
"""
o, r = self.execute_command("kill -SIGCONT $(pgrep memcached)")
self.log_command_output(o, r, debug=False) | def start_memcached(self):
o, r = self.execute_command("kill -SIGCONT $(pgrep memcached)")
self.log_command_output(o, r, debug=False) |
generate comment for following function: | def connect_with_user(self, user="root"):
"""
Connect to the remote server with given user
:param user: user to connect to remote server with
:return: None
"""
self.ssh_connect_with_retries(self.ip, user, self.server.password,
self.se... | def connect_with_user(self, user="root"):
self.ssh_connect_with_retries(self.ip, user, self.server.password,
self.server.ssh_key) |
generate comment. | def copy_files_local_to_remote(self, src_path, des_path):
"""
Copy multi files from local to remote server
:param src_path: source path of the files to be copied
:param des_path: destination path of the files to be copied
:return: None
"""
files = os.listdir(src_p... | def copy_files_local_to_remote(self, src_path, des_path):
files = os.listdir(src_path)
self.log.info("copy files from {0} to {1}".format(src_path, des_path))
# self.execute_batch_command("cp -r {0}/* {1}".format(src_path, des_path))
for file in files:
if file.find("... |
generate comment. | def disable_firewall(self):
"""
Clear firewall rules on the remote server
:return: None
"""
output, error = self.execute_command('netsh advfirewall set publicprofile state off')
self.log_command_output(output, error)
output, error = self.execute_command('netsh adv... | def disable_firewall(self):
output, error = self.execute_command('netsh advfirewall set publicprofile state off')
self.log_command_output(output, error)
output, error = self.execute_command('netsh advfirewall set privateprofile state off')
self.log_command_output(output, error)
... |
generate comment. | 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 defa... | def param(self, name, *args):
if name in self.test_params:
return TestInput._parse_param(self.test_params[name])
elif len(args) == 1:
return args[0]
else:
raise Exception("Parameter `{}` must be set "
"in the test configura... |
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
|
generate code for the above: |
def __init__(self, logger, node_install_info):
"""
Creates an instance of the InstallSteps class.
:param logger:
:param node_install_info:
"""
self.log = logger
self.node_install_info = node_install_info
self.result = True | Creates an instance of the InstallSteps class.
|
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
| |
give a 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.
|
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 python code for the above |
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 comment for above | def start_server(self):
"""
Starts the Couchbase server on the remote server.
The method runs the sever from non-default location if it's run as nonroot user. Else from default location.
:return: None
"""
o, r = self.execute_command("net start couchbaseserver")
se... | def start_server(self):
o, r = self.execute_command("net start couchbaseserver")
self.log_command_output(o, r) |
generate comment. | def execute_cbcollect_info(self, file, options=""):
"""
Execute cbcollect command on remote server
:param file: file name to store the cbcollect as
:param options: options for the cbcollect command
:return: output of the cbcollect command
"""
cbcollect_command = "... | def execute_cbcollect_info(self, file, options=""):
cbcollect_command = "%scbcollect_info" % (LINUX_COUCHBASE_BIN_PATH)
if self.nonroot:
cbcollect_command = "%scbcollect_info" % (LINUX_NONROOT_CB_BIN_PATH)
self.extract_remote_info()
if self.info.type.lower() == 'wind... |
generate python code for |
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.
|
generate code for the following |
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.lo... | Applies CPU stress for a specified duration on the 20 CPU cores.
|
generate python code for the following |
def change_log_level(self, new_log_level):
"""
Change the log level of couchbase processes on a remote server
:param new_log_level: new log level to set
:return: None
"""
log.info("CHANGE LOG LEVEL TO %s".format(new_log_level))
# ADD NON_ROOT user config_details... | Change the log level of couchbase processes on a remote server
|
Code the following: | import os
from subprocess import Popen
from typing import re
def execute_commands_inside(self, main_command, query, queries,
bucket1, password, bucket2, source,
subcommands=[], min_output_size=0,
end_msg='', timeout=250):
... | |
generate comment: | def change_system_time(self, time_change_in_seconds):
"""
Change the system time by specified number of seconds
Note that time change may be positive or negative
:param time_change_in_seconds: number of seconds to change the system time by
:return: True if change was successful e... | def change_system_time(self, time_change_in_seconds):
# need to support Windows too
output, error = self.execute_command("date +%s")
if len(error) > 0:
return False
curr_time = int(output[-1])
new_time = curr_time + time_change_in_seconds
output, err... |
generate 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.
|
generate doc string for following function: | def write_remote_file(self, remote_path, filename, lines):
"""
Writes content to a remote file specified by the path.
:param remote_path: Remote path to write the file to.
:param filename: Name of the file to write to.
:param lines: Lines to write to the file.
:return: No... | def write_remote_file(self, remote_path, filename, lines):
cmd = 'echo "%s" > %s/%s' % (''.join(lines), remote_path, filename)
self.execute_command(cmd) |
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 code for the following | 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.
|
Code the following: |
def get_process_id(self, process_name):
"""
Get the process id for the given process
:param process_name: name of the process to get pid for
:return: pid of the process
"""
process_id, _ = self.execute_command(
"ps -ef | grep \"%s \" | grep -v grep | awk '{p... | Get the process id for the given process
|
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
| |
give python code to |
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
|
generate python code for the following |
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 python code for the 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.sec... | Get collection configuration
|
generate comment: | def execute_command_raw(self, command, debug=True, use_channel=False,
timeout=600, get_exit_code=False):
"""
Implementation to execute a given command on the remote machine or on local machine.
:param command: The raw command to execute.
:param debug: Enables... | def execute_command_raw(self, command, debug=True, use_channel=False,
timeout=600, get_exit_code=False):
self.log.debug("%s - Running command.raw: %s" % (self.ip, command))
self.reconnect_if_inactive()
output = []
error = []
temp = ''
... |
Code 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 python code to |
def update_dist_type(self):
"""
Update the distribution type for linux
:return:
"""
output, error = self.execute_command(
"echo '{{dist_type,inet6_tcp}}.' > {0}".format(LINUX_DIST_CONFIG))
self.log_command_output(output, error) | Update the distribution type for linux
|
Code the following: |
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 comment. | def kill_cbft_process(self):
"""
Kill the full text search process on remote server
:return: output and error of command killing FTS process
"""
o, r = self.execute_command("killall -9 cbft")
self.log_command_output(o, r)
if r and r[0] and "command not found" in r... | def kill_cbft_process(self):
o, r = self.execute_command("killall -9 cbft")
self.log_command_output(o, r)
if r and r[0] and "command not found" in r[0]:
o, r = self.execute_command("pkill cbft")
self.log_command_output(o, r)
return o, r |
give a code to |
def kill_erlang(self, os="unix", delay=0):
"""
Kill the erlang process in the remote server. If delay is specified, the process is killed after the
delay
:param delay: time to delay the process kill
:return: output and error of executing process kill command
"""
... | Kill the erlang process in the remote server. If delay is specified, the process is killed after the
delay
|
give a code to | from shell_util.remote_connection import RemoteMachineShellConnection
def __init__(self, test_server):
"""
Creates an instance of Unix installer class
:param test_server: server object of type TestInputServer
"""
super(Unix, self).__init__()
self.shell = RemoteMachineShe... | Creates an instance of Unix installer class
|
generate doc string for following function: | def execute_commands_inside(self, main_command, query, queries,
bucket1, password, bucket2, source,
subcommands=[], min_output_size=0,
end_msg='', timeout=250):
filename = "/tmp/test2"
filedata = ""
i... | def execute_commands_inside(self, main_command, query, queries,
bucket1, password, bucket2, source,
subcommands=[], min_output_size=0,
end_msg='', timeout=250):
filename = "/tmp/test2"
filedata = ""
i... |
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
|
generate python code for | import os
from subprocess import Popen
from typing import re
def execute_commands_inside(self, main_command, query, queries,
bucket1, password, bucket2, source,
subcommands=[], min_output_size=0,
end_msg='', timeout=250):
... | |
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 comment for above | def enable_file_size_limit(self):
"""
Change the file size limit to 20480 for indexer process
:return: None
"""
o, r = self.execute_command("prlimit --fsize=20480 --pid $(pgrep indexer)")
self.log_command_output(o, r) | def enable_file_size_limit(self):
o, r = self.execute_command("prlimit --fsize=20480 --pid $(pgrep indexer)")
self.log_command_output(o, r) |
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 doc string for following function: | 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) | def enable_network_delay(self):
o, r = self.execute_command("tc qdisc add dev eth0 root netem delay 200ms")
self.log_command_output(o, r) |
generate code for the following |
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 following function: | 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 doc string for following function: | 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 -... |
def __init__(self):
"""
Creates an instance of RemoteMachineProcess class
"""
self.pid = ''
self.name = ''
self.vsz = 0
self.rss = 0
self.args = '' | def __init__(self):
self.pid = ''
self.name = ''
self.vsz = 0
self.rss = 0
self.args = '' | |
generate doc string for following function: | def handle_command_line_u_or_v(option, argument):
"""
Parse command line arguments for -u or -v
:param option: option to parse
:param argument: argument to check
:return: parsed arguments as TestInputBuild
"""
input_build = TestInputBuild()
if option == "-... | def handle_command_line_u_or_v(option, argument):
input_build = TestInputBuild()
if option == "-u":
# let's check whether this url exists or not
# let's extract version from this url
pass
if option == "-v":
allbuilds = BuildQuery().get_all... |
generate python code for |
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
|
give python code to |
def disable_file_size_limit(self):
"""
Change the file size limit to unlimited for indexer process
:return: None
"""
o, r = self.execute_command("prlimit --fsize=unlimited --pid $(pgrep indexer)")
self.log_command_output(o, r) | Change the file size limit to unlimited for indexer process
|
generate python code for |
def __init__(self, logger, node_install_info, steps):
"""
Creates an instance of the NodeInstaller object. This object is used to install Couchbase server builds
on remote servers.
:param logger: logger object for logging
:param node_install_info: node install info of type Node... | Creates an instance of the NodeInstaller object. This object is used to install Couchbase server builds
on remote servers.
|
generate python code for the following |
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 comment for following function: | def handle_command_line_u_or_v(option, argument):
"""
Parse command line arguments for -u or -v
:param option: option to parse
:param argument: argument to check
:return: parsed arguments as TestInputBuild
"""
input_build = TestInputBuild()
if option == "-... | def handle_command_line_u_or_v(option, argument):
input_build = TestInputBuild()
if option == "-u":
# let's check whether this url exists or not
# let's extract version from this url
pass
if option == "-v":
allbuilds = BuildQuery().get_all... |
generate 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
|
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... |
generate comment. | def reset_env_variables(self):
"""
Reset environment previously set and restart couchbase server
:return: None
"""
shell = self._ssh_client.invoke_shell()
init_file = "service_start.bat"
file_path = "/cygdrive/c/Program\ Files/Couchbase/Server/bin/"
backup... | def reset_env_variables(self):
shell = self._ssh_client.invoke_shell()
init_file = "service_start.bat"
file_path = "/cygdrive/c/Program\ Files/Couchbase/Server/bin/"
backupfile = file_path + init_file + ".bak"
sourceFile = file_path + init_file
o, r = self.execut... |
generate python code for the above |
def pause_beam(self):
"""
Pauses the beam.smp process on remote server
Override method for Windows
:return: None
"""
raise NotImplementedError | Pauses the beam.smp process on remote server
Override method for Windows
|
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 __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 comment for following function: | def __init__(self, test_server, info=None):
"""
Creates a new shell connection for Windows systems
:param test_server: test server to create the shell connection for
:param info: None
"""
super(Windows, self).__init__(test_server)
self.nonroot = True
self.... | def __init__(self, test_server, info=None):
super(Windows, self).__init__(test_server)
self.nonroot = True
self.info = info
self.cmd_ext = ".exe"
self.bin_path = "/cygdrive/c/Program\ Files/Couchbase/Server/bin/" |
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.
|
Code the following: | from subprocess import Popen
def execute_command_raw(self, command, debug=True, use_channel=False,
timeout=600, get_exit_code=False):
"""
Implementation to execute a given command on the remote machine or on local machine.
:param command: The raw command to execute.... | Implementation to execute a given command on the remote machine or on local machine.
|
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 comment. | 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 |
def get_data_file_size(self, path=None):
"""
Get the size of the file in the specified path
:param path: path of the file to get the size of
:return: size of the file in the path
"""
output, error = self.execute_command('du -b {0}'.format(path))
if error:
... | Get the size of the file in the specified path
| |
generate comment for following function: | 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) | def kill_eventing_process(self, name):
o, r = self.execute_command(command="killall -9 {0}".format(name))
self.log_command_output(o, r) |
generate python code for |
def get_mem_usage_by_process(self, process_name):
"""
Get the memory usage of a process
:param process_name: name of the process to get the memory usage for
:return: the memory usage of the process if available else None
"""
output, error = self.execute_command(
... | Get the memory usage of a process
|
generate python code for | import getopt
def parse_from_command_line(argv):
"""
Parse command line arguments
:param argv: command line arguments
:return: parsed command line arguments as TestInput
"""
input = TestInput()
try:
# -f : won't be parse here anynore
# -s... | Parse command line arguments
|
generate comment: | 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) | def restart_couchbase(self):
o, r = self.execute_command("service couchbase-server restart")
self.log_command_output(o, r) |
generate comment. | def get_memcache_pid(self):
"""
Get the pid of memcached process
:return: pid of memcached process
"""
raise NotImplementedError | def get_memcache_pid(self):
raise NotImplementedError |
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 doc string for following function: | 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 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.
|
generate doc string for following function: | 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... |
Code the following: |
def get_server_ips(config, section):
"""
Get server IPs from config
:param config: config
:param section: section to get server IPs from
:return: list of IP addresses
"""
ips = []
options = config.options(section)
for option in options:
... | Get server IPs from config
|
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
|
generate code for the following | from typing import re
def _recover_disk_full_failure(self, location):
"""
Recover the disk full failures on remote server
:param location: location of the disk to recover
:return: output and error message from recovering disk
"""
delete_file = "{0}/disk-quota.ext3".forma... | Recover the disk full failures on remote server
|
generate python code for |
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) | Change the file limite to 200000 for indexer process
|
give a code to | from shell_util.remote_connection import RemoteMachineShellConnection
def __init__(self, test_server):
"""
Creates an instance of Linux installer class
:param test_server: server object of type TestInputServer
"""
super(Linux, self).__init__()
self.shell = RemoteMachineS... | Creates an instance of Linux installer class
|
Code the following: |
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 |
give a code to |
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
|
generate doc string for following function: | def is_enterprise(self):
"""
Check if the couchbase installed is enterprise edition or not
:return: True if couchbase installed is enterprise edition else False
"""
enterprise = False
runtime_file_path = ""
if self.nonroot:
if self.file_exists("%s/opt/... | def is_enterprise(self):
enterprise = False
runtime_file_path = ""
if self.nonroot:
if self.file_exists("%s/opt/couchbase/etc/" % self.nr_home_path,
"runtime.ini"):
runtime_file_path = "%s/opt/couchbase/etc/" % self.nr_home_pat... |
generate comment. | def execute_commands_inside(self, main_command, query, queries,
bucket1, password, bucket2, source,
subcommands=[], min_output_size=0,
end_msg='', timeout=250):
filename = "/tmp/test2"
filedata = ""
i... | def execute_commands_inside(self, main_command, query, queries,
bucket1, password, bucket2, source,
subcommands=[], min_output_size=0,
end_msg='', timeout=250):
filename = "/tmp/test2"
filedata = ""
i... |
give python code to | 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 |
def get_process_id(self, process_name):
"""
Get the process id for the given process
Override method for Windows
:param process_name: name of the process to get pid for
:return: pid of the process
"""
raise NotImplementedError | Get the process id for the given process
Override method for Windows
|
generate comment for following function: | def execute_non_sudo_command(self, command, info=None, debug=True,
use_channel=False):
"""
Execute command in non-sudo mode.
:param command: command to be executed
:param info: None
:param debug: print debug information in logs if True
:pa... | def execute_non_sudo_command(self, command, info=None, debug=True,
use_channel=False):
return self.execute_command_raw(command, debug=debug,
use_channel=use_channel) |
Code the following: |
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 above: |
def __init__(self):
"""
Creates an instance of the TestInputBuild class
"""
self.version = ''
self.url = '' | Creates an instance of the TestInputBuild class |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.