Example of Lightrun sdk containerised in lambda#5
Example of Lightrun sdk containerised in lambda#5anna-lightrun wants to merge 4 commits intomainfrom
Conversation
amit-shuster
left a comment
There was a problem hiding this comment.
I think this should be moved inside the examples folder
Something like:
examples/AWS_Lambda/fibonacci
WDYT?
sample_aws_container/src/sample.py
Outdated
| def import_lightrun(): | ||
| try: | ||
| import lightrun | ||
| lightrun.enable(com_lightrun_server='https://app.lightrun.com/company/success', company_key='b33aaabc-2ef0-4bcd-9c09-e3de48ac90fe') |
There was a problem hiding this comment.
please remove company_key, and server details.
sample_aws_container/src/sample.py
Outdated
| num = event['num'] | ||
|
|
||
| print("Calculating Fibonacci of {}...".format(num)) | ||
| start_fibonacci(num) No newline at end of file |
There was a problem hiding this comment.
New line at end of file
sample_aws_container/src/sample.py
Outdated
| num = event['num'] | ||
|
|
||
| print("Calculating Fibonacci of {}...".format(num)) | ||
| start_fibonacci(num) No newline at end of file |
There was a problem hiding this comment.
Don't you want to print the result? or return it?
There was a problem hiding this comment.
this should be without prints/logs as the idea is to run the app and play with lightrun for demo
There was a problem hiding this comment.
I don't think this app makes sense :/
There was a problem hiding this comment.
why not..? We have just to run lambda with any app, that will last long to demonstrate lightrun.
amit-shuster
left a comment
There was a problem hiding this comment.
Looks great, please see comments.
In addition:
- This is a Python example, consider having it under python folder, maybe "sample_aws_container/python/...."
- Please add a short readme, you can copy from the other examples.
| RUN pip install --upgrade pip \ | ||
| && pip install -r requirements.txt | ||
|
|
||
| CMD ["sample.main"] |
There was a problem hiding this comment.
Don't you need to pass num somehow?
| def import_lightrun(): | ||
| try: | ||
| import lightrun | ||
| lightrun.enable(com_lightrun_server=LIGHTRUN_SERVER, company_key=LIGHTRUN_KEY) |
There was a problem hiding this comment.
I think you miss lightrun_wait_for_init=true that is required for lambdas, this will be released in 1.2.3, next week.
Probably need to change requirements too
Example. We will provide a link in doc