Skip to content

Commit

Permalink
Added post on Lambada
Browse files Browse the repository at this point in the history
  • Loading branch information
carsongee committed Nov 19, 2016
1 parent 051ad52 commit 2bdfbbf
Show file tree
Hide file tree
Showing 8 changed files with 103 additions and 29 deletions.
71 changes: 71 additions & 0 deletions _posts/2016-11-19-lambada.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
---
layout: post
title: "Lambada"
short_description: "Python lambdas made easy, yes please."
description: |
At Superpedestrian we have really gotten into using AWS lambdas for
ETL, batch processing, and other scheduled tasks so I made a nice
framework for it.
img: /img/posts/lambada/logo.png
---

At [Superpedestrian](https://superpedestrian.com) we have really
gotten into using AWS lambdas for ETL, batch processing, and other
scheduled tasks, so I created
[Lambada](https://lambada.readthedocs.io) as a nice framework for
making collections of them inside a single repo with `build` time
configuration via environment variables.

Lambdas work great, are basically free, and have all sorts of great
triggers. There are even interesting Web frameworks like
[Chalice](https://github.com/awslabs/chalice) coming out, but what it
lacks, at least for Python, is a nice way to package, manage
dependencies, and bunch them together since they tend to be small and
bunches of them share code. The nice part is that Rackspace already
created a nice package and deployment system through
[Lambda Uploader](https://pypi.python.org/pypi/lambda-uploader), so
all that was really left was for me to make a framework for grouping
them together in a single repo/project along with a way to do security
sensitive configuration at build time via environment variable
injection or yaml file.

Lambada lets you use decorators similar to
[Flask](http://flask.pocoo.org), to have one project with multiple
Lambda functions in that can all be tested, run, and uploaded with a
command line interface. The
[quick start guide](http://lambada.readthedocs.io/en/latest/#quickstart)
has more details, but basically, you can make a file that looks like:

```python
from lambada import Lambada

chart = Lambada(
handler='fouronthefloor.chart',
role='arn:aws:iam:xxxxxxx:role/lambda',
region='us-west-2',
timeout=60,
memory=128
)

@chart.dancer
def test_lambada(event, context):
print('Event: {}'.format(event))


@chart.dancer(
name='high_memory_test',
memory=1024,
requirements=['requirements.txt', 'xtra_requirements.txt']
)
def cool_oneoff(event, context):
print('Wow, so much memory! extra reqs!')


@chart.dancer(memory=512, timeout=5)
def bob_loblaw(event, _):
print('Such a great reference!')
```

and with a single `lambada upload` command create three lambdas in
your AWS account with different requirements on time, memory, aws
region, and even software dependencies.
54 changes: 28 additions & 26 deletions _sass/_syntax-highlighting.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,49 +5,51 @@ code {
background-color: $eight;
text-size: 1rem;
font-family: 'VT323';
color: $six;
color: $fourteen;
}
.highlight {
background: #fff;
background: $eight;
line-height: 1rem;
padding: .5rem;
.highlighter-rouge & {
background: #eef;
background: $eight;
}

.c { color: #998; font-style: italic } // Comment
.err { color: #a61717; background-color: #e3d2d2 } // Error
.c { color: $four; font-style: italic } // Comment
.err { color: $nine; background-color: #e3d2d2 } // Error
.k { font-weight: bold } // Keyword
.o { font-weight: bold } // Operator
.cm { color: #998; font-style: italic } // Comment.Multiline
.cp { color: #999; font-weight: bold } // Comment.Preproc
.c1 { color: #998; font-style: italic } // Comment.Single
.cs { color: #999; font-weight: bold; font-style: italic } // Comment.Special
.gd { color: #000; background-color: #fdd } // Generic.Deleted
.gd .x { color: #000; background-color: #faa } // Generic.Deleted.Specific
.cm { color: $four; font-style: italic } // Comment.Multiline
.cp { color: $four; font-weight: bold } // Comment.Preproc
.c1 { color: $four; font-style: italic } // Comment.Single
.cs { color: $four; font-weight: bold; font-style: italic } // Comment.Special
.gd { color: $zero; background-color: #fdd } // Generic.Deleted
.gd .x { color: $zero; background-color: #faa } // Generic.Deleted.Specific
.ge { font-style: italic } // Generic.Emph
.gr { color: #a00 } // Generic.Error
.gh { color: #999 } // Generic.Heading
.gi { color: #000; background-color: #dfd } // Generic.Inserted
.gi .x { color: #000; background-color: #afa } // Generic.Inserted.Specific
.go { color: #888 } // Generic.Output
.gp { color: #555 } // Generic.Prompt
.gr { color: $nine } // Generic.Error
.gh { color: $twelve } // Generic.Heading
.gi { color: $zero; background-color: #dfd } // Generic.Inserted
.gi .x { color: $zero; background-color: #afa } // Generic.Inserted.Specific
.go { color: $foreground-color } // Generic.Output
.gp { color: $foreground-color } // Generic.Prompt
.gs { font-weight: bold } // Generic.Strong
.gu { color: #aaa } // Generic.Subheading
.gt { color: #a00 } // Generic.Traceback
.gu { color: $onethirty } // Generic.Subheading
.gt { color: $nine } // Generic.Traceback
.kc { font-weight: bold } // Keyword.Constant
.kd { font-weight: bold } // Keyword.Declaration
.kp { font-weight: bold } // Keyword.Pseudo
.kr { font-weight: bold } // Keyword.Reserved
.kt { color: #458; font-weight: bold } // Keyword.Type
.m { color: #099 } // Literal.Number
.s { color: #d14 } // Literal.String
.na { color: #008080 } // Name.Attribute
.kt { color: $four; font-weight: bold } // Keyword.Type
.m { color: $one } // Literal.Number
.s { color: $one } // Literal.String
.na { color: $six } // Name.Attribute
.nb { color: #0086B3 } // Name.Builtin
.nc { color: #458; font-weight: bold } // Name.Class
.no { color: #008080 } // Name.Constant
.ni { color: #800080 } // Name.Entity
.ne { color: #900; font-weight: bold } // Name.Exception
.nf { color: #900; font-weight: bold } // Name.Function
.nn { color: #555 } // Name.Namespace
.ne { color: $four; font-weight: bold } // Name.Exception
.nf { color: $four; font-weight: bold } // Name.Function
.nn { color: $onethirty } // Name.Namespace
.nt { color: #000080 } // Name.Tag
.nv { color: #008080 } // Name.Variable
.ow { font-weight: bold } // Operator.Word
Expand Down
1 change: 1 addition & 0 deletions css/god.scss
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ $twelve: #0071d1;
$thirteen: #b294bb;
$fourteen: #7ccbc0;
$fifteen: #eda8df;
$onethirty: #af5f00;

$link-color: $one;

Expand Down
6 changes: 3 additions & 3 deletions css/main.scss
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ $four: #3e6b90;
$five: #804394;
$six: #169989;
$seven: #707880;
$eight: #373b41;
$eight: #2a2d32;
$nine: #b52ead;
$ten: #314c15;
$eleven: #422400;
$twelve: #81a2be;
$thirteen: #b294bb;
$fourteen: #8abeb7;
$fourteen: #79b2a8;
$fifteen: #c5c8c6;

$onethirty: #af5f00;
$link-color: $one;
@import url("https://fonts.googleapis.com/css?family=Raleway:900");
@import url("https://fonts.googleapis.com/css?family=Cinzel");
Expand Down
Binary file added img/posts/lambada/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/posts/lambada/logo@2x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/posts/lambada/logo@3x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/posts/lambada/logo@4x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 2bdfbbf

Please sign in to comment.