Skip to content

Commit

Permalink
Revert "add warmup context (#154)" (#157)
Browse files Browse the repository at this point in the history
This reverts commit bd11d48.
  • Loading branch information
YunchuWang authored Dec 16, 2022
1 parent 3d6797a commit 44712a7
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 31 deletions.
11 changes: 0 additions & 11 deletions azure/functions/_abc.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,6 @@ def message(self) -> str:
pass


class WarmUpContext(abc.ABC):
"""Warmup context object."""
pass


class TraceContext(abc.ABC):
"""Trace context object."""

Expand Down Expand Up @@ -131,12 +126,6 @@ def retry_context(self) -> RetryContext:
"""Context for retries to the function."""
pass

@property
@abc.abstractmethod
def warmup_context(self) -> WarmUpContext:
"""Context for warmup to the function."""
pass


class HttpRequest(abc.ABC):
"""HTTP request object."""
Expand Down
14 changes: 4 additions & 10 deletions tests/test_http_asgi.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import unittest

import azure.functions as func
from azure.functions._abc import TraceContext, RetryContext, WarmUpContext
from azure.functions._abc import TraceContext, RetryContext
from azure.functions._http_asgi import (
AsgiMiddleware
)
Expand Down Expand Up @@ -114,17 +114,15 @@ def _generate_func_context(
function_name='httptrigger',
function_directory='/home/roger/wwwroot/httptrigger',
trace_context=TraceContext,
retry_context=RetryContext,
warmup_context=WarmUpContext
retry_context=RetryContext
) -> func.Context:
class MockContext(func.Context):
def __init__(self, ii, fn, fd, tc, rc, wc):
def __init__(self, ii, fn, fd, tc, rc):
self._invocation_id = ii
self._function_name = fn
self._function_directory = fd
self._trace_context = tc
self._retry_context = rc
self._warmup_context = wc

@property
def invocation_id(self):
Expand All @@ -146,12 +144,8 @@ def trace_context(self):
def retry_context(self):
return self._retry_context

@property
def warmup_context(self):
return self._warmup_context

return MockContext(invocation_id, function_name, function_directory,
trace_context, retry_context, warmup_context)
trace_context, retry_context)

def test_middleware_calls_app(self):
app = MockAsgiApplication()
Expand Down
14 changes: 4 additions & 10 deletions tests/test_http_wsgi.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from io import StringIO, BytesIO

import azure.functions as func
from azure.functions._abc import TraceContext, RetryContext, WarmUpContext
from azure.functions._abc import TraceContext, RetryContext
from azure.functions._http import HttpResponseHeaders
from azure.functions._http_wsgi import (
WsgiRequest,
Expand Down Expand Up @@ -223,17 +223,15 @@ def _generate_func_context(
function_name='httptrigger',
function_directory='/home/roger/wwwroot/httptrigger',
trace_context=TraceContext,
retry_context=RetryContext,
warmup_context=WarmUpContext
retry_context=RetryContext
) -> func.Context:
class MockContext(func.Context):
def __init__(self, ii, fn, fd, tc, rc, wc):
def __init__(self, ii, fn, fd, tc, rc):
self._invocation_id = ii
self._function_name = fn
self._function_directory = fd
self._trace_context = tc
self._retry_context = rc
self._warmup_context = wc

@property
def invocation_id(self):
Expand All @@ -255,12 +253,8 @@ def trace_context(self):
def retry_context(self):
return self._retry_context

@property
def warmup_context(self):
return self._warmup_context

return MockContext(invocation_id, function_name, function_directory,
trace_context, retry_context, warmup_context)
trace_context, retry_context)

def _generate_wsgi_app(self,
status='200 OK',
Expand Down

0 comments on commit 44712a7

Please sign in to comment.