Skip to content

Commit

Permalink
Simplify resize provision validatioin
Browse files Browse the repository at this point in the history
  • Loading branch information
mmcgr committed Aug 16, 2023
1 parent 5ea9fe5 commit 07157f4
Showing 1 changed file with 4 additions and 23 deletions.
27 changes: 4 additions & 23 deletions src/testpool.jl
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,9 @@ function _validate_engine_pool!()
continue
end
# The engine exists, but is not provisioned despite our best attempts
catch
# The engine does not exist
@warn("$engine was not provisioned. Reported state was <$(response.state)>")
catch e
@warn("$engine was not provisioned. Reported error was <$e>")
end
# Something went wrong. Remove from the list and attempt to delete
delete!(TEST_ENGINE_POOL.engines, engine)
Expand Down Expand Up @@ -202,6 +203,7 @@ function _create_and_add_engines!(size::Int64)
engines[new_name] = 0
end

# Provision separately so we can do it asynchronously
@info("Provisioning $(increase) new engines")
@sync for new_name in new_names
@async try
Expand All @@ -210,27 +212,6 @@ function _create_and_add_engines!(size::Int64)
# Ignore any errors here as we check more thoroughly below
end
end

# Test all new engines and remove if they were not successfully provisioned
for new_name in new_names
try
response = get_engine(get_context(), new_name; readtimeout=30)
if response.state == "PROVISIONED"
# Success! Move on and try the next engine
continue
end
# The engine exists, but is not provisioned despite our best attempts
catch e
# The engine does not exist
end
# Something went wrong. Remove from the list and attempt to delete
delete!(engines, new_name)
try
delete_engine(get_context(), new_name; readtimeout=30)
catch
info("Attempted to remove failed engine provision", e)
end
end
end
end

Expand Down

0 comments on commit 07157f4

Please sign in to comment.