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

Unified Diff: appengine/gce-backend/instances.py

Issue 2713533002: Refactor task enqueuing (Closed)
Patch Set: Remove metric Created 3 years, 10 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 | « appengine/gce-backend/instance_templates_test.py ('k') | appengine/gce-backend/metadata.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: appengine/gce-backend/instances.py
diff --git a/appengine/gce-backend/instances.py b/appengine/gce-backend/instances.py
index f6fcee8aca0f053feac347a47d13cba18be140a4..cd62958463fd2fdca83203f1410df1511823803f 100644
--- a/appengine/gce-backend/instances.py
+++ b/appengine/gce-backend/instances.py
@@ -12,7 +12,6 @@ from google.appengine.ext import ndb
from components import gce
from components import net
from components import pubsub
-from components import utils
import instance_group_managers
import metrics
@@ -231,17 +230,7 @@ def schedule_fetch():
"""Enqueues tasks to fetch instances."""
for instance_group_manager in models.InstanceGroupManager.query():
if instance_group_manager.url:
- if not utils.enqueue_task(
- '/internal/queues/fetch-instances',
- 'fetch-instances',
- params={
- 'key': instance_group_manager.key.urlsafe(),
- },
- ):
- logging.warning(
- 'Failed to enqueue task for InstanceGroupManager: %s',
- instance_group_manager.key,
- )
+ utilities.enqueue_task('fetch-instances', instance_group_manager.key)
def _delete(instance_template_revision, instance_group_manager, instance):
@@ -322,14 +311,7 @@ def schedule_pending_deletion():
"""Enqueues tasks to delete instances."""
for instance in models.Instance.query():
if instance.pending_deletion and not instance.deleted:
- if not utils.enqueue_task(
- '/internal/queues/delete-instance-pending-deletion',
- 'delete-instance-pending-deletion',
- params={
- 'key': instance.key.urlsafe(),
- },
- ):
- logging.warning('Failed to enqueue task for Instance: %s', instance.key)
+ utilities.enqueue_task('delete-instance-pending-deletion', instance.key)
def delete_drained(key):
@@ -399,12 +381,4 @@ def schedule_drained_deletion():
for instance_key in instance_group_manager.instances:
instance = instance_key.get()
if instance and not instance.cataloged:
- if not utils.enqueue_task(
- '/internal/queues/delete-drained-instance',
- 'delete-drained-instance',
- params={
- 'key': instance.key.urlsafe(),
- },
- ):
- logging.warning(
- 'Failed to enqueue task for Instance: %s', instance.key)
+ utilities.enqueue_task('delete-drained-instance', instance.key)
« no previous file with comments | « appengine/gce-backend/instance_templates_test.py ('k') | appengine/gce-backend/metadata.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698