简体   繁体   English

Kaltura 上的 QUERY_EXCEEDED_MAX_MATCHES_ALLOWED 错误 API (Python)

[英]QUERY_EXCEEDED_MAX_MATCHES_ALLOWED error on Kaltura API (Python)

I'm unable to generate all entries in Kaltura.我无法在 Kaltura 中生成所有条目。 An ApiException with the message "Unable to generate list. max matches value was reached" (Error: QUERY_EXCEEDED_MAX_MATCHES_ALLOWED) gets triggered.触发带有消息“无法生成列表。已达到最大匹配值”(错误:QUERY_EXCEEDED_MAX_MATCHES_ALLOWED)的 ApiException。

I tried to work around such issue by setting my sessionPrivileges to disableentitlement我试图通过将我的 sessionPrivileges 设置为disableentitlement来解决这个问题

class class_chk_integrity():
    client = None
    pagesize = 0

    def __init__(self,worker_num, progress):
        self.pagesize = 30
        self.worker_num = worker_num
        self.progress = progress

        config = KalturaConfiguration(2723521)
        config.serviceUrl = "https://www.kaltura.com/"
        self.client = KalturaClient(config)
        ks = self.client.session.start("KALTURA_ADMIN_SECRET",
            "email@email.com",
            KalturaPluginsCore.KalturaSessionType.ADMIN,
            "KALTURA_PARTNER_ID",
            432000,
            "disableentitlement")
        self.client.setKs(ks)

I also tried to filter based on the id's.我还尝试根据 id 进行过滤。 However, I can't manage to put the filter.idNotIn to work properly.但是,我无法使filter.idNotIn正常工作。

   def get_total_reg(self, cont, lastEntryIds, lastEntryCreatedAt):
        
        
        filter = KalturaPluginsCore.KalturaBaseEntryFilter()

        if lastEntryIds != "":
            filter.idNotIn = lastEntryIds

        filter.orderBy = KalturaBaseEntryOrderBy.CREATED_AT_DESC

        pager = KalturaPluginsCore.KalturaFilterPager()
        

        pageIndex = 1
        entriesGot = 0

        pager.pageSize = self.pagesize
        pager.setPageIndex = pageIndex
        result = self.client.baseEntry.list(filter, pager)
        totalCount = result.totalCount

        if totalCount > 10000:
            totalCount = 9970

        if totalCount <= 0:
            cont = False
        
        while entriesGot < totalCount:

            pager.pageSize = self.pagesize
            pageIndex += 1
            pager.pageIndex = pageIndex
            result = self.client.baseEntry.list(filter, pager)
            entriesGot += len(result.objects)

        
            for e in result.objects:
                if lastEntryIds == "":
                    lastEntryIds.append(e.id)
                else:
                    lastEntryIds.append(e.id)

                lastEntryCreatedAt = e.createdAt
        

        return result.totalCount, self.pagesize, cont, lastEntryIds, lastEntryCreatedAt

This is my how I'm calling the functions这就是我调用函数的方式

if __name__ == '__main__':
    try:
        log = _ServiceUtils.log()
        log.setup('all', 'integrity')
        cont = True
        lastEntryIds = []
        lastEntryCreatedAt = 0


        while cont is True:

            kmc = class_chk_integrity(0,0)
        
            kmc_total_reg, kmc_page_size, cont, lastEntryIds, lastEntryCreatedAt = kmc.get_total_reg(cont, lastEntryIds, lastEntryCreatedAt)

            interval = 10
            max_threads = math.ceil(kmc_total_reg / (interval * kmc_page_size))
            # max_threads = 1
            threads_list = []

            print('TOTAL REG : %s | PAGE_SIZE : %s | INTERVAL : %s | THREADS : %s' % (kmc_total_reg,kmc_page_size,interval,max_threads))  

            progress = class_progress_thread(max_threads)

            for index in range(0,max_threads):
                page_ini = index * interval
                page_end = index * interval + interval
                progress.add_worker_progress(index,datetime.now())

                threads_list.append(threading.Thread(target=thread_chk_integrity, args=(index, log, index * interval + 1,index * interval + interval,progress)))
        
            threads_list.append(threading.Thread(target=thread_output_progress, args=(progress,max_threads)))    

            for thread in threads_list:
                thread.start()

            for thread in threads_list:
                thread.join()

            while not progress.stop(): time.sleep(30)


    except KeyboardInterrupt:
        try:
            sys.exit(0)
        except SystemExit:
            os._exit(0)

I'd appreciate any help with this.我将不胜感激任何帮助。 Thank you for your attention.感谢您的关注。

 if totalCount > 10000:
     totalCount = 9970

I'm curious to know why you are changing the totalCount this way.我很想知道您为什么要这样更改 totalCount。

Short answer - paging works as long as the result set is up to 10K.简短回答 - 只要结果集不超过 10K,分页就可以工作。

To work around that, sort the result by creation date (as you did), and when you get to 10K, start with a new search where the created_at date in the filter is the last value you got in the previous search.要解决这个问题,请按创建日期对结果进行排序(就像您所做的那样),当您达到 10K 时,开始新的搜索,其中过滤器中的 created_at 日期是您在上一次搜索中获得的最后一个值。 Reset your paging of course.当然重置你的分页。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Python GAE-调用Big Query API会引发超过最后期限的错误 - Python GAE - Call to Big Query API throws Deadline exceeded error Python请求“ URL超过最大重试次数”错误 - Python requests “Max retries exceeded with url” error 错误:Python 中的 url 超出了最大重试次数 - Error: Max retries exceeded with url in Python Python API 调用使用请求抛出最大重试次数超过 url 错误 - Python API call using requests throws Max retries exceeded with url error 使用适用于 Python 的 Docker API 时出现“URL 超出最大重试次数:/v1.35/containers/create”错误 - Getting "Max retries exceeded with URL: /v1.35/containers/create" error when using the Docker API for Python 使用 censusdata api,如何修复因 url 错误而超出最大条目 - Using censusdata api, how to fix the max entried exceeded with url error Python Requests Max retries exceeded with URL for Firebase Database REST API - Python Requests Max retries exceeded with URL for Firebase Database REST API 如何解决python请求错误:“Max retries exceeded with url” - How solve python requests error: “Max retries exceeded with url” 在python 3.7中获取请求错误,超过最大尝试次数 - get request error in python 3.7, max tries exceeded Python 模块 googletrans 抛出“超过 url:/ 的最大重试次数”错误 - Python module googletrans throwing "Max retries exceeded with url: /" error
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM