Git Product home page Git Product logo

Comments (12)

lvh avatar lvh commented on August 14, 2024 1

Cool. I'm working on this. Do you recall what the point was of rebinding sys.std{out,err}?

from docker-lambda.

mhart avatar mhart commented on August 14, 2024

Right 😁

https://github.com/lambci/docker-lambda/blob/master/python2.7/run/runtime-mock.py#L7

from docker-lambda.

mhart avatar mhart commented on August 14, 2024

It says on the README, "Python 2.7 and Java 8 test runners are not yet complete, but both languages are installed in the images so can be manually tested"

I haven't really had the time to dig into how the Python and Java runners in Lambda differ from the Node.js one – the Python one appears to use more HTTP functionality to communicate with the AWS Lambda coordinator than Node.js does, but I really haven't looked into it deeply.

I'd happily accept a PR from anyone who's looked into it and can replicate the existing functionality of the Node.js wrapper

from docker-lambda.

lvh avatar lvh commented on August 14, 2024

@mhart I'd like to look into this more. Where did that runtime-mock.py file come from?

from docker-lambda.

lvh avatar lvh commented on August 14, 2024

(Also, perhaps there should be two tickets; the Java and Python problems seem distinct.)

from docker-lambda.

mhart avatar mhart commented on August 14, 2024

@lvh I just created it. Based on the contents of /var/runtime/awslambda/bootstrap.py and reverse engineering the interface being used

from docker-lambda.

lvh avatar lvh commented on August 14, 2024

It seems like invokeid might be what the Python Lambda docs call aws_request_id. Looks like for testing purposes it's OK if that's just a constant (or perhaps a random) string?

from docker-lambda.

mhart avatar mhart commented on August 14, 2024

@lvh yep, spot on – that's exactly what I do for Node.js: https://github.com/lambci/docker-lambda/blob/master/nodejs/run/awslambda-mock.js#L45

from docker-lambda.

mhart avatar mhart commented on August 14, 2024

@lvh I believe it's Lambda itself that overrides them (ie, bootstrap.py, which comes from Lambda). I believe it overrides them to send logs remotely. Whereas, for mocking purposes, we don't want them overridden, so we restore them to the originals on function invocation.

from docker-lambda.

endemics avatar endemics commented on August 14, 2024

@lvh I was looking for a fork where you would have published your work but couldn't find it, so I ended up implementing it instead in #15. Sorry if there was duplicated work. Your feedback on my PR is very welcome!

from docker-lambda.

mhart avatar mhart commented on August 14, 2024

Just commenting here to say the Python 2.7 implementation started by @endemics has been merged now – so I've updated the title accordingly

from docker-lambda.

mhart avatar mhart commented on August 14, 2024

Actually, there's already an issue tracking Java support: #1 – so I'll close this one

from docker-lambda.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.