diff options
Diffstat (limited to 'buildscripts/resmokelib/powercycle/setup/__init__.py')
-rw-r--r-- | buildscripts/resmokelib/powercycle/setup/__init__.py | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/buildscripts/resmokelib/powercycle/setup/__init__.py b/buildscripts/resmokelib/powercycle/setup/__init__.py index f0b9be02b95..85ed66a5b88 100644 --- a/buildscripts/resmokelib/powercycle/setup/__init__.py +++ b/buildscripts/resmokelib/powercycle/setup/__init__.py @@ -15,6 +15,9 @@ class SetUpEC2Instance(PowercycleCommand): def execute(self) -> None: # pylint: disable=too-many-instance-attributes, too-many-locals, too-many-statements """:return: None.""" + default_retry_count = 2 + retry_count = int(self.expansions.get("set_up_retry_count", default_retry_count)) + # First operation - # Create remote_dir. group_cmd = f"id -Gn {self.user}" @@ -31,7 +34,7 @@ class SetUpEC2Instance(PowercycleCommand): cmds = f"{self.sudo} mkdir -p {remote_dir}; {self.sudo} chown -R {user_group} {remote_dir}; {set_permission_stmt} {remote_dir}; ls -ld {remote_dir}" cmds = f"{cmds}; {self.sudo} mkdir -p {db_path}; {self.sudo} chown -R {user_group} {db_path}; {set_permission_stmt} {db_path}; ls -ld {db_path}" - self.remote_op.operation(SSHOperation.SHELL, cmds, retry=True, retry_count=2) + self.remote_op.operation(SSHOperation.SHELL, cmds, retry=True, retry_count=retry_count) # Second operation - # Copy buildscripts and mongoDB executables to the remote host. @@ -41,7 +44,8 @@ class SetUpEC2Instance(PowercycleCommand): if os.path.isdir(shared_libs): files.append(shared_libs) - self.remote_op.operation(SSHOperation.COPY_TO, files, remote_dir, retry=True, retry_count=2) + self.remote_op.operation(SSHOperation.COPY_TO, files, remote_dir, retry=True, + retry_count=retry_count) # Third operation - # Set up virtualenv on remote. @@ -57,7 +61,7 @@ class SetUpEC2Instance(PowercycleCommand): cmds = f"{cmds}; . $activate" cmds = f"{cmds}; pip3 install -r $remote_dir/etc/pip/powercycle-requirements.txt" - self.remote_op.operation(SSHOperation.SHELL, cmds, retry=True, retry_count=2) + self.remote_op.operation(SSHOperation.SHELL, cmds, retry=True, retry_count=retry_count) # Fourth operation - # Enable core dumps on non-Windows remote hosts. @@ -81,7 +85,7 @@ class SetUpEC2Instance(PowercycleCommand): # https://unix.stackexchange.com/a/349558 in order to ensure the ssh client gets a # response from the remote machine before it restarts. cmds = f"{cmds}; nohup {self.sudo} reboot &>/dev/null & exit" - self.remote_op.operation(SSHOperation.SHELL, cmds, retry=True, retry_count=2) + self.remote_op.operation(SSHOperation.SHELL, cmds, retry=True, retry_count=retry_count) # Fifth operation - # Print the ulimit & kernel.core_pattern @@ -93,7 +97,7 @@ class SetUpEC2Instance(PowercycleCommand): cmds = f"{cmds}; then /sbin/sysctl kernel.core_pattern" cmds = f"{cmds}; fi" - self.remote_op.operation(SSHOperation.SHELL, cmds, retry=True, retry_count=2) + self.remote_op.operation(SSHOperation.SHELL, cmds, retry=True, retry_count=retry_count) # Sixth operation - # Set up curator to collect system & process stats on remote. @@ -120,7 +124,7 @@ class SetUpEC2Instance(PowercycleCommand): cmds = f"{cmds}; crontab -l" cmds = f"{cmds}; {{ {self.sudo} $HOME/curator stat system --file {monitor_system_file} > /dev/null 2>&1 & {self.sudo} $HOME/curator stat process-all --file {monitor_proc_file} > /dev/null 2>&1 & }} & disown" - self.remote_op.operation(SSHOperation.SHELL, cmds, retry=True, retry_count=2) + self.remote_op.operation(SSHOperation.SHELL, cmds, retry=True, retry_count=retry_count) # Seventh operation - # Install NotMyFault, used to crash Windows. @@ -132,4 +136,4 @@ class SetUpEC2Instance(PowercycleCommand): cmds = f"curl -s -o {windows_crash_zip} {windows_crash_dl}" cmds = f"{cmds}; unzip -q {windows_crash_zip} -d {windows_crash_dir}" cmds = f"{cmds}; chmod +x {windows_crash_dir}/*.exe" - self.remote_op.operation(SSHOperation.SHELL, cmds, retry=True, retry_count=2) + self.remote_op.operation(SSHOperation.SHELL, cmds, retry=True, retry_count=retry_count) |