def _test_job_kill(remote_command_executor): logging.info("Testing job kill.") awsbatch_commands = AWSBatchCommands(remote_command_executor) result = remote_command_executor.run_remote_command("awsbsub --vcpus 2 --memory 256 --timeout 60 sleep 300") job_id = awsbatch_commands.assert_job_submitted(result.stdout) remote_command_executor.run_remote_command("awsbkill {0}".format(job_id)) status = awsbatch_commands.wait_job_completed(job_id) assert_that(status).contains_only("FAILED") result = remote_command_executor.run_remote_command("awsbstat -d {0}".format(job_id)) assert_that(result.stdout).matches(r"statusReason\s+: Terminated by the user")
def _test_job_kill(remote_command_executor, timeout): logging.info("Testing job kill.") awsbatch_commands = AWSBatchCommands(remote_command_executor) result = remote_command_executor.run_remote_command( f"awsbsub --vcpus 2 --memory 256 --timeout {timeout} sleep 300") job_id = awsbatch_commands.assert_job_submitted(result.stdout) remote_command_executor.run_remote_command("awsbkill {0}".format(job_id)) status = awsbatch_commands.wait_job_completed(job_id) assert_that(status).contains_only("FAILED") result = remote_command_executor.run_remote_command( "awsbstat -d {0}".format(job_id)) assert_that( result.stdout).matches(r"statusReason\s+: Terminated by the user")
def _test_job_submission(remote_command_executor, submit_command, additional_files=None, children_number=0): logging.debug("Submitting Batch job") awsbatch_commands = AWSBatchCommands(remote_command_executor) result = remote_command_executor.run_remote_command(submit_command, additional_files=additional_files) job_id = awsbatch_commands.assert_job_submitted(result.stdout) logging.debug("Submitted Batch job id: {0}".format(job_id)) awsbatch_commands.wait_job_completed(job_id) awsbatch_commands.assert_job_succeeded(job_id, children_number)
def _test_job_submission(remote_command_executor, submit_command, additional_files=None, children_number=0): logging.debug("Submitting Batch job") awsbatch_commands = AWSBatchCommands(remote_command_executor) result = remote_command_executor.run_remote_command( submit_command, additional_files=additional_files) job_id = awsbatch_commands.assert_job_submitted(result.stdout) logging.debug("Submitted Batch job id: {0}".format(job_id)) awsbatch_commands.wait_job_completed(job_id) awsbatch_commands.assert_job_succeeded(job_id, children_number)
def _test_job_submission(remote_command_executor, submit_command, additional_files=None, children_number=0): logging.debug("Submitting Batch job") awsbatch_commands = AWSBatchCommands(remote_command_executor) result = remote_command_executor.run_remote_command( submit_command, additional_files=additional_files) job_id = awsbatch_commands.assert_job_submitted(result.stdout) logging.debug("Submitted Batch job id: {0}".format(job_id)) awsbatch_commands.wait_job_completed(job_id) try: awsbatch_commands.assert_job_succeeded(job_id, children_number) except AssertionError: remote_command_executor.run_remote_command(f"awsbout {job_id}", raise_on_error=False, log_output=True) raise