-
Notifications
You must be signed in to change notification settings - Fork 102
nirfsg: Enable complex number support for gRPC and update system tests #2172
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 18 commits
Commits
Show all changes
39 commits
Select commit
Hold shift + click to select a range
eabb66a
Initial version
rahur-NI 8bbb854
Enabling grpc for nirfsg
rahur-NI 2769be2
Merge remote-tracking branch 'origin' into nirfsgGrpcEnable
rahur-NI 0d0e209
Updated change log
rahur-NI 89c16cc
nirfsg grpc enable
rahur-NI fd619a3
With default template update
rahur-NI 86fde87
SIngle template changes
rahur-NI ffced12
Updated version of numpy template
rahur-NI b98dcfb
Updating generate temply for numpy_write_method
rahur-NI d69e843
updating numpy read template instead of write template.
rahur-NI cd63014
Updated read method
rahur-NI 104ab97
With nifake changes
rahur-NI 5af2c2d
Updated template to use helper methods
rahur-NI cf39c3b
Updated with proto changes
rahur-NI 66d41ad
Remove log file
rahur-NI 4804429
Merge branch 'master' into nirfsgGrpcComplexNumberSupport
rahur-NI e2964b7
Code refractoring for template.
rahur-NI 544dcdd
Updated with code review comments
rahur-NI 9033a52
Including more verbose output to check on system test failure
rahur-NI 097a731
Reverting verbose log change of nirfsg system test and moving the tes…
rahur-NI d6e6f18
Implementation of code review comments.
rahur-NI 1898173
Updating comment for newly added test cases
rahur-NI feb959a
Updatig with geerated Tox executio
rahur-NI bbecc5f
System Test failure on 32 bit debug
rahur-NI a81a954
Reverting the advanced logging mechanism during system tests.
rahur-NI 0217316
Changing order of TestLibrary and TestGrpc classes
rahur-NI 799b901
Skip gRPC tests on 32-bit systems to prevent timeout
rahur-NI 968177c
Revert "Skip gRPC tests on 32-bit systems to prevent timeout"
rahur-NI b5299d6
Add gRPC server startup timeout and improved error reporting
rahur-NI c938fbd
Printing eaching line in grpx fixute
rahur-NI fe5e119
Resolving flake issue
rahur-NI 74d2955
Enhacing Logs
rahur-NI 3e1ea28
Updating the print flow
rahur-NI ff2591a
Remove Log File
rahur-NI 081b2d0
Enabling reset during session creation
rahur-NI 209dc56
Fixing tox issues
rahur-NI d299e47
Cleaning up extra print statements
rahur-NI 1c494b6
Clean up of rfsg system test
rahur-NI df2dade
Skip nirfsg gRPC tests on 32-bit Python environments
rahur-NI File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 50 additions & 3 deletions
53
build/templates/_grpc_stub_interpreter.py/numpy_read_method.py.mako
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,12 +1,59 @@ | ||
| <%page args="f, config, method_template"/>\ | ||
| <% | ||
| '''Renders a NotImplemented method for to the passed-in function metadata, because numpy is not supported over grpc.''' | ||
|
|
||
| '''Renders a GrpcStubInterpreter method for numpy write operations with complex number support.''' | ||
| import build.helper as helper | ||
|
|
||
| full_func_name = f['interpreter_name'] + method_template['method_python_name_suffix'] | ||
| method_decl_params = helper.get_params_snippet(f, helper.ParameterUsageOptions.INTERPRETER_METHOD_DECLARATION) | ||
| grpc_name = f.get('grpc_name', f['name']) | ||
| grpc_request_args = helper.get_params_snippet(f, helper.ParameterUsageOptions.GRPC_REQUEST_PARAMETERS) | ||
| return_statement = helper.get_grpc_interpreter_method_return_snippet(f['parameters'], config) | ||
| if return_statement == 'return': | ||
| return_statement = None | ||
| capture_response = 'response = ' if return_statement else '' | ||
| included_in_proto = f.get('included_in_proto', True) | ||
| numpy_complex_params = helper.filter_parameters(f['parameters'], helper.ParameterUsageOptions.COMPLEX_NUMBER_PARAMETERS) | ||
| for param in numpy_complex_params: | ||
| grpc_request_args = grpc_request_args.replace( | ||
| param['grpc_name'] + '=' + param['python_name'], | ||
| param['grpc_name'] + '=' + param['python_name'] + '_list' | ||
| ) | ||
| %>\ | ||
|
|
||
| def ${full_func_name}(${method_decl_params}): # noqa: N802 | ||
| % if included_in_proto: | ||
| % if numpy_complex_params: | ||
| % for p in numpy_complex_params: | ||
|
rahur-NI marked this conversation as resolved.
Outdated
|
||
| % if p['original_type'] == 'NIComplexNumber[]': | ||
| ${p['python_name']}_list = [ | ||
| grpc_complex_types.NIComplexNumber(real=val.real, imaginary=val.imag) | ||
| for val in ${p['python_name']}.ravel() | ||
| ] | ||
| % elif p['original_type'] == 'NIComplexNumberF32[]': | ||
| ${p['python_name']}_list = [ | ||
| grpc_complex_types.NIComplexNumberF32(real=val.real, imaginary=val.imag) | ||
| for val in ${p['python_name']}.ravel() | ||
| ] | ||
| % elif p['original_type'] == 'NIComplexI16[]': | ||
| arr = ${p['python_name']}.ravel() | ||
| if arr.size % 2 != 0: | ||
| raise ValueError("Interleaved int16 array must have even length (real/imag pairs)") | ||
| arr_pairs = arr.reshape(-1, 2) | ||
| ${p['python_name']}_list = [ | ||
| grpc_complex_types.NIComplexI16(real=int(pair[0]), imaginary=int(pair[1])) | ||
| for pair in arr_pairs | ||
| ] | ||
| % endif | ||
| % endfor | ||
| ${capture_response}self._invoke( | ||
| self._client.${grpc_name}, | ||
| grpc_types.${grpc_name}Request(${grpc_request_args}), | ||
| ) | ||
| % if return_snippet: | ||
| ${return_snippet} | ||
| % endif | ||
| % else: | ||
| raise NotImplementedError('numpy-specific methods are not supported over gRPC') | ||
| % endif | ||
| % else: | ||
| raise NotImplementedError('${full_func_name} is not supported over gRPC') | ||
| % endif | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| { | ||
| "address": "[::1]", | ||
| "port": 31766, | ||
|
ni-jfitzger marked this conversation as resolved.
|
||
| "security" : { | ||
| "server_cert": "", | ||
| "server_key": "", | ||
| "root_cert": "" | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.