DynamoDb

DynamoGesture.reset_table(sess=None)

Reset a dynamodb table according to pylambdaflow specifications.

This method delete the dynamodb table is it already exist under given name. Then it recreate it with the given name and pylambdaflow specifications.

Parameters:
  • table_name (str) – Dynamodb name to use.
  • sess (Session) – Session to use, if not provided it will use the default one.
Raises:

NoSessionGiven : No session given

DynamoGesture.table_exists(sess=None)

Return if the table exist.

This function look at AWS API to return if the dynamodb table already exist.

Parameters:
  • table_name (str) – Dynamodb name to use.
  • sess (Session) – Session to use, if not provided it will use the default one.
Raises:

NoSessionGiven : No session given

DynamoGesture.delete_table(sess=None, wait=True)

Delete the dynamodb table on AWS server.

This function will delete the dynamodb table using either the specified or the default session.

Parameters:
  • table_name (str) – Dynamodb name to use.
  • sess (Session) – Session to use, if not provided it will use the default one.
  • wait (bool) – Should the function wait for the table removing.
Raises:

NoSessionGiven : No session given

DynamoGesture.decremente(idx, offset=1, sess=None)

Decrement the remaning field on the given id.

This function will decrease the remaining var on the specified dynamodb table. It will return the actual value of this var according to the asked operation.

Parameters:
  • table_name (str) – Dynamodb name to use.
  • idx (int) – key to deal with.
  • sess (Session) – Session to use, if not provided it will use the default one.
Raises:

NoSessionGiven : No session given

DynamoGesture.create_table(sess=None, wait=True)

Create a dynamodb table on AWS server with the specified name.

This function will create the dynamodb table using either the specified or the default session. The table will be created using the pyLambdaFlow specifications.

Parameters:
  • table_name (str) – Dynamodb name to use.
  • sess (Session) – Session to use, if not provided it will use the default one.
  • wait (bool) – Should the function wait for the table removing.
Raises:

NoSessionGiven : No session given

DynamoGesture.fill_table(counter_init, sess=None)

Update the whole table for computation.

This function will write on all required line on the table in order to prepare the computation over lambda call. The counter_init must be the array to all futur lambda call with the accocieted parent number. For instance, this counter_init array ([0,0,2]) means that the 2 firsts elements haven’t parent contrary to the last one.

Parameters:
  • table_name (str) – Dynamodb name to use.
  • counter_init (list) – The remaining field to use per table entry.
  • sess (Session) – Session to use, if not provided it will use the default one.
Raises:

NoSessionGiven : No session given

DynamoGesture.put_entry(idx, data, remaining, sess=None)

Update one entry on the table_name table.

This function will update on entry on the dynamodb table according to given args.

Parameters:
  • table_name (str) – Dynamodb name to use.
  • idx (int) – key entry to deal with.
  • data – Data to put on specified entry.
  • remaining (int) – Remaning value to use.
Raises:

NoSessionGiven : No session given

DynamoGesture.get_entries_group(bottom, top, sess=None)

Return the entries according to the given dynamodb table and the index interval.

This function provide the actual values from the bottom idx to the upper one. If you specified bottom = 1 and top=4, this function will return the following indexes : 1, 2, 3, 4.

Parameters:
  • table_name (str) – Dynamodb table name to use.
  • bottom (int) – Lower index to return.
  • top (int) – Upper index to return.
DynamoGesture.get_entries_list(idx_list, sess=None)

Return the entries according to the given dynamodb table and the index list.

This function provide the actual values specified on the idx list.

Parameters:
  • table_name (str) – Dynamodb table name to use.
  • idx_list (list) – Index list to deal with (int list).
DynamoGesture.get_entry(idx, sess=None)

Return the entry according to dynamodb table name and index entry.

This function provide the actual value of the specified entry (according to the dynamodb table name).

Parameters:
  • table_name (str) – Dynamodb name to use.
  • idx (int) – key entry to deal with.
  • remaining (int) – Remaning value to use.
Returns:

The entry as a tuple (idx, remaining, data).

Raises:

NoSessionGiven : No session given

DynamoGesture.put_data(indexData, obj, sess=None)

Update the serialized data on the specified dynamodb entry.

This function update the data field on the specified dynamodb table name and the specified entry.

Parameters:
  • table_name (str) – Dynamodb name to use.
  • indexData (int) – key entry to deal with.
  • obj (int) – Data to put in.
Raises:

NoSessionGiven : No session given

DynamoGesture.get_data(indexData, sess=None)

Return the accocieted serialized object according to the entry index and the table name.

This function provide the accual object on the table entry.

Parameters:
  • table_name (str) – Dynamodb name to use.
  • indexData (int) – key entry to deal with.
Returns:

The entry’s data.

Raises:

NoSessionGiven : No session given