当前位置: 首页>>代码示例>>Python>>正文


Python MOSES.getETA方法代码示例

本文整理汇总了Python中MOSES.getETA方法的典型用法代码示例。如果您正苦于以下问题:Python MOSES.getETA方法的具体用法?Python MOSES.getETA怎么用?Python MOSES.getETA使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MOSES的用法示例。


在下文中一共展示了MOSES.getETA方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: processSearchStrings

# 需要导入模块: import MOSES [as 别名]
# 或者: from MOSES import getETA [as 别名]
    def processSearchStrings(self):
        search_results = []
        self.stop_sending = False
        start_time = datetime.datetime.now()
        total = len(self.search_strings)
        counter = 1
        last_update_time = datetime.datetime.now()
        initial_search_strings = self.search_strings

        for search_string in initial_search_strings:
            #print "Looping in Peeves!"
            try:
                search_result = self.search_function[self.search_type](self.user_id, self.password, search_string)
            except:
                time.sleep(5)
                try:
                    search_result= self.search_function[self.search_type](self.user_id, self.password, search_string)
                except:
                    time.sleep(5)
                    try:
                        search_result= self.search_function[self.search_type](self.user_id, self.password, search_string)
                    except:
                        time.sleep(5)
                        try:
                            search_result= self.search_function[self.search_type](self.user_id, self.password, search_string)
                        except:
                            raise
            search_results.extend(search_result)
            if initial_search_strings != self.search_strings:
                #If the search string list isn't the same as we started with, stop.
                break
            #if ((datetime.datetime.now() - last_update_time) >= datetime.timedelta(seconds=10)) or (counter == total):
            if self.stop_sending:
                break
            if total == 0:
                break
            if total > 0:
                eta = MOSES.getETA(start_time, counter, total)
                self.sendProgress.emit(counter, total, eta)
                self.sendData.emit(search_results)
                last_update_time = datetime.datetime.now()
                #print "Sending Status signal!"
            counter += 1
        if total > 0:
            if (not self.sent) and (not self.stop_sending):
                    #If the search string list is the same as the one we started with, then emit.
                #print "Sending data!"
                self.sendData.emit(search_results)
                self.sent = True
开发者ID:vinay87,项目名称:oink,代码行数:51,代码来源:Peeves.py

示例2: repr

# 需要导入模块: import MOSES [as 别名]
# 或者: from MOSES import getETA [as 别名]
             pass
             time.sleep(5)
             try:
                 writer_summary = self.fetchWriterSummary(2)
             except Exception, err:
                 print "********\nEncountered an error while trying to fetch data for the summary sheet in PorkKent.\nPrinting the error:\n%s\n********" % repr(err)
                 pass
                 time.sleep(5)
                 try:
                     writer_summary = self.fetchWriterSummary(3)
                 except Exception, err:
                     print "********\nEncountered an error while trying to fetch data for the summary sheet in PorkKent.\nPrinting the error:\n%s\n********" % repr(err)
                     raise
     self.summary_data.append(writer_summary)
     done = len(self.summary_data)
     self.processingSummary.emit(done,total, MOSES.getETA(start_time, done, total))
     self.gotSummary.emit(self.summary_data)
     self.completedSummary.emit(False)
     if self.break_loop:
         self.processingStep.emit("Breaking the loop!")
         break
 if not self.break_loop:
     self.completedSummary.emit(True)
     self.readyForTeamReport.emit(self.summary_data)
     finished_all_writers = True
     self.processingStep.emit("Finished processing data for all writers between %s and %s." % (self.start_date, self.end_date))
 else:
     self.break_loop = False
 #After looping, once the writers' data is done, emit the team summary data.
 #if finished_all_writers:
 #    team_report = self.getTeamReport(self.summary_data)
开发者ID:vinay87,项目名称:oink,代码行数:33,代码来源:PorkKent.py

示例3: str

# 需要导入模块: import MOSES [as 别名]
# 或者: from MOSES import getETA [as 别名]
                primary_key_field_list = ['`%s` = "%s"'%(column, str(each_row[column]).replace('"',"'")) for column in primary_key_columns]
                primary_key_query = " AND ".join(primary_key_field_list)
                sqlcmdstring = "UPDATE `rejected_rawdata` SET %s WHERE %s;" % (update_query, primary_key_query)
                try:
                    cursor.execute(sqlcmdstring)
                    conn.commit()
                    success = True
                except Exception, err:
                    print repr(err)
                    print sqlcmdstring
                    success = False
            except Exception, e:
                print repr(e)
                print sqlcmdstring
                success = False
            if success:
                rejected += 1
            else:
                failed += 1
            counter = accepted + rejected + failed
            progress = int(math.floor(counter/total*100))
            eta = MOSES.getETA(start_time, counter, total)
            pending = total - counter
            self.sendActivity.emit(progress, eta, accepted, rejected, failed, pending)
        conn.close()
        self.sendMessage.emit("Completed at %s. Accepted: %d, Rejected: %d, Failed: %d. Pending: %d."%(datetime.datetime.now(), accepted, rejected, failed, pending))
        self.data_frame = None

    def setDataFrame(self, data_frame):
        self.data_frame = data_frame
开发者ID:vinay87,项目名称:oink,代码行数:32,代码来源:RawDataUploaderThread.py

示例4: process

# 需要导入模块: import MOSES [as 别名]
# 或者: from MOSES import getETA [as 别名]
 def process(self):
     self.stop_sending = False
     data_dict = dict((sheet, None) for sheet in self.sheet_list)
     start_time = datetime.datetime.now()
     last_update_time = datetime.datetime.now()
     counter = 1
     total = len(self.sheet_list)
     for sheet in self.sheet_list:
         progress = ((counter-1)/total)*100
         self.sendProgress.emit("(Please Wait): Processing summary for %s." %sheet, MOSES.getETA(start_time, counter, total), progress)
         data_dict[sheet] = summarizeClarificationSheet(self.google_credentials, self.sheet_name, self.query_date, sheet)
         self.sendSummary.emit(data_dict, self.sheet_list, self.query_date, False)
         counter +=1
     if not self.stop_sending:
         self.sendSummary.emit(data_dict, self.sheet_list, self.query_date, True)
         self.sendProgress.emit("Completed", datetime.datetime.now(), 100)
         self.send = False
开发者ID:vinay87,项目名称:oink,代码行数:19,代码来源:StyCleaner.py

示例5: summarize

# 需要导入模块: import MOSES [as 别名]
# 或者: from MOSES import getETA [as 别名]
    def summarize(self):
        """
        1. Get the list of all writers working on the start_date.
        
        2. For each writer, 
            2.1 If the dates are different, get the average efficiency between the two dates.
            2.2 get the efficiency on the end_date.
            2.4 get the efficiency on the week of the end_date.
            2.5 get the effiency on the month of the end_date.
            2.6 get the efficiency on the quarter.
            2.7 get the effiency on the half-year.
        3. Build all this information into a dictionary.
        4. Compile all dictionaries into a list.
        5. Emit the list.
        """
        self.summary_data = []
        done = 0
        total = len(self.writers_list)
        start_time = datetime.datetime.now()
        self.mode = self.getMode()
        for writer_name in self.writers_list:
            writer_summary = self.fetchWriterSummary(writer_name)
            self.summary_data.append(writer_summary)
            done = len(self.summary_data)
            self.sendProgress.emit("Processed data for %s for %s."%(writer_name, self.start_date), MOSES.getETA(start_time, done, total), int(done*100/total), False)
            self.sendReport.emit(self.summary_data)

        self.sendReport.emit(self.summary_data)
        self.allowRun = False
        self.sendProgress.emit("Finished processing data for all writers for %s." % self.start_date, datetime.datetime.now(),100,True)
开发者ID:vinay87,项目名称:oink,代码行数:32,代码来源:PorkLane.py


注:本文中的MOSES.getETA方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。