Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(335)

Unified Diff: appengine/swarming/server/lease_management.py

Issue 2951023002: Only schedule termination task if an unconnected MP bot is dead (Closed)
Patch Set: Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: appengine/swarming/server/lease_management.py
diff --git a/appengine/swarming/server/lease_management.py b/appengine/swarming/server/lease_management.py
index 6b6e98ad62025aa7c96a7483189cade6303672d8..80c1c8facf34acbdd362cde7f8030c2a498b3d4d 100644
--- a/appengine/swarming/server/lease_management.py
+++ b/appengine/swarming/server/lease_management.py
@@ -906,13 +906,8 @@ def check_for_connection(machine_lease):
# The bot hasn't connected yet. If it's dead or missing, release the lease.
# At this point we have sent the connection instruction so the bot could still
# connect after we release the lease but before Machine Provider actually
- # deletes the bot. Therefore we also schedule a termination task. If the bot
- # connects, it will just shut itself down immediately.
- task_scheduler.schedule_request(
- task_request.create_termination_task(machine_lease.hostname, True),
- None,
- check_acls=False,
- )
+ # deletes the bot. Therefore we also schedule a termination task if releasing
+ # the bot. That way, if the bot connects, it will just shut itself down.
bot_info = bot_management.get_info_key(machine_lease.hostname).get()
if not bot_info:
logging.error(
@@ -920,6 +915,11 @@ def check_for_connection(machine_lease):
machine_lease.key,
machine_lease.hostname,
)
+ task_scheduler.schedule_request(
+ task_request.create_termination_task(machine_lease.hostname, True),
+ None,
+ check_acls=False,
+ )
if release(machine_lease):
clear_lease_request(machine_lease.key, machine_lease.client_request_id)
return
@@ -929,6 +929,11 @@ def check_for_connection(machine_lease):
machine_lease.key,
machine_lease.hostname,
)
+ task_scheduler.schedule_request(
+ task_request.create_termination_task(machine_lease.hostname, True),
+ None,
+ check_acls=False,
+ )
if release(machine_lease):
cleanup_bot(machine_lease)
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698