Orchestrator.py 文件源码

python
阅读 21 收藏 0 点赞 0 评论 0

项目:AWS_EC2_Scheduler 作者: tangerinedream 项目源码 文件源码
def lookupWorkloadSpecification(self, partitionTargetValue):
        try:
            dynamodbItem=self.dynDBC.get_item(
                TableName=self.workloadSpecificationTableName,
                Key={
                    self.workloadSpecificationPartitionKey : { "S" : partitionTargetValue }
                },
                ConsistentRead=False,
                ReturnConsumedCapacity="TOTAL",
            )
        except ClientError as e:
            self.logger.error('lookupWorkloadSpecification()' + e.response['Error']['Message'])
        else:
            # Get the dynamoDB Item from the result
            resultItem=dynamodbItem['Item']


            for attributeName in resultItem:
                # Validate the attributes entered into DynamoDB are valid.  If not, spit out individual warning messages
                if( attributeName in self.workloadSpecificationValidAttributeList ):
                    attributeValue=resultItem[attributeName].values()[0]
                    self.logger.info('Workload Attribute [%s maps to %s]' % (attributeName, attributeValue))
                    self.workloadSpecificationDict[attributeName]=attributeValue
                else:
                    self.logger.warning('Invalid dynamoDB attribute specified->'+str(attributeName)+'<- will be ignored')
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号