本文整理汇总了Python中datastore.DataStore.updateRecordWithAnalysisData方法的典型用法代码示例。如果您正苦于以下问题:Python DataStore.updateRecordWithAnalysisData方法的具体用法?Python DataStore.updateRecordWithAnalysisData怎么用?Python DataStore.updateRecordWithAnalysisData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类datastore.DataStore
的用法示例。
在下文中一共展示了DataStore.updateRecordWithAnalysisData方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: analyzeBWFFile
# 需要导入模块: from datastore import DataStore [as 别名]
# 或者: from datastore.DataStore import updateRecordWithAnalysisData [as 别名]
#.........这里部分代码省略.........
success = setStatusAsPendingArchive(getDaisyNumber(os.path.basename(filePath)))
nextStatus = 'Pending Archive'
datastore.updateRecordWithDaisyStatus(nextStatus, record.id)
if success == True:
#update staus field in db and set to success
logging.debug('updating status successfully')
datastore.successfullyUpdatedDaisyStatus(record.id)
else:
#put infor in db that you couldn't update status in Daisy
logging.debug('not updating status successfully')
datastore.failedToUpdateDaisyStatus(record.id)
else:
sendAnalysisFailure(resultObject)
if comments == None:
comments = ''
#update Comments
comments = stringMinusBWFAnalyzerInfo(comments)
if comments != '':
comments += " "
comments += BWFAnalyzerInfoForErrors(resultObject['errors'])
success = setComments(getDaisyNumber(os.path.basename(filePath)), comments)
#update local datastore
datastore.updateRecordWithComments(comments, record.id)
if success == True:
#update comments field in db and set to success
logging.debug('updating comments successfully')
datastore.successfullyUpdatedDaisyComments(record.id)
else:
#put infor in db that you couldn't update Daisy
logging.debug('not updating comments successfully')
datastore.failedToUpdateDaisyComments(record.id)
#update Status
if status not in ['Being Made', 'Ordered', 'Pending Archive']:
#ok to update status
success = setStatusAsNeedsAttention(getDaisyNumber(os.path.basename(filePath)))
datastore.updateRecordWithDaisyStatus('Needs Attention', record.id)
if success == True:
#update staus field in db and set to success
logging.debug('updating status successfully')
datastore.successfullyUpdatedDaisyStatus(record.id)
else:
#put infor in db that you couldn't update status in Daisy
logging.debug('not updating status successfully')
datastore.failedToUpdateDaisyStatus(record.id)
else:
success = setStatusAsPendingArchive(getDaisyNumber(os.path.basename(filePath)))
datastore.updateRecordWithDaisyStatus('Pending Archive', record.id)
if success == True:
#update status field in db and set to success
logging.debug('updating status successfully')
datastore.successfullyUpdatedDaisyStatus(record.id)
else:
#put infor in db that you couldn't update status in Daisy
logging.debug('not updating status successfully')
datastore.failedToUpdateDaisyStatus(record.id)
if datastore.updateRecordWithAnalysisData(result, record.id) == False:
info = 'Unable to save record %d %s' % (record.id, result)
sendProcessFailureMessage({'subject':'Process Error Unable To Save Record', 'message':info})
continue
#update vendor info
datastore.updateRecordWithVendor(vendor, record.id)
dataTuple = retrieveDataForDANumber(os.path.basename(filePath), identifier)
logging.debug('Data for {} After: {}'.format(os.path.basename(filePath),dataTuple))
#now that we have saved the data, we are ready to move the file
nextBox = configurationOptions().defaultPathStructure()['outBox']
if resultObject['result'] != 'success':
nextBox = configurationOptions().defaultPathStructure()['failBox']
nextBox = os.path.expanduser(nextBox)
newPath = filePath
try:
newPath = pathAfterSafelyMovingFileToDestinationFolder(filePath, nextBox)
except Exception as e:
logging.debug('Analyze File: Error moving file')
info = '''This should not happen as pathAfterSafelyMovingFileToDestinationFolder should create a unique name that avoids any collisions, otherwise the file has been moved'''
logging.debug(info)
info = 'There was a problem moving the file into into ' + nextBox + ' for: ' + os.path.basename(filePath)
info = info + '\n' + 'This will require manual intervention as the occurrence is unique.'
sendProcessFailureMessage({'subject':'Process Error Moving File', 'message':info})
continue
logging.debug('Analyze File: preparing to move file to final path...')
datastore.updateRecordAsCompleteWithFinalPath(newPath, record.id)
except Exception as e:
info = 'Exception in analyzeBWFFile' + e.message
logging.debug(info)
sendProcessFailureMessage({'subject':'Exception!', 'message':info})