| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -60,6 +60,9 @@ docker run --rm -v "$PWD":/var/task lambci/lambda:python2.7 | |||
| 60 | 60 | # Test on Python 3.6 with a custom file named my_module.py containing a my_handler function | |
| 61 | 61 | docker run --rm -v "$PWD":/var/task lambci/lambda:python3.6 my_module.my_handler | |
| 62 | 62 | ||
| 63 | + # Python 3.7 requires the handler be given explicitly | ||
| 64 | + docker run --rm -v "$PWD":/var/task lambci/lambda:python3.7 lambda_function.lambda_handler | ||
| 65 | + | ||
| 63 | 66 | # Test on Go 1.x with a compiled handler named my_handler and a custom event | |
| 64 | 67 | docker run --rm -v "$PWD":/var/task lambci/lambda:go1.x my_handler '{"some": "event"}' | |
| 65 | 68 | ||
@@ -204,6 +207,7 @@ Docker tags (follow the Lambda runtime names): | |||
| 204 | 207 | - `nodejs8.10` | |
| 205 | 208 | - `python2.7` | |
| 206 | 209 | - `python3.6` | |
| 210 | + - `python3.7` | ||
| 207 | 211 | - `java8` | |
| 208 | 212 | - `go1.x` | |
| 209 | 213 | - `dotnetcore2.0` | |
@@ -214,6 +218,7 @@ Docker tags (follow the Lambda runtime names): | |||
| 214 | 218 | - `build-nodejs8.10` | |
| 215 | 219 | - `build-python2.7` | |
| 216 | 220 | - `build-python3.6` | |
| 221 | + - `build-python3.7` | ||
| 217 | 222 | - `build-java8` | |
| 218 | 223 | - `build-go1.x` | |
| 219 | 224 | - `build-dotnetcore2.0` | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,6 +1,6 @@ | |||
| 1 | 1 | #!/bin/bash | |
| 2 | 2 | ||
| 3 | - RUNTIMES="nodejs4.3 nodejs6.10 nodejs8.10 python2.7 python3.6 java8 go1.x dotnetcore2.0 dotnetcore2.1 provided" | ||
| 3 | + RUNTIMES="nodejs4.3 nodejs6.10 nodejs8.10 python2.7 python3.6 python3.7 java8 go1.x dotnetcore2.0 dotnetcore2.1 provided" | ||
| 4 | 4 | ||
| 5 | 5 | TOP_DIR="${PWD}/.." | |
| 6 | 6 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,6 +1,6 @@ | |||
| 1 | 1 | #!/bin/bash | |
| 2 | 2 | ||
| 3 | - RUNTIMES="nodejs4.3 nodejs6.10 nodejs8.10 python2.7 python3.6 java8 go1.x dotnetcore2.0 dotnetcore2.1 provided" | ||
| 3 | + RUNTIMES="nodejs4.3 nodejs6.10 nodejs8.10 python2.7 python3.6 python3.7 java8 go1.x dotnetcore2.0 dotnetcore2.1 provided" | ||
| 4 | 4 | ||
| 5 | 5 | rm -rf diff | |
| 6 | 6 | mkdir -p diff | |
@@ -53,6 +53,13 @@ pwd | |||
| 53 | 53 | diff docker/var/runtime/awslambda/bootstrap.py lambda/var/runtime/awslambda/bootstrap.py | |
| 54 | 54 | diff -qr docker lambda | grep -v __pycache__ | |
| 55 | 55 | ||
| 56 | + cd ${DIFF_DIR}/python3.7 | ||
| 57 | + pwd | ||
| 58 | + diff docker/var/runtime/bootstrap lambda/var/runtime/bootstrap | ||
| 59 | + diff docker/var/runtime/bootstrap.py lambda/var/runtime/bootstrap.py | ||
| 60 | + diff docker/var/runtime/lambda_runtime_client.py lambda/var/runtime/lambda_runtime_client.py | ||
| 61 | + diff -qr docker lambda | grep -v __pycache__ | ||
| 62 | + | ||
| 56 | 63 | cd ${DIFF_DIR}/java8 | |
| 57 | 64 | pwd | |
| 58 | 65 | diff -qr docker lambda | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -14,12 +14,14 @@ def lambda_handler(event, context): | |||
| 14 | 14 | if 'cmd' in event: | |
| 15 | 15 | return print(subprocess.check_output(['sh', '-c', event['cmd']])) | |
| 16 | 16 | ||
| 17 | - subprocess.call(['sh', '-c', 'tar -cpzf /tmp/python3.6.tgz --numeric-owner --ignore-failed-read ' + | ||
| 17 | + filename = 'python3.6.tgz' | ||
| 18 | + | ||
| 19 | + subprocess.call(['sh', '-c', f'tar -cpzf /tmp/{filename} --numeric-owner --ignore-failed-read ' + | ||
| 18 | 20 | '/var/runtime /var/lang /var/rapid']) | |
| 19 | 21 | ||
| 20 | 22 | print('Zipping done! Uploading...') | |
| 21 | 23 | ||
| 22 | - TRANSFER.upload_file('/tmp/python3.6.tgz', 'lambci', 'fs/python3.6.tgz', extra_args={'ACL': 'public-read'}) | ||
| 24 | + TRANSFER.upload_file(f'/tmp/{filename}', 'lambci', f'fs/{filename}', extra_args={'ACL': 'public-read'}) | ||
| 23 | 25 | ||
| 24 | 26 | print('Uploading done!') | |
| 25 | 27 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,131 @@ | |||
| 1 | + from __future__ import print_function | ||
| 2 | + | ||
| 3 | + import os | ||
| 4 | + import sys | ||
| 5 | + import subprocess | ||
| 6 | + import json | ||
| 7 | + import boto3 | ||
| 8 | + from boto3.s3.transfer import S3Transfer | ||
| 9 | + | ||
| 10 | + TRANSFER = S3Transfer(boto3.client('s3')) | ||
| 11 | + | ||
| 12 | + | ||
| 13 | + def lambda_handler(event, context): | ||
| 14 | + if 'cmd' in event: | ||
| 15 | + return print(subprocess.check_output(['sh', '-c', event['cmd']])) | ||
| 16 | + | ||
| 17 | + filename = 'python3.7.tgz' | ||
| 18 | + | ||
| 19 | + subprocess.call(['sh', '-c', f'tar -cpzf /tmp/{filename} --numeric-owner --ignore-failed-read ' + | ||
| 20 | + '/var/runtime /var/lang /var/rapid']) | ||
| 21 | + | ||
| 22 | + print('Zipping done! Uploading...') | ||
| 23 | + | ||
| 24 | + TRANSFER.upload_file(f'/tmp/{filename}', 'lambci', f'fs/{filename}', extra_args={'ACL': 'public-read'}) | ||
| 25 | + | ||
| 26 | + print('Uploading done!') | ||
| 27 | + | ||
| 28 | + info = {'sys.executable': sys.executable, | ||
| 29 | + 'sys.argv': sys.argv, | ||
| 30 | + 'sys.path': sys.path, | ||
| 31 | + 'os.getcwd': os.getcwd(), | ||
| 32 | + '__file__': __file__, | ||
| 33 | + 'os.environ': {k: str(v) for k, v in os.environ.items()}, | ||
| 34 | + 'context': {k: str(v) for k, v in context.__dict__.items()}, | ||
| 35 | + 'ps aux': subprocess.check_output(['ps', 'aux']).decode('utf-8').splitlines(), | ||
| 36 | + 'proc environ': subprocess.check_output( | ||
| 37 | + ['sh', '-c', 'xargs -n 1 -0 < /proc/1/environ']).decode('utf-8').splitlines()} | ||
| 38 | + | ||
| 39 | + print(json.dumps(info, indent=2)) | ||
| 40 | + | ||
| 41 | + return info | ||
| 42 | + | ||
| 43 | + # "sys.executable": "/var/lang/bin/python3.7", | ||
| 44 | + # "sys.argv": [ | ||
| 45 | + # "/var/runtime/bootstrap" | ||
| 46 | + # ], | ||
| 47 | + # "sys.path": [ | ||
| 48 | + # "/var/task", | ||
| 49 | + # "/opt/python/lib/python3.7/site-packages", | ||
| 50 | + # "/opt/python", | ||
| 51 | + # "/var/runtime", | ||
| 52 | + # "/var/lang/lib/python37.zip", | ||
| 53 | + # "/var/lang/lib/python3.7", | ||
| 54 | + # "/var/lang/lib/python3.7/lib-dynload", | ||
| 55 | + # "/var/lang/lib/python3.7/site-packages", | ||
| 56 | + # "/opt/python/lib/python3.7/site-packages", | ||
| 57 | + # "/opt/python" | ||
| 58 | + # ], | ||
| 59 | + # "os.getcwd": "/var/task", | ||
| 60 | + # "__file__": "/var/task/lambda_function.py", | ||
| 61 | + # "os.environ": { | ||
| 62 | + # "PATH": "/var/lang/bin:/usr/local/bin:/usr/bin/:/bin:/opt/bin", | ||
| 63 | + # "LD_LIBRARY_PATH": "/var/lang/lib:/lib64:/usr/lib64:/var/runtime:/var/runtime/lib:/var/task:/var/task/lib:/opt/lib", | ||
| 64 | + # "LANG": "en_US.UTF-8", | ||
| 65 | + # "TZ": ":UTC", | ||
| 66 | + # "LAMBDA_TASK_ROOT": "/var/task", | ||
| 67 | + # "LAMBDA_RUNTIME_DIR": "/var/runtime", | ||
| 68 | + # "AWS_REGION": "us-east-1", | ||
| 69 | + # "AWS_DEFAULT_REGION": "us-east-1", | ||
| 70 | + # "AWS_LAMBDA_LOG_GROUP_NAME": "/aws/lambda/dump-python37", | ||
| 71 | + # "AWS_LAMBDA_LOG_STREAM_NAME": "2018/11/20/[$LATEST]ac1dfb2ddf5a4ce8ae56fb4f8bbef79e", | ||
| 72 | + # "AWS_LAMBDA_FUNCTION_NAME": "dump-python37", | ||
| 73 | + # "AWS_LAMBDA_FUNCTION_MEMORY_SIZE": "3008", | ||
| 74 | + # "AWS_LAMBDA_FUNCTION_VERSION": "$LATEST", | ||
| 75 | + # "_AWS_XRAY_DAEMON_ADDRESS": "169.254.79.2", | ||
| 76 | + # "_AWS_XRAY_DAEMON_PORT": "2000", | ||
| 77 | + # "AWS_XRAY_DAEMON_ADDRESS": "169.254.79.2:2000", | ||
| 78 | + # "AWS_XRAY_CONTEXT_MISSING": "LOG_ERROR", | ||
| 79 | + # "AWS_EXECUTION_ENV": "AWS_Lambda_python3.7", | ||
| 80 | + # "_HANDLER": "lambda_function.lambda_handler", | ||
| 81 | + # "AWS_ACCESS_KEY_ID": "ASIAYBQ3XNZICRJLMSWK", | ||
| 82 | + # "AWS_SECRET_ACCESS_KEY": "zVGU...", | ||
| 83 | + # "AWS_SESSION_TOKEN": "FQoG...", | ||
| 84 | + # "_X_AMZN_TRACE_ID": "Root=1-5bf3752e-f6ac2142f8303c52aaab2628;Parent=08d2682547d140dd;Sampled=0" | ||
| 85 | + # }, | ||
| 86 | + # "context": { | ||
| 87 | + # "aws_request_id": "475d3ab2-ec6e-11e8-acea-69ef4368db5c", | ||
| 88 | + # "log_group_name": "/aws/lambda/dump-python37", | ||
| 89 | + # "log_stream_name": "2018/11/20/[$LATEST]ac1dfb2ddf5a4ce8ae56fb4f8bbef79e", | ||
| 90 | + # "function_name": "dump-python37", | ||
| 91 | + # "memory_limit_in_mb": "3008", | ||
| 92 | + # "function_version": "$LATEST", | ||
| 93 | + # "invoked_function_arn": "arn:aws:lambda:us-east-1:999999999999:function:dump-python37", | ||
| 94 | + # "client_context": "None", | ||
| 95 | + # "identity": "<bootstrap.CognitoIdentity object at 0x7f0a8b6dbe48>", | ||
| 96 | + # "_epoch_deadline_time_in_ms": "1542682202288" | ||
| 97 | + # }, | ||
| 98 | + # "ps aux": [ | ||
| 99 | + # "USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND", | ||
| 100 | + # "473 1 0.0 0.1 205576 6896 ? Ssl 02:38 0:00 /var/rapid/init --bootstrap /var/runtime/bootstrap", | ||
| 101 | + # "473 7 0.0 0.7 230312 28936 ? S 02:38 0:00 /var/lang/bin/python3.7 /var/runtime/bootstrap", | ||
| 102 | + # "473 40 0.0 0.0 117224 2512 ? R 02:45 0:00 ps aux" | ||
| 103 | + # ], | ||
| 104 | + # "proc environ": [ | ||
| 105 | + # "PATH=/var/lang/bin:/usr/local/bin:/usr/bin/:/bin:/opt/bin", | ||
| 106 | + # "LD_LIBRARY_PATH=/var/lang/lib:/lib64:/usr/lib64:/var/runtime:/var/runtime/lib:/var/task:/var/task/lib:/opt/lib", | ||
| 107 | + # "LANG=en_US.UTF-8", | ||
| 108 | + # "TZ=:UTC", | ||
| 109 | + # "_LAMBDA_CONTROL_SOCKET=15", | ||
| 110 | + # "_LAMBDA_CONSOLE_SOCKET=17", | ||
| 111 | + # "LAMBDA_TASK_ROOT=/var/task", | ||
| 112 | + # "LAMBDA_RUNTIME_DIR=/var/runtime", | ||
| 113 | + # "_LAMBDA_LOG_FD=24", | ||
| 114 | + # "_LAMBDA_SB_ID=23", | ||
| 115 | + # "_LAMBDA_SHARED_MEM_FD=12", | ||
| 116 | + # "AWS_REGION=us-east-1", | ||
| 117 | + # "AWS_DEFAULT_REGION=us-east-1", | ||
| 118 | + # "AWS_LAMBDA_LOG_GROUP_NAME=/aws/lambda/dump-python37", | ||
| 119 | + # "AWS_LAMBDA_LOG_STREAM_NAME=2018/11/20/[$LATEST]ac1dfb2ddf5a4ce8ae56fb4f8bbef79e", | ||
| 120 | + # "AWS_LAMBDA_FUNCTION_NAME=dump-python37", | ||
| 121 | + # "AWS_LAMBDA_FUNCTION_MEMORY_SIZE=3008", | ||
| 122 | + # "AWS_LAMBDA_FUNCTION_VERSION=$LATEST", | ||
| 123 | + # "_AWS_XRAY_DAEMON_ADDRESS=169.254.79.2", | ||
| 124 | + # "_AWS_XRAY_DAEMON_PORT=2000", | ||
| 125 | + # "AWS_XRAY_DAEMON_ADDRESS=169.254.79.2:2000", | ||
| 126 | + # "AWS_XRAY_CONTEXT_MISSING=LOG_ERROR", | ||
| 127 | + # "_X_AMZN_TRACE_ID=Parent=22afbb5e10233b0d", | ||
| 128 | + # "AWS_EXECUTION_ENV=AWS_Lambda_python3.7", | ||
| 129 | + # "_HANDLER=lambda_function.lambda_handler", | ||
| 130 | + # "_LAMBDA_RUNTIME_LOAD_TIME=1534336339261" | ||
| 131 | + # ] | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,6 +1,6 @@ | |||
| 1 | 1 | #!/bin/bash | |
| 2 | 2 | ||
| 3 | - RUNTIMES="node43 node610 node810 python27 python36 java8 go1x dotnetcore20 dotnetcore21 provided" | ||
| 3 | + RUNTIMES="node43 node610 node810 python27 python36 python37 java8 go1x dotnetcore20 dotnetcore21 provided" | ||
| 4 | 4 | ||
| 5 | 5 | for RUNTIME in $RUNTIMES; do | |
| 6 | 6 | echo $RUNTIME | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,6 +1,6 @@ | |||
| 1 | 1 | #!/bin/bash | |
| 2 | 2 | ||
| 3 | - RUNTIMES="nodejs4.3 nodejs6.10 nodejs8.10 python2.7 python3.6 java8 go1.x dotnetcore2.0 dotnetcore2.1 provided" | ||
| 3 | + RUNTIMES="nodejs4.3 nodejs6.10 nodejs8.10 python2.7 python3.6 python3.7 java8 go1.x dotnetcore2.0 dotnetcore2.1 provided" | ||
| 4 | 4 | ||
| 5 | 5 | docker push lambci/lambda-base | |
| 6 | 6 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,6 +1,6 @@ | |||
| 1 | 1 | #!/bin/bash | |
| 2 | 2 | ||
| 3 | - RUNTIMES="nodejs4.3 nodejs6.10 nodejs8.10 python2.7 python3.6 java8 go1.x dotnetcore2.0 dotnetcore2.1 provided" | ||
| 3 | + RUNTIMES="nodejs4.3 nodejs6.10 nodejs8.10 python2.7 python3.6 python3.7 java8 go1.x dotnetcore2.0 dotnetcore2.1 provided" | ||
| 4 | 4 | ||
| 5 | 5 | git tag -f latest | |
| 6 | 6 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -17,6 +17,7 @@ npm test | |||
| 17 | 17 | cd ${EXAMPLES_DIR}/python | |
| 18 | 18 | docker run --rm -v "$PWD":/var/task lambci/lambda:python2.7 | |
| 19 | 19 | docker run --rm -v "$PWD":/var/task lambci/lambda:python3.6 | |
| 20 | + docker run --rm -v "$PWD":/var/task lambci/lambda:python3.7 lambda_function.lambda_handler | ||
| 20 | 21 | ||
| 21 | 22 | cd ${EXAMPLES_DIR}/java | |
| 22 | 23 | gradle build | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -7,37 +7,28 @@ | |||
| 7 | 7 | # docker run --rm -v "$PWD":/var/task lambci/lambda:python2.7 | |
| 8 | 8 | # OR | |
| 9 | 9 | # docker run --rm -v "$PWD":/var/task lambci/lambda:python3.6 | |
| 10 | + # OR | ||
| 11 | + # docker run --rm -v "$PWD":/var/task lambci/lambda:python3.7 lambda_function.lambda_handler | ||
| 10 | 12 | ||
| 11 | 13 | def lambda_handler(event, context): | |
| 12 | - for arg in sys.argv: | ||
| 13 | - print(arg) | ||
| 14 | - print(os.getcwd()) | ||
| 15 | - print(os.path.basename(__file__)) | ||
| 16 | - for key in os.environ.keys(): | ||
| 17 | - print('{0}={1}'.format(key,os.environ[key])) | ||
| 18 | - print(subprocess.check_output(['ps', 'aux']).decode('utf-8')) | ||
| 19 | - print(subprocess.check_output(['sh', '-c', 'xargs -n 1 -0 < /proc/1/environ']).decode('utf-8')) | ||
| 20 | - print(sys.path) | ||
| 21 | - print(os.getuid()) | ||
| 22 | - print(os.getgid()) | ||
| 23 | - print(os.geteuid()) | ||
| 24 | - print(os.getegid()) | ||
| 25 | - print(os.getgroups()) | ||
| 26 | - print(os.umask(0o222)) | ||
| 14 | + context.log('Hello!') | ||
| 15 | + context.log('Hmmm, does not add newlines in 3.7?') | ||
| 16 | + context.log('\n') | ||
| 27 | 17 | ||
| 28 | - print(event) | ||
| 29 | - print(context.get_remaining_time_in_millis()) | ||
| 30 | - print(context.aws_request_id) | ||
| 31 | - if context.client_context: | ||
| 32 | - print(context.client_context) | ||
| 33 | - print(context.function_name) | ||
| 34 | - print(context.function_version) | ||
| 35 | - print(context.identity.cognito_identity_id) | ||
| 36 | - print(context.identity.cognito_identity_pool_id) | ||
| 37 | - print(context.invoked_function_arn) | ||
| 38 | - print(context.log('Log this for me please')) | ||
| 39 | - print(context.log_group_name) | ||
| 40 | - print(context.log_stream_name) | ||
| 41 | - print(context.memory_limit_in_mb) | ||
| 18 | + print(sys.executable) | ||
| 19 | + print(sys.argv) | ||
| 20 | + print(os.getcwd()) | ||
| 21 | + print(__file__) | ||
| 22 | + print(os.environ) | ||
| 23 | + print(context.__dict__) | ||
| 42 | 24 | ||
| 43 | - return 'It works!' | ||
| 25 | + return { | ||
| 26 | + "executable": str(sys.executable), | ||
| 27 | + "sys.argv": str(sys.argv), | ||
| 28 | + "os.getcwd": str(os.getcwd()), | ||
| 29 | + "__file__": str(__file__), | ||
| 30 | + "os.environ": str(os.environ), | ||
| 31 | + "context.__dict__": str(context.__dict__), | ||
| 32 | + "ps aux": str(subprocess.check_output(['ps', 'aux'])), | ||
| 33 | + "event": event | ||
| 34 | + } | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments