Git Product home page Git Product logo

awssl's Introduction

awssl

Python 2.7 package to construct ASL compliant JSON that define State Machines for AWS Step Functions.

Example

from awssl import Pass, StateMachine

s = Pass(
		Comment="This is an example of a state in branch",
		Name="Pass1",
		ResultAsJSON={"Value": 1234},
		OutputPath="$.Value",
		EndState=True)

sm = StateMachine(
		Comment="This is an instance of a State Machine",
		StartState=s)

print sm

The ext package provides more complex processing state types, such as For and LimitedParallel, by combining the core state types appropriately. These require particular Lambda functions to be present, which can be installed by creating a CloudFormation stack - see the script for details.

import awssl
import awssl.ext

# Declare the Arns for the Lambda functions required by awssl.ext state types
awssl.ext.set_ext_arns(
	ForInitializer="arn:aws:lambda:REGION:ACCOUNT_ID:function:FUNCTION_NAME", 
	ForExtractor="arn:aws:lambda:REGION:ACCOUNT_ID:function:FUNCTION_NAME", 
	ForConsolidator="arn:aws:lambda:REGION:ACCOUNT_ID:function:FUNCTION_NAME", 
	ForFinalizer="arn:aws:lambda:REGION:ACCOUNT_ID:function:FUNCTION_NAME",
	ForFinalizerParallelIterations="arn:aws:lambda:REGION:ACCOUNT_ID:function:FUNCTION_NAME",
	LimitedParallelConsolidator="arn:aws:lambda:REGION:ACCOUNT_ID:function:FUNCTION_NAME")

# Create the branch of concurrent processing to be performed - in this case extraction of the iteration value
p = awssl.Pass(Name="Dummy", EndState=True, OutputPath="$.iteration.Iteration")

# Sometimes we want to throttle concurrent processing - for example to prevent Lambda function throttling
# awssl.ext.LimitedParallel can limit the number of concurrent branches being processed at any given time
parallel = awssl.ext.LimitedParallel(
	Name="LimitedParallel",
	EndState=True,
	Iterations=100,
	IteratorPath="$.iteration",
	MaxConcurrency=15,
	BranchState=p)

# Construct state machine
sm = awssl.StateMachine(Comment="This is a test", StartState=parallel)
print sm

Installation

To install, use pip install awssl.

Documentation

Documentation is available at read the docs.

Coverage

The package provides support for version 1.0 of Amazon Step Language.

No checking is performed for correctness of Paths - these are expected to be valid JsonPath, as implemented by the Step Functions.

Licence

This project is released under the MIT license. See LICENSE for details.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.