Skip to content

Commit

Permalink
edge case protection against starting a worker as part of a device_gr…
Browse files Browse the repository at this point in the history
…oup that does not exist yet
  • Loading branch information
Naor Livne committed Jan 14, 2019
1 parent c0a267a commit 5f38150
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,12 @@ def get_device_group_info(nebula_connection_object, device_group_to_get_info):
# get the initial device_group configuration and store it in memory
local_device_group_info = get_device_group_info(nebula_connection, device_group)

# make sure the device_group exists in the nebula cluster
while local_device_group_info["status_code"] == 403 and \
local_device_group_info["reply"]["device_group_exists"] is False:
print("device_group " + device_group + " doesn't exist in nebula cluster, waiting for it to be created")
time.sleep(5)

# start all apps that are set to running on boot
for nebula_app in local_device_group_info["reply"]["apps"]:
if nebula_app["running"] is True:
Expand Down

0 comments on commit 5f38150

Please sign in to comment.