chili_pepper package¶
Submodules¶
chili_pepper.app module¶
-
class
chili_pepper.app.App(app_name, config=None)[source]¶ Bases:
objectCloud-agnostic App class
App is the main class for applications that use Chili-Pepper.
-
property
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
-
property
task_functions¶ The task functions identified with the
@app.taskdecorator
-
property
-
class
chili_pepper.app.AppProvider[source]¶ Bases:
enum.EnumEnum to identify the serverless provider.
Currently unused.
-
AWS= 1¶
-
-
class
chili_pepper.app.AwsAllowPermission(allow_actions, allow_resources, sid=None)[source]¶ Bases:
objectSimple wrapper around an AWS IAM rule allowing permission(s) to resource(s)
-
property
allow_actions¶ - Returns
Actions to grant permissions
- Return type
List[str]
-
property
allow_resources¶ - Returns
The resources that should be granted permissions
- Return type
List[str]
-
property
sid¶ - Returns
The sid of this policy statement
- Return type
Optional[str]
-
property
-
class
chili_pepper.app.AwsApp(app_name, config=None)[source]¶ Bases:
chili_pepper.app.App-
property
allow_policy_permissions¶ Extra permissions to allow functions in this app
- Returns
The extra permissions that should be granted
- Return type
List[AwsAllowPermission]
-
property
bucket_name¶ The AWS S3 bucket name that holds the lambda deployment packages
- Returns
The bucket name
- Return type
str
- Returns
The default tags to assign to all resources created when deploying this App
- Return type
Dict
-
property
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]
-
property
runtime¶ The AWS lambda runtime identifier.
- Returns
The runtime identifier
- Return type
str
-
property
security_group_ids¶ Security Group IDs for the lambda function
- Returns
The security group IDs for the lambda function
- Return type
List[str]
-
property
subnet_ids¶ Subnet IDs for the lambda function
- Returns
The subnet IDs for the lambda function
- Return type
List[str]
-
property
-
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.ChiliPepperExceptionFunction 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.ChiliPepperExceptionRaised when there was a problem invoking the serverless function
-
exception
chili_pepper.app.MissingArgumentError[source]¶ Bases:
chili_pepper.exception.ChiliPepperExceptionRaised when there is a missing or incorrect argument in a method
-
class
chili_pepper.app.Result(lambda_function_name, event)[source]¶ Bases:
objectTask 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,
getwill 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:
objectA wrapper around python functions that can be serverlessly deployed and executed by chili-pepper
-
property
activate_tracing¶ -
This will return
Trueif and only ifTruewas passed to the constructor - any other value, even if it is Truthy, will not activate tracing- Returns
Trueif tracing should be activate,Falseotherwise- Return type
bool
-
property
environment_variables¶ - Returns
The environment variable overrides for this function
- Return type
dict
-
property
func¶ - Returns
The python function
- Return type
builtins.function
-
property
memory¶ -
- Returns
The memory allocation to grant to this serverless function
- Return type
Optional[int]
-
- Returns
Tags for the serverless function
- Return type
Dict
-
property
timeout¶ -
- Returns
Timeout value for the serverless function
- Return type
Optional[int]
-
property
chili_pepper.config module¶
chili_pepper.deployer module¶
-
class
chili_pepper.deployer.Deployer(app)[source]¶ Bases:
object
-
chili_pepper.deployer.TITLE_SPLIT_REGEX_HACK= re.compile('[^a-zA-Z0-9]')¶