Sign in

Start an ec2 instance

There was a problem that the LLM was not able to address. Please rephrase your prompt and try again.
cmd = f'aws ec2 start-instances --instance-ids {instance_id}' op = _exe(None, cmd) msg = "Instance was down. Restarted the instance" print(msg) task_title = context.task_title msg_type = "SUCCESS" context.job_context[task_title] = {"msg" : msg, "msg_type" : msg_type}
copied
  1. 1

    Wait until the instance is running

    There was a problem that the LLM was not able to address. Please rephrase your prompt and try again.

    It takes a few seconds for the instance to come up. Keep checking the status for a few seconds. After a specified number of iterations, just give up and print an error message.

    import time op = "" iter = 0 if "running" not in op and iter < 3: cmd = f'aws ec2 describe-instances --instance-ids {instance_id} --query "Reservations[].Instances[].State.Name" --output text' op = _exe(None, cmd) iter = iter + 1 time.sleep(60) cmd = f'aws ec2 describe-instances --instance-ids {instance_id} --query "Reservations[].Instances[].State.Name" --output text' op = _exe(None, cmd) task_title = context.task_title if "running" not in op: msg = f"Giving up. The host doesn't seem to be coming up: {instance_id}" msg_type = "ERROR" print(msg) context.proceed = False else: msg = f"This instance {instance_id} is now running" msg_type = "SUCCESS" print(msg) context.log(msg_type, msg) context.job_context[task_title] = {"msg" : msg, "msg_type" : msg_type}
    copied
    1
  2. 2

    Mount the volumes if needed

    There was a problem that the LLM was not able to address. Please rephrase your prompt and try again.
    mount /dev/xvdb /data
    copied
    2