def __updateJobResultsPeriodic(self):
if self._isBestModelStored and not self._isBestModel:<EOL><INDENT>return<EOL><DEDENT>while True:<EOL><INDENT>jobResultsStr = self._jobsDAO.jobGetFields(self._jobID, ['<STR_LIT>'])[<NUM_LIT:0>]<EOL>if jobResultsStr is None:<EOL><INDENT>jobResults = {}<EOL><DEDENT>else:<EOL><INDENT>self._isBestModelStored = True<EOL>if not self._isBestModel:<EOL><INDENT>return<EOL><DEDENT>jobResults = json.loads(jobResultsStr)<EOL><DEDENT>bestModel = jobResults.get('<STR_LIT>', None)<EOL>bestMetric = jobResults.get('<STR_LIT>', None)<EOL>isSaved = jobResults.get('<STR_LIT>', False)<EOL>if (bestModel is not None) and (self._modelID != bestModel):<EOL><INDENT>self._isBestModel = False<EOL>return<EOL><DEDENT>self.__flushPredictionCache()<EOL>self._jobsDAO.modelUpdateTimestamp(self._modelID)<EOL>metrics = self._getMetrics()<EOL>jobResults['<STR_LIT>'] = self._modelID<EOL>jobResults['<STR_LIT>'] = metrics[self._optimizedMetricLabel]<EOL>jobResults['<STR_LIT>'] = metrics<EOL>jobResults['<STR_LIT>'] = False<EOL>newResults = json.dumps(jobResults)<EOL>isUpdated = self._jobsDAO.jobSetFieldIfEqual(self._jobID,<EOL>fieldName='<STR_LIT>',<EOL>curValue=jobResultsStr,<EOL>newValue=newResults)<EOL>if isUpdated or (not isUpdated and newResults==jobResultsStr):<EOL><INDENT>self._isBestModel = True<EOL>break<EOL><DEDENT><DEDENT>
Periodic check to see if this is the best model. This should only have an
effect if this is the *first* model to report its progress