Toggle navigation
Toggle navigation
This project
Loading...
Sign in
서승완
/
kappa
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Graphs
Network
Create a new issue
Commits
Issue Boards
Authored by
Mitch Garnaat
2015-01-07 20:31:32 -0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
edc6fbc39d191c2ba094d97dff09e4c2f1a62101
edc6fbc3
1 parent
3e4723b8
A few tweaks based on landscape.io. feedback.
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
15 deletions
kappa/context.py
kappa/function.py
kappa/context.py
View file @
edc6fbc
...
...
@@ -92,15 +92,16 @@ class Context(object):
def
_create_event_sources
(
self
):
for
event_source_cfg
in
self
.
config
[
'lambda'
][
'event_sources'
]:
_
,
_
,
svc
,
_
=
event_source_cfg
[
'arn'
]
.
split
(
':'
,
3
)
if
svc
==
'kinesis'
:
self
.
event_sources
.
append
(
kappa
.
event_source
.
KinesisEventSource
(
self
,
event_source_cfg
))
elif
svc
==
's3'
:
self
.
event_sources
.
append
(
kappa
.
event_source
.
S3EventSource
(
self
,
event_source_cfg
))
else
:
msg
=
'Unsupported event source:
%
s'
%
event_source_cfg
[
'arn'
]
raise
ValueError
(
msg
)
if
svc
==
'kinesis'
:
self
.
event_sources
.
append
(
kappa
.
event_source
.
KinesisEventSource
(
self
,
event_source_cfg
))
elif
svc
==
's3'
:
self
.
event_sources
.
append
(
kappa
.
event_source
.
S3EventSource
(
self
,
event_source_cfg
))
else
:
msg
=
'Unsupported event source:
%
s'
%
event_source_cfg
[
'arn'
]
raise
ValueError
(
msg
)
def
add_event_sources
(
self
):
for
event_source
in
self
.
event_sources
:
...
...
kappa/function.py
View file @
edc6fbc
...
...
@@ -80,7 +80,7 @@ class Function(object):
LOG
.
debug
(
response
)
self
.
_arn
=
response
[
'FunctionARN'
]
except
Exception
:
LOG
.
debug
(
'Unable to find ARN for function:
%
s'
%
self
.
name
)
LOG
.
debug
(
'Unable to find ARN for function:
%
s'
,
self
.
name
)
return
self
.
_arn
@property
...
...
@@ -101,12 +101,12 @@ class Function(object):
with
zipfile
.
ZipFile
(
zipfile_name
,
'w'
)
as
zf
:
for
root
,
dirs
,
files
in
os
.
walk
(
lambda_dir
):
zf
.
write
(
root
,
os
.
path
.
relpath
(
root
,
relroot
))
for
file
in
files
:
file
name
=
os
.
path
.
join
(
root
,
fil
e
)
if
os
.
path
.
isfile
(
file
name
):
for
file
name
in
files
:
file
path
=
os
.
path
.
join
(
root
,
filenam
e
)
if
os
.
path
.
isfile
(
file
path
):
arcname
=
os
.
path
.
join
(
os
.
path
.
relpath
(
root
,
relroot
),
file
)
zf
.
write
(
file
name
,
arcname
)
os
.
path
.
relpath
(
root
,
relroot
),
file
name
)
zf
.
write
(
file
path
,
arcname
)
def
_zip_lambda_file
(
self
,
zipfile_name
,
lambda_file
):
LOG
.
debug
(
'_zip_lambda_file: lambda_file=
%
s'
,
lambda_file
)
...
...
Please
register
or
login
to post a comment