Skip to content
This repository has been archived by the owner on Feb 17, 2022. It is now read-only.

fixed static proxy source share adjusters #43

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions tellapart/aurproxy/app/module/http.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,29 +20,29 @@
from flask import (
Blueprint,
Response)
from flask.ext import restful
import flask_restful

from tellapart.aurproxy.app import lifecycle
from tellapart.aurproxy.metrics.store import root_metric_store

# Define a standard blueprint for lifecycle management endpoints
lifecycle_blueprint = Blueprint('lifecycle', __name__)
_bp = restful.Api(lifecycle_blueprint)
_bp = flask_restful.Api(lifecycle_blueprint)

@_bp.resource('/quitquitquit')
class QuitQuitQuit(restful.Resource):
class QuitQuitQuit(flask_restful.Resource):
def post(self):
lifecycle.execute_shutdown_handlers()
return 'OK', 200

@_bp.resource('/abortabortabort')
class AbortAbortAbort(restful.Resource):
class AbortAbortAbort(flask_restful.Resource):
def post(self):
lifecycle.execute_shutdown_handlers()
return 'OK', 200

@_bp.resource('/health')
class Health(restful.Resource):
class Health(flask_restful.Resource):
def get(self):
status, message = lifecycle.check_health()
if not status:
Expand All @@ -52,7 +52,7 @@ def get(self):
return Response(response='OK')

@_bp.resource('/metrics')
class Metrics(restful.Resource):
class Metrics(flask_restful.Resource):
def get(self):
metrics = root_metric_store().get_metrics()
ordered_metrics = sorted(metrics, key=lambda metric: metric.name)
Expand All @@ -61,7 +61,7 @@ def get(self):
return Response(response=joined)

@_bp.resource('/metrics.json')
class MetricsJson(restful.Resource):
class MetricsJson(flask_restful.Resource):
def get(self):
metrics = root_metric_store().get_metrics()
ordered_metrics = sorted(metrics, key=lambda metric: metric.name)
Expand Down
9 changes: 5 additions & 4 deletions tellapart/aurproxy/source/sources/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
from flask import (
Blueprint,
request)
from flask.ext.restful import (

from flask_restful import (
abort,
Api,
Resource)
Expand Down Expand Up @@ -51,17 +52,17 @@ def __init__(self,
name,
source_whitelist=_DEFAULT_SOURCE_WHITELIST,
signal_update_fn=None,
share_updater_factories=None):
share_adjuster_factories=None):
"""
Args:
name - Required str name of this API source. Should be unique per
aurproxy task instance.
source_whitelist - Optional list(str) of source class paths that are
allowed to be instantiated.
signal_update_fn - Optional callback fn - used to signal need to update.
share_updater_factories - Optional list of ShareAdjuster factories.
share_adjuster_factories - Optional list of ShareAdjuster factories.
"""
super(ApiSource, self).__init__(signal_update_fn, share_updater_factories)
super(ApiSource, self).__init__(signal_update_fn, share_adjuster_factories)
if not name:
raise AurProxyConfigException(name)
self._name = name
Expand Down
4 changes: 2 additions & 2 deletions tellapart/aurproxy/source/sources/static.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ class StaticProxySource(ProxySource):

def __init__(self,
signal_update_fn=None,
share_updater_factories=None,
share_adjuster_factories=None,
**kwargs):
super(StaticProxySource, self).__init__(signal_update_fn,
share_updater_factories)
share_adjuster_factories)
self._name = kwargs.get('name')
self._host = kwargs.get('host')
self._port = kwargs.get('port')
Expand Down
2 changes: 1 addition & 1 deletion tellapart/aurproxytest/source/sources/static.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def test_static_source(self):
def noop(): pass

static_source = StaticProxySource(signal_update_fn=noop,
share_updater_factories=[],
share_adjuster_factories=[],
name=name,
host=host,
port=port)
Expand Down