def GetData()

in render-wallboard.py [0:0]


def GetData():
    global Logger,Data,NextAgent,SortedAgentList,FullAgentNames
    
    SortedAgentList = []
    NextAgent       = 0

    #
    # All data retrieved from other sources is stored in the DDB table with
    # the primary partition key of "Data" and a primary sort key of the name
    # of the value that has been stored.
    # We could get back numerical data (stored as a string) or agent state
    # details.
    #
    try:
        Response = Table.query(KeyConditionExpression=Key("Identifier").eq("Data"))
    except ClientError as e:
        Logger.error("DynamoDB error: "+e.response["Error"]["Message"])
        return
    
    if len(Response["Items"]) == 0:
        Logger.error("Did not get any data from DynamoDB")
        return

    for Item in Response["Items"]:
        Data[Item["RecordType"]] = Item["Value"]
        if "AgentARN" in Item:
            SortedAgentList.append(Item["RecordType"])
            if "FullAgentName" in Item:
                FullAgentNames[Item["RecordType"]] = Item["FullAgentName"]
        
    #
    # We want the agents in alphabetical order
    #
    SortedAgentList.sort()