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

Unified Diff: appengine/gce-backend/catalog.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 | « no previous file | appengine/gce-backend/cleanup.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: appengine/gce-backend/catalog.py
diff --git a/appengine/gce-backend/catalog.py b/appengine/gce-backend/catalog.py
index ce8d61a6eff94b40187eed8203e7eada5bd8baeb..9848acf623b43a33c6117736a21a421b88265b53 100644
--- a/appengine/gce-backend/catalog.py
+++ b/appengine/gce-backend/catalog.py
@@ -13,12 +13,12 @@ from protorpc.remote import protojson
from components import gce
from components import machine_provider
from components import net
-from components import utils
import instances
import instance_group_managers
import metrics
import models
+import utilities
def get_policies(key, service_account):
@@ -165,15 +165,7 @@ def schedule_catalog():
instance = instance_key.get()
if instance:
if not instance.cataloged and not instance.pending_deletion:
- if not utils.enqueue_task(
- '/internal/queues/catalog-instance',
- 'catalog-instance',
- params={
- 'key': instance.key.urlsafe(),
- },
- ):
- logging.warning(
- 'Failed to enqueue task for Instance: %s', instance.key)
+ utilities.enqueue_task('catalog-instance', instance.key)
def remove(key):
@@ -212,15 +204,7 @@ def schedule_removal():
for instance_key in instance_group_manager.instances:
instance = instance_key.get()
if instance and instance.cataloged:
- if not utils.enqueue_task(
- '/internal/queues/remove-cataloged-instance',
- 'remove-cataloged-instance',
- params={
- 'key': instance.key.urlsafe(),
- },
- ):
- logging.warning(
- 'Failed to enqueue task for Instance: %s', instance.key)
+ utilities.enqueue_task('remove-cataloged-instance', instance.key)
def update_cataloged_instance(key):
@@ -256,11 +240,4 @@ def schedule_cataloged_instance_update():
"""Enqueues tasks to update information about cataloged instances."""
for instance in models.Instance.query():
if instance.cataloged:
- if not utils.enqueue_task(
- '/internal/queues/update-cataloged-instance',
- 'update-cataloged-instance',
- params={
- 'key': instance.key.urlsafe(),
- },
- ):
- logging.warning('Failed to enqueue task for Instance: %s', instance.key)
+ utilities.enqueue_task('update-cataloged-instance', instance.key)
« no previous file with comments | « no previous file | appengine/gce-backend/cleanup.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698