Python 3.x 谷歌数据存储将';t插入数据

Python 3.x 谷歌数据存储将';t插入数据,python-3.x,google-app-engine,google-cloud-datastore,Python 3.x,Google App Engine,Google Cloud Datastore,我正在尝试将6000行/实体插入谷歌云数据存储。我还使用数据存储模拟器作为本地服务器 在代码中,我创建了一个插入函数,该函数使用put\u multi批量插入实体,并将批量大小设置为50。我使用python多处理生成执行函数的进程 slice函数还用于根据使用的CPU核数划分工作负载。e、 g.如果有3个核心,工作负载(6000个实体)分为3个部分,每个部分有2000个实体,然后每个部分由执行插入功能的衍生进程插入 插入完成后,我使用云数据存储管理控制台进行了检查,但找不到已插入的种类 我想知道

我正在尝试将6000行/
实体
插入
谷歌云数据存储
。我还使用
数据存储模拟器
作为本地服务器

在代码中,我创建了一个插入函数,该函数使用
put\u multi
批量插入实体,并将批量大小设置为50。我使用
python多处理
生成执行函数的进程

slice函数还用于根据使用的CPU核数划分工作负载。e、 g.如果有3个核心,工作负载(6000个
实体
)分为3个部分,每个部分有2000个
实体
,然后每个部分由执行插入功能的衍生进程插入

插入完成后,我使用
云数据存储管理
控制台进行了检查,但找不到已插入的
种类

我想知道这里的问题是什么,如何解决

代码片段如下所示

# cores_to_use is how many cpu cores available for dividing workload
cores_to_use = 3

# a datastore client is passed in as the argument
inserter = FastInsertGCDatastore(client)

# entities is a list of datastore entities to be inserted
# the number of entities is 6000 here
input_size = len(entities)
slice_size = int(input_size / cores_to_use)
entity_blocks = []

iterator = iter(entities)
for i in range(cores_to_use):
    entity_blocks.append([])
    for j in range(slice_size):
        entity_blocks[i].append(iterator.__next__())

for block in entity_blocks:
    p = multiprocessing.Process(target=inserter.execute, args=(block,))
    p.start()


class FastInsertGCDatastore:
    """
    batch insert entities into gc datastore based on batch_size and number_of_entities
    """
    def __init__(self, client):
        """
        initialize with datastore client
        :param client: the datastore client
        """
        self.client = client

    def execute(self, entities):
        """
        batch insert entities
        :param entities: a list of datastore entities need to be inserted
    """
        number_of_entities = len(entities)

        batch_size = 50

        batch_documents = [0] * batch_size
        rowct = 0  # entity count as index for accessing rows
        for index in range(number_of_entities):
            try:
                batch_documents[index % batch_size] = entities[rowct]
                rowct += 1
                if (index + 1) % batch_size == 0:
                    self.client.put_multi(batch_documents)
                index += 1
            except Exception as e:
                print('Unexpected error for index ', index, ' message reads', str(e))
                raise e

        # insert any remaining entities 
        if not index % batch_size == 0:
            self.client.put_multi(batch_documents[:index % batch_size])

有没有与此问题相关的代码?@Samson用代码片段更新了OP。