Skip to content
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

Only parse the last JSON Proxy response from stdout #789

Conversation

cmuto09
Copy link
Contributor

@cmuto09 cmuto09 commented Aug 19, 2019

@dnalborczyk here's the updated version for #785.

Instead of trying to detect the JSON start and piling it all into a string, I compiled all the output to the string then grabbed the last match. It works better than the previous one, and includes an integration test.

Oh also I had to skip the python2 integration test in order to push because I don't have /usr/bin/python2 in my environment and can't add it due to OSX restrictions. The skip conditional in that integration test doesn't work because detectPython2() is an async function but the if statement treats it synchronously, and therefore always resolves to true.

@dnalborczyk
Copy link
Collaborator

dnalborczyk commented Aug 21, 2019

hey @cmuto09 sorry, I didn't know you put more work into this. :/ Thanks a lot though, it's much appreciated!

I pushed the local invoke python stuff into master. 3ed787f it would be great if you could have a look. Hopefully you have some helpful ideas or opinions about this. it definitely needs some touch-ups!

I'm seeing the following problems right now:

  • tests are not running on windows (skipped for now, probably a path issue)
  • python2 tests are not running at all (skipped, I'm also guessing a path issue)
  • I haven't done anything special [yet] about any exceptions/error conditions
  • print(len(json.dumps(data))) in a python script results in an exception (JSON expected)

The 'invoke.py' script is entirely "as is" (didn't change anything) from serverless

I added this relative path call: 3ed787f , because I had issues running the python tests manually from inside the test folder (python-big-json) and running the tests automated.

there's probably more, but that's a start. let me know if you have any questions.

eventually we could ask serverless to implement a version of their function without additional stdout, similar to this one.

Oh also I had to skip the python2 integration test in order to push because I don't have /usr/bin/python2 in my environment and can't add it due to OSX restrictions. The skip conditional in that integration test doesn't work because detectPython2() is an async function but the if statement treats it synchronously, and therefore always resolves to true.

thanks for the info. Gonna check that out.

update: failing tests could also be attributed to: #768 (comment)

@cmuto09
Copy link
Contributor Author

cmuto09 commented Aug 21, 2019

@dnalborczyk No worries! Directly invoking is definitely a better solution to the problem, I'm all for it.

It does shed some light on issues I was bumping into on my machine yesterday trying to run the latest version. It looks like (at least in Python3) there are issues resolving the required packages. It might be a virtual env issue introduced by the direct invoke. I've got a fairly convoluted setup running it in a Docker container with pipenv managing requirements, so I'm not sure if it's the new implementation or something else with my machinery around it, but this gives me another thread to pull on.

I'm hoping to get a chance to dive into it but it looks unlikely in the immediate future. When I do though I'll also look at the issues you listed above and see what I can suss out. In the meantime I'll tentatively add dependency/virtual env resolution to the issues you've listed above.

As for this PR, I'll close it in favor of the direct invocation implementation

@cmuto09 cmuto09 closed this Aug 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants