コード例 #1
0
ファイル: ParallelFetch.py プロジェクト: Katello/grinder
    def formProgressReport(self, step=None, itemInfo=None, status=None, progress=None):
        if not progress:
            progress = self.tracker.get_progress()

        itemsLeft = self.itemTotal - (self.syncErrorQ.qsize() + self.syncCompleteQ.qsize())
        r = ProgressReport(progress["total_size_bytes"], progress["remaining_bytes"], self.itemTotal, itemsLeft)
        r.item_name = None
        if itemInfo:
            r.item_complete = True
            r.item_name = itemInfo["fileName"]
            r.item_type = itemInfo["item_type"]
            r.item_relativepath = itemInfo["relativepath"]
            r.item_download_success = (status in BaseFetch.SUCCESS)
        r.status = None
        if status:
            r.status = status
        r.num_error = self.syncErrorQ.qsize()
        r.num_success = self.syncCompleteQ.qsize()
        r.sync_status = self.syncStatusDict
        r.details = progress["type_info"]
        r.error_details = self.error_details
        if step:
            self.step = step
        r.step = self.step
        return r
コード例 #2
0
 def start(self):
     # Assumption is all adds to toSyncQ have been completed at this point
     # We will grab the size of the items for total number of items to sync
     # before we kick off the threads to start fetching
     progress = self.tracker.get_progress()
     self.itemTotal = self.toSyncQ.qsize()
     LOG.info("%s items are marked to be fetched" % (self.itemTotal))
     if self.callback is not None:
         r = ProgressReport(progress["total_size_bytes"], progress["remaining_bytes"], self.itemTotal, self.toSyncQ.qsize())
         r.step = ProgressReport.DownloadItems
         r.status = "STARTED"
         r.details = progress["type_info"]
         self.callback(r)
     for t in self.threads:
         t.start()
コード例 #3
0
    def formProgressReport(self, step=None, itemInfo=None, status=None, progress=None):
        if not progress:
            progress = self.tracker.get_progress()

        itemsLeft = self.itemTotal - (self.syncErrorQ.qsize() + self.syncCompleteQ.qsize())
        r = ProgressReport(progress["total_size_bytes"], progress["remaining_bytes"], self.itemTotal, itemsLeft)
        r.item_name = None
        if itemInfo:
            if itemInfo.has_key("fileName"):
                r.item_name = itemInfo["fileName"]
            if itemInfo.has_key("item_type"):
                r.item_type = itemInfo["item_type"]
        r.status = None
        if status:
            r.status = status
        r.num_error = self.syncErrorQ.qsize()
        r.num_success = self.syncCompleteQ.qsize()
        r.sync_status = self.syncStatusDict
        r.details = progress["type_info"]
        r.error_details = self.error_details
        if step:
            self.step = step
        r.step = self.step
        return r