Skip to content

Commit 1824612

Browse files
authored
Drop GRPC message size limitation (#632)
1 parent 17a69f5 commit 1824612

File tree

7 files changed

+30
-20
lines changed

7 files changed

+30
-20
lines changed

azure-pipelines.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@ trigger:
55
- master
66

77
variables:
8-
DOTNET_VERSION: '2.2.x'
8+
DOTNET_VERSION: '2.2.207'
99

1010
jobs:
1111
- job: Tests
1212
pool:
13-
vmImage: 'ubuntu-16.04'
13+
vmImage: 'ubuntu-18.04'
1414
strategy:
1515
matrix:
1616
Python36:
@@ -52,7 +52,7 @@ jobs:
5252
- job: Build_WINDOWS_X64
5353
dependsOn: 'Tests'
5454
pool:
55-
vmImage: 'vs2017-win2016'
55+
vmImage: 'windows-2019'
5656
strategy:
5757
matrix:
5858
Python36V2:
@@ -80,7 +80,7 @@ jobs:
8080
- job: Build_WINDOWS_X86
8181
dependsOn: 'Tests'
8282
pool:
83-
vmImage: 'vs2017-win2016'
83+
vmImage: 'windows-2019'
8484
strategy:
8585
matrix:
8686
Python37V2:
@@ -102,7 +102,7 @@ jobs:
102102
- job: Build_LINUX_X64
103103
dependsOn: 'Tests'
104104
pool:
105-
vmImage: 'ubuntu-16.04'
105+
vmImage: 'ubuntu-18.04'
106106
strategy:
107107
matrix:
108108
Python36V2:
@@ -129,7 +129,7 @@ jobs:
129129
- job: Build_OSX_X64
130130
dependsOn: 'Tests'
131131
pool:
132-
vmImage: 'macOS-10.13'
132+
vmImage: 'macOS-10.15'
133133
strategy:
134134
matrix:
135135
Python36V2:
@@ -161,7 +161,7 @@ jobs:
161161
'Build_OSX_X64'
162162
]
163163
pool:
164-
vmImage: 'vs2017-win2016'
164+
vmImage: 'windows-2019'
165165
strategy:
166166
matrix:
167167
V2PythonWorker:

azure_functions_worker/constants.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,8 @@
44
RPC_HTTP_BODY_ONLY = "RpcHttpBodyOnly"
55
RPC_HTTP_TRIGGER_METADATA_REMOVED = "RpcHttpTriggerMetadataRemoved"
66

7+
# Debug Flags
8+
PYAZURE_WEBHOST_DEBUG = "PYAZURE_WEBHOST_DEBUG"
9+
710
# Feature Flags (app settings)
811
PYTHON_ROLLBACK_CWD_PATH = "PYTHON_ROLLBACK_CWD_PATH"

azure_functions_worker/dispatcher.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ class Dispatcher(metaclass=DispatcherMeta):
4444
_GRPC_STOP_RESPONSE = object()
4545

4646
def __init__(self, loop, host, port, worker_id, request_id,
47-
grpc_connect_timeout, grpc_max_msg_len):
47+
grpc_connect_timeout, grpc_max_msg_len=-1):
4848
self._loop = loop
4949
self._host = host
5050
self._port = port
@@ -65,6 +65,7 @@ def __init__(self, loop, host, port, worker_id, request_id,
6565
max_workers=1)
6666

6767
self._grpc_connect_timeout = grpc_connect_timeout
68+
# This is set to -1 by default to remove the limitation on msg size
6869
self._grpc_max_msg_len = grpc_max_msg_len
6970
self._grpc_resp_queue: queue.Queue = queue.Queue()
7071
self._grpc_connected_fut = loop.create_future()

azure_functions_worker/main.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,17 +36,16 @@ def main():
3636

3737
try:
3838
return aio_compat.run(start_async(
39-
args.host, args.port, args.worker_id, args.request_id,
40-
args.grpc_max_msg_len))
39+
args.host, args.port, args.worker_id, args.request_id))
4140
except Exception:
4241
error_logger.exception('unhandled error in functions worker')
4342
raise
4443

4544

46-
async def start_async(host, port, worker_id, request_id, grpc_max_msg_len):
45+
async def start_async(host, port, worker_id, request_id):
4746
disp = await dispatcher.Dispatcher.connect(
4847
host, port, worker_id, request_id,
49-
connect_timeout=5.0, max_msg_len=grpc_max_msg_len)
48+
connect_timeout=5.0)
5049

5150
disp.load_bindings()
5251

azure_functions_worker/testutils.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@
3333
from . import aio_compat
3434
from . import dispatcher
3535
from . import protos
36+
from .utils.common import is_envvar_true
37+
from .constants import PYAZURE_WEBHOST_DEBUG
3638

3739

3840
PROJECT_ROOT = pathlib.Path(__file__).parent.parent
@@ -137,7 +139,10 @@ def __new__(mcls, name, bases, dct):
137139
def wrapper(self, *args, __meth__=test_case,
138140
__check_log__=check_log_case, **kwargs):
139141

140-
if __check_log__ is not None and callable(__check_log__):
142+
if (__check_log__ is not None
143+
and callable(__check_log__)
144+
and not is_envvar_true(PYAZURE_WEBHOST_DEBUG)):
145+
141146
# Check logging output for unit test scenarios
142147
result = self._run_test(__meth__, *args, **kwargs)
143148

@@ -177,7 +182,7 @@ def get_script_dir(cls):
177182
@classmethod
178183
def setUpClass(cls):
179184
script_dir = pathlib.Path(cls.get_script_dir())
180-
if os.environ.get('PYAZURE_WEBHOST_DEBUG'):
185+
if is_envvar_true(PYAZURE_WEBHOST_DEBUG):
181186
cls.host_stdout = None
182187
else:
183188
cls.host_stdout = tempfile.NamedTemporaryFile('w+t')
@@ -660,7 +665,7 @@ def start_webhost(*, script_dir=None, stdout=None):
660665
script_root = FUNCS_PATH
661666

662667
if stdout is None:
663-
if os.environ.get('PYAZURE_WEBHOST_DEBUG'):
668+
if is_envvar_true(PYAZURE_WEBHOST_DEBUG):
664669
stdout = sys.stdout
665670
else:
666671
stdout = subprocess.DEVNULL

pack/scripts/win_deps.ps1

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
python -m venv .env
2-
.env\scripts\activate
2+
.env\Scripts\Activate.ps1
3+
python -m pip install --upgrade pip
4+
35
python -m pip install .
46

57
$depsPath = Join-Path -Path $env:BUILD_SOURCESDIRECTORY -ChildPath "deps"

setup.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@
1717

1818

1919
# TODO: change this to something more stable when available.
20-
WEBHOST_URL = ('https://ci.appveyor.com/api/buildjobs/1fqp92o5h2gks7xe'
20+
WEBHOST_URL = ('https://ci.appveyor.com/api/buildjobs/19gqd7drpxhkedea'
2121
'/artifacts'
22-
'/Functions.Binaries.2.0.12888.no-runtime.zip')
22+
'/Functions.Binaries.2.0.13036.no-runtime.zip')
2323

2424
# Extensions necessary for non-core bindings.
2525
AZURE_EXTENSIONS = """\
@@ -274,8 +274,8 @@ def run(self):
274274
'azure_functions_worker.bindings',
275275
'azure_functions_worker.utils'],
276276
install_requires=[
277-
'grpcio==1.26.0',
278-
'grpcio-tools==1.26.0',
277+
'grpcio~=1.26.0',
278+
'grpcio-tools~=1.26.0',
279279
],
280280
extras_require={
281281
'dev': [

0 commit comments

Comments
 (0)