Session¶
-
class
pyLambdaFlows.session.Session(region_name='eu-west-3', auto_purge=False, aws_access_key_id=None, aws_secret_access_key=None, credentials_csv=None)[source]¶ This class is used to load and share credentials to all pyLambdaFlow ressources. You must instantiate this class first before send or eval a computational graph. Please go take a look at the given example. You can deal with more than one Session but the default way to give Session isn’t relevant in this case.
-
__init__(region_name='eu-west-3', auto_purge=False, aws_access_key_id=None, aws_secret_access_key=None, credentials_csv=None)[source]¶ The default constructor
This constructor ask you for your credentials. You can provide then either with the AWS csv (credentials_csv) or with the kwargs (aws_access_key_id, aws_secret_access_key). This class is like a boto3 factory which store all instanciated class.
You can change the credential but don’t forget to clear boto3 objects with clear function.
Parameters: region_name (str) – AWS server to use (default Paris).
-
clear()[source]¶ Clear all boto3 objects.
This method remove all boto3 objects in the Session memory. That means all new object will be created according to the current setted credential.
Usefull if you want to change the Session’s crendentials.
-
getBucket()[source]¶ Provide the S3 ressource for binded AWS account.
This method return the boto3 S3 ressource object using provided crendentials.
Raises: BadAWSCredential: Bad Credential.
-
getDynamoDb()[source]¶ Provide the dynamodb client for binded AWS account.
This method return the boto3 dynamodb client object using provided crendentials.
Raises: BadAWSCredential: Bad Credential.
-
getDynamoDbRessource()[source]¶ Provide the dynamodb ressource for binded AWS account.
This method return the boto3 dynamodb ressource object using provided crendentials.
Raises: BadAWSCredential: Bad Credential.
-
getIAM()[source]¶ Provide the IAM client for binded AWS account.
This method return the boto3 IAM client object using provided crendentials.
Raises: BadAWSCredential: Bad Credential.
-
getLambda()[source]¶ Provide the Lambda client for binded AWS account.
This method return the boto3 lambda client object using provided crendentials.
Raises: BadAWSCredential: Bad Credential.
-
getS3()[source]¶ Provide the S3 client for binded AWS account.
This method return the boto3 S3 client object using provided crendentials.
Raises: BadAWSCredential: Bad Credential.
-
setCredential(aws_access_key_id=None, aws_secret_access_key=None)[source]¶ Update current credential.
You can provide credential after the constructor with this method. The credential validity will be cheacked later on.
Parameters: - aws_access_key_id (str) – aws access key id
- aws_secret_access_key (str) – aws acces key
-
-
class
pyLambdaFlows.tree.Tree(target)[source]¶ Intern class to create json from input data and computational graph.
This class is for an intern purpose. It create a lambda instantiation graph with all dependancies in order to create the final json for AWS API call.
-
__init__(target)[source]¶ Default constructor.
This constructor requires a target pyLambdaflow node to deal with. This node will be concidered as the leaf node.
Parameters: target (pyLambdaFlows.Operation) – The node that will be treated.
-
compute(feed_dict)[source]¶ Intern method to create the dependancies graph with a feed dict.
This method applies a BFS on the computational graph in order to figure out the lambda instantiation number per OP.
Parameters: feed_dict (dict) – A dict with all datas. PyLambdaFlow as key and list as value. Raises: RuntimeError: If missing values on the feed_dict.
-
gen_counter_values()[source]¶ Return the parent number of each lambda instance.
This method compute the parents number for each lambda instance using the precomputed graph representation.
Returns: A list containing the parent number for the specific list index.
-
generateJson(tableName='None')[source]¶ Generate the request json.
This function compute the json with all children dependancies using a BFS algorithm and the precomputed lambda instance graph (compute method).
Parameters: tableName – Returns: the json
-