chili_pepper package¶
Submodules¶
chili_pepper.app module¶
-
class
chili_pepper.app.
App
(app_name, config=None)[source]¶ Bases:
object
Cloud-agnostic App class
App is the main class for applications that use Chili-Pepper.
-
app_name
¶ The application name.
-
task
(environment_variables=None)[source]¶ The decorator to denote tasks. It must be implemented by cloud-specific App child classes.
- Parameters
environment_variables – Environment variables to apply to the task
-
task_functions
¶ The task functions identified with the
@app.task
decorator
-
-
class
chili_pepper.app.
AppProvider
[source]¶ Bases:
enum.Enum
Enum to identify the serverless provider.
Currently unused.
-
AWS
= 1¶
-
-
class
chili_pepper.app.
AwsAllowPermission
(allow_actions, allow_resources, sid=None)[source]¶ Bases:
object
Simple wrapper around an AWS IAM rule allowing permission(s) to resource(s)
-
allow_actions
¶ Returns: List[str]: Actions to grant permissions
-
allow_resources
¶ Returns: List[str]: The resources that should be granted permissions
-
sid
¶ Returns: Optional[str]: The sid of this policy statement
-
-
class
chili_pepper.app.
AwsApp
(app_name, config=None)[source]¶ Bases:
chili_pepper.app.App
-
allow_policy_permissions
¶ Extra permissions to allow functions in this app
- Returns
The extra permissions that should be granted
- Return type
List[AwsAllowPermission]
-
bucket_name
¶ The AWS S3 bucket name that holds the lambda deployment packages
- Returns
The bucket name
- Return type
str
Returns: Dict: The default tags to assign to all resources created when deploying this App
-
kms_key_arn
¶ The KMS key arn to use, or None to use the default AWS key
- Returns
The KMS key arn, or None to use the default key
- Return type
Optional[str]
-
runtime
¶ The AWS lambda runtime identifier.
- Returns
The runtime identifier
- Return type
str
-
security_group_ids
¶ Security Group IDs for the lambda function
- Returns
The security group IDs for the lambda function
- Return type
List[str]
-
subnet_ids
¶ Subnet IDs for the lambda function
- Returns
The subnet IDs for the lambda function
- Return type
List[str]
-
-
class
chili_pepper.app.
ChiliPepper
[source]¶ Bases:
object
-
create_app
(app_name, app_provider=<AppProvider.AWS: 1>, config=None)[source]¶ [summary]
- Parameters
app_name ([type]) – [description]
app_provider ([type], optional) – [description]. Defaults to AppProvider.AWS.
config ([type], optional) – [description]. Defaults to None.
- Raises
ChiliPepperException – [description]
- Returns
[description]
- Return type
[type]
-
-
exception
chili_pepper.app.
InvalidFunctionSignature
[source]¶ Bases:
chili_pepper.exception.ChiliPepperException
Function Signature does not match required specifications
Cloud providers require that functions have a specific signature. This exception is raised when a task does not match the required signature.
-
exception
chili_pepper.app.
InvocationError
[source]¶ Bases:
chili_pepper.exception.ChiliPepperException
Raised when there was a problem invoking the serverless function
-
exception
chili_pepper.app.
MissingArgumentError
[source]¶ Bases:
chili_pepper.exception.ChiliPepperException
Raised when there is a missing or incorrect argument in a method
-
class
chili_pepper.app.
Result
(lambda_function_name, event)[source]¶ Bases:
object
Task result object
Result wraps the information returned when the serverless function is invoked.
-
get
()[source]¶ Get the response from the serverless execution.
This is a potentially blocking call.
It will retrieve the return payload from the serverless function. If it is called before the serverless function has finished,
get
will block until the serverless function returns.- Raises
InvocationError – Raises if something goes retrieving the return payload of the serverless function.
- Returns
The return payload of the serverless function
- Return type
dict
-
get_log_result
()[source]¶ Get the log result from the serverless invocation.
This is potentially a blocking call.
- Returns
The last 4 KB of the execution log
- Return type
str
-
start
()[source]¶ Start executing the serverless function
Invokes the serverless function.
For AWS, this invokes the Lambda in a thread, since the only way to get results is to call synchronously. By putting the invoke call in a therad, it will not block the main application thread.
- Returns
The thread running the lambda
- Return type
Thread
-
-
class
chili_pepper.app.
TaskFunction
(func, environment_variables=None, memory=None, timeout=None, tags=None, activate_tracing=False)[source]¶ Bases:
object
A wrapper around python functions that can be serverlessly deployed and executed by chili-pepper
-
activate_tracing
¶ //docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-function.html#cfn-lambda-function-tracingconfig
This will return
True
if and only ifTrue
was passed to the constructor - any other value, even if it is Truthy, will not activate tracing- Returns
True
if tracing should be activate,False
otherwise- Return type
bool
- Type
https
-
environment_variables
¶ Returns: dict: The environment variable overrides for this function
-
func
¶ Returns: builtins.function: The python function
-
memory
¶ //docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-function.html#cfn-lambda-function-memorysize
- Returns
The memory allocation to grant to this serverless function
- Return type
Optional[int]
- Type
https
//docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-function.html#cfn-lambda-function-tags
- Returns
Tags for the serverless function
- Return type
Dict
- Type
https
-
timeout
¶ //docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-function.html#cfn-lambda-function-timeout
- Returns
Timeout value for the serverless function
- Return type
Optional[int]
- Type
https
-
chili_pepper.config module¶
chili_pepper.deployer module¶
-
class
chili_pepper.deployer.
Deployer
(app)[source]¶ Bases:
object