How to use get_automation_execution method in localstack

Best Python code snippet using localstack_python

check_build_function.py

Source:check_build_function.py Github

copy

Full Screen

...35 Check Build SSM automation36 '''37 client = boto3.client('ssm', region_name=region)38 try:39 ssm_response = client.get_automation_execution(40 AutomationExecutionId=build_automation_execution_id41 )42 state_pending = False43 state_in_progress = False44 state_waiting = False45 state_success = False46 state_cancelling = False47 state_failed = False48 state_cancelled = False49 state_timed_out = False50 if ssm_response['AutomationExecution']['AutomationExecutionStatus'] == 'Pending':51 state_pending = True52 elif ssm_response['AutomationExecution']['AutomationExecutionStatus'] == 'InProgress':53 state_in_progress = True54 elif ssm_response['AutomationExecution']['AutomationExecutionStatus'] == 'Waiting':55 state_waiting = True56 elif ssm_response['AutomationExecution']['AutomationExecutionStatus'] == 'Success':57 state_success = True58 elif ssm_response['AutomationExecution']['AutomationExecutionStatus'] == 'Cancelling':59 state_cancelling = True60 elif ssm_response['AutomationExecution']['AutomationExecutionStatus'] == 'Failed':61 state_failed = True62 elif ssm_response['AutomationExecution']['AutomationExecutionStatus'] == 'Cancelled':63 state_cancelled = True64 elif ssm_response['AutomationExecution']['AutomationExecutionStatus'] == 'TimedOut':65 state_timed_out = True66 else:67 print("State Unknown")68 if state_pending or state_in_progress or state_waiting:69 state = 'running'70 elif state_success:71 state = 'succeeded'72 elif state_cancelling or state_failed or state_cancelled or state_timed_out:73 state = 'failed'74 else:75 state = 'unknown'76 except botocore.exceptions.ClientError as exc:77 print(exc)78 raise exc79 return state80def get_instance_id(region, build_automation_execution_id):81 '''82 Get instance ID for build instance83 '''84 client = boto3.client('ssm', region_name=region)85 try:86 ssm_response = client.get_automation_execution(87 AutomationExecutionId=build_automation_execution_id88 )89 scan_output = ssm_response['AutomationExecution']['Outputs']['startInstances.InstanceIds'][0]90 scan_output_format = scan_output.strip()91 instance_id = scan_output_format.strip('"')92 except botocore.exceptions.ClientError as exc:93 print(exc)94 raise exc...

Full Screen

Full Screen

update_ami.py

Source:update_ami.py Github

copy

Full Screen

...51 Parameters = {"InstanceId": [ami_instance_id]})52 executionid = response["AutomationExecutionId"]53 status = "InProgress"54 while status in ["Pending","InProgress"]:55 updated = ssmclient.get_automation_execution(AutomationExecutionId = executionid)56 status = updated['AutomationExecution']['AutomationExecutionStatus']57 print(updated)58 print(status)59 time.sleep(1)60 ## Now turn off the instance. 61 except Exception as e:62 print(e)63 ## Terminate. ...

Full Screen

Full Screen

lambda.py

Source:lambda.py Github

copy

Full Screen

...17 #step218 #replace AutomationExecutionId with parameter 19 response = ssm.describe_automation_step_executions(AutomationExecutionId=executionId)20 time.sleep(2)21 status = ssm.get_automation_execution(AutomationExecutionId=executionId)22 #step323 #send response varible to sns24 message = response['StepExecutions']25 overallstatus = status['AutomationExecution']26 aggregatemessage = "%sAutomationExecutionId: %s \n" % (aggregatemessage, str(overallstatus['AutomationExecutionId']))27 aggregatemessage = "%sOverall Execution Status: %s \n" % (aggregatemessage, str(overallstatus['AutomationExecutionStatus']))28 print(aggregatemessage)29 aggregatemessage = "%s########################################################\n" % (aggregatemessage)30 for step in message:31 if step['StepStatus'] == 'Success' or step['StepStatus'] == 'Pending':32 aggregatemessage = "%sStepName: %s\n" % (aggregatemessage, step['StepName'])33 aggregatemessage = "%sStepStatus: %s\n" % (aggregatemessage, step['StepStatus'])34 else:35 for item in step:...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run localstack automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful