add comments describing how to correct async creates / handle fails
This commit is contained in:
parent
5a67a58f98
commit
5a18fc7e13
@ -114,7 +114,7 @@ def init_app(app, is_running_server):
|
||||
|
||||
|
||||
|
||||
def get_model():
|
||||
def get_model() -> DBModel:
|
||||
if 'db_model' not in g:
|
||||
connection = current_app.config['PSYCOPG2_CONNECTION_POOL'].getconn()
|
||||
cursor = connection.cursor()
|
||||
|
@ -169,6 +169,10 @@ def can_claim_create(payload, host_id) -> (str, str):
|
||||
return payload, ""
|
||||
|
||||
def on_create_claimed(payload, host_id):
|
||||
# TODO this happens when the create operation is assigned to one spoke, not when the create actually succeeds...
|
||||
# VMs should probably start out in the "creating" state, and change to "booting" when the create.sh script succeeds.
|
||||
# VMs should not be billable until they reach the booting state.
|
||||
# see the corresponding TODO in spoke_api.handle_create
|
||||
get_model().create_vm(
|
||||
email=payload['email'],
|
||||
id=payload['id'],
|
||||
|
@ -144,6 +144,10 @@ def handle_create(operation_id, request_body):
|
||||
return abort(503, f"hub did not cleanly handle our request to claim the create operation")
|
||||
|
||||
if assignment_status == "assigned":
|
||||
# TODO this should probably be spun off as a coroutine
|
||||
# and at the end of that coroutine, we should set the VM's state from "creating" to "booting"
|
||||
# see the corresponding TODO in hub_api.on_create_claimed
|
||||
|
||||
try:
|
||||
current_app.config['SPOKE_MODEL'].create(
|
||||
email=request_body['email'],
|
||||
|
Loading…
Reference in New Issue
Block a user