FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
docker-lambda/base/dump-python36.py at python3.7 · chrisoverzero/docker-lambda · GitHub
chrisoverzero
/
docker-lambda
Public
forked from
lambci/docker-lambda
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
docker-lambda
/
base
/
dump-python36.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
132 lines (119 loc) · 5.08 KB
Breadcrumbs
docker-lambda
/
base
/
dump-python36.py
Copy path
File metadata and controls
132 lines (119 loc) · 5.08 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
from
__future__
import
print_function
import
os
import
sys
import
subprocess
import
json
import
boto3
from
boto3
.
s3
.
transfer
import
S3Transfer
TRANSFER
=
S3Transfer
(
boto3
.
client
(
's3'
))
def
lambda_handler
(
event
,
context
):
if
'cmd'
in
event
:
return
print
(
subprocess
.
check_output
([
'sh'
,
'-c'
,
event
[
'cmd'
]]).
decode
(
'utf-8'
))
filename
=
'python3.6.tgz'
subprocess
.
call
([
'sh'
,
'-c'
,
f'tar -cpzf /tmp/
{
filename
}
--numeric-owner --ignore-failed-read '
+
'/var/runtime /var/lang /var/rapid'
])
print
(
'Zipping done! Uploading...'
)
TRANSFER
.
upload_file
(
f'/tmp/
{
filename
}
'
,
'lambci'
,
f'fs/
{
filename
}
'
,
extra_args
=
{
'ACL'
:
'public-read'
})
print
(
'Uploading done!'
)
info
=
{
'sys.executable'
:
sys
.
executable
,
'sys.argv'
:
sys
.
argv
,
'sys.path'
:
sys
.
path
,
'os.getcwd'
:
os
.
getcwd
(),
'__file__'
:
__file__
,
'os.environ'
: {
k
:
str
(
v
)
for
k
,
v
in
os
.
environ
.
items
()},
'context'
: {
k
:
str
(
v
)
for
k
,
v
in
context
.
__dict__
.
items
()},
'ps aux'
:
subprocess
.
check_output
([
'ps'
,
'aux'
]).
decode
(
'utf-8'
).
splitlines
(),
'proc environ'
:
subprocess
.
check_output
(
[
'sh'
,
'-c'
,
'xargs -n 1 -0 < /proc/1/environ'
]).
decode
(
'utf-8'
).
splitlines
()}
print
(
json
.
dumps
(
info
,
indent
=
2
))
return
info
# "sys.executable": "/var/lang/bin/python3.6",
# "sys.argv": [
# "/var/runtime/awslambda/bootstrap.py"
# ],
# "sys.path": [
# "/var/task",
# "/opt/python/lib/python3.6/site-packages",
# "/opt/python",
# "/var/runtime",
# "/var/runtime/awslambda",
# "/var/lang/lib/python36.zip",
# "/var/lang/lib/python3.6",
# "/var/lang/lib/python3.6/lib-dynload",
# "/var/lang/lib/python3.6/site-packages",
# "/opt/python/lib/python3.6/site-packages",
# "/opt/python"
# ],
# "os.getcwd": "/var/task",
# "__file__": "/var/task/lambda_function.py",
# "os.environ": {
# "PATH": "/var/lang/bin:/usr/local/bin:/usr/bin/:/bin:/opt/bin",
# "LD_LIBRARY_PATH": "/var/lang/lib:/lib64:/usr/lib64:/var/runtime:/var/runtime/lib:/var/task:/var/task/lib:/opt/lib",
# "LANG": "en_US.UTF-8",
# "TZ": ":UTC",
# "LAMBDA_TASK_ROOT": "/var/task",
# "LAMBDA_RUNTIME_DIR": "/var/runtime",
# "AWS_REGION": "us-east-1",
# "AWS_DEFAULT_REGION": "us-east-1",
# "AWS_LAMBDA_LOG_GROUP_NAME": "/aws/lambda/dump-python36",
# "AWS_LAMBDA_LOG_STREAM_NAME": "2018/11/20/[$LATEST]bed1311f89d44a4ca0153b20afe94ed5",
# "AWS_LAMBDA_FUNCTION_NAME": "dump-python36",
# "AWS_LAMBDA_FUNCTION_MEMORY_SIZE": "1536",
# "AWS_LAMBDA_FUNCTION_VERSION": "$LATEST",
# "_AWS_XRAY_DAEMON_ADDRESS": "169.254.79.2",
# "_AWS_XRAY_DAEMON_PORT": "2000",
# "AWS_XRAY_DAEMON_ADDRESS": "169.254.79.2:2000",
# "AWS_XRAY_CONTEXT_MISSING": "LOG_ERROR",
# "_X_AMZN_TRACE_ID": "Root=1-5bf37642-635d5f0017b99334b0dc0a0a;Parent=68f7884d5be55d38;Sampled=0",
# "AWS_EXECUTION_ENV": "AWS_Lambda_python3.6",
# "_HANDLER": "lambda_function.lambda_handler",
# "AWS_ACCESS_KEY_ID": "ASIAYBQ3XNZIETZUEWMI",
# "AWS_SECRET_ACCESS_KEY": "84k...",
# "AWS_SESSION_TOKEN": "FQoGZ...",
# "AWS_SECURITY_TOKEN": "FQoGZ...",
# "PYTHONPATH": "/var/runtime"
# },
# "context": {
# "aws_request_id": "ec20cbf4-ec6e-11e8-ae2f-1900152991b2",
# "log_group_name": "/aws/lambda/dump-python36",
# "log_stream_name": "2018/11/20/[$LATEST]bed1311f89d44a4ca0153b20afe94ed5",
# "function_name": "dump-python36",
# "memory_limit_in_mb": "1536",
# "function_version": "$LATEST",
# "invoked_function_arn": "arn:aws:lambda:us-east-1:999999999999:function:dump-python36",
# "client_context": "None",
# "identity": "<__main__.CognitoIdentity object at 0x7f157ab6bd68>"
# },
# "ps aux": [
# "USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND",
# "488 1 13.5 0.7 183460 30112 ? Ss 02:49 0:00 /var/lang/bin/python3.6 /var/runtime/awslambda/bootstrap.py",
# "488 5 0.0 0.0 117224 2492 ? R 02:49 0:00 ps aux"
# ],
# "proc environ": [
# "PATH=/var/lang/bin:/usr/local/bin:/usr/bin/:/bin:/opt/bin",
# "LD_LIBRARY_PATH=/var/lang/lib:/lib64:/usr/lib64:/var/runtime:/var/runtime/lib:/var/task:/var/task/lib:/opt/lib",
# "LANG=en_US.UTF-8",
# "TZ=:UTC",
# "_LAMBDA_CONTROL_SOCKET=15",
# "_LAMBDA_CONSOLE_SOCKET=17",
# "LAMBDA_TASK_ROOT=/var/task",
# "LAMBDA_RUNTIME_DIR=/var/runtime",
# "_LAMBDA_LOG_FD=24",
# "_LAMBDA_SB_ID=8",
# "_LAMBDA_SHARED_MEM_FD=12",
# "AWS_REGION=us-east-1",
# "AWS_DEFAULT_REGION=us-east-1",
# "AWS_LAMBDA_LOG_GROUP_NAME=/aws/lambda/dump-python36",
# "AWS_LAMBDA_LOG_STREAM_NAME=2018/11/20/[$LATEST]bed1311f89d44a4ca0153b20afe94ed5",
# "AWS_LAMBDA_FUNCTION_NAME=dump-python36",
# "AWS_LAMBDA_FUNCTION_MEMORY_SIZE=1536",
# "AWS_LAMBDA_FUNCTION_VERSION=$LATEST",
# "_AWS_XRAY_DAEMON_ADDRESS=169.254.79.2",
# "_AWS_XRAY_DAEMON_PORT=2000",
# "AWS_XRAY_DAEMON_ADDRESS=169.254.79.2:2000",
# "AWS_XRAY_CONTEXT_MISSING=LOG_ERROR",
# "_X_AMZN_TRACE_ID=Parent=3f4f839064ce33c1",
# "AWS_EXECUTION_ENV=AWS_Lambda_python3.6",
# "_HANDLER=lambda_function.lambda_handler",
# "_LAMBDA_RUNTIME_LOAD_TIME=39954026786"
# ]
Back
|
FazBrowse Home
|
New Git URL