def monitorSearchJob(self):
assert self.__searchJob is not None<EOL>jobID = self.__searchJob.getJobID()<EOL>startTime = time.time()<EOL>lastUpdateTime = datetime.now()<EOL>expectedNumModels = self.__searchJob.getExpectedNumModels(<EOL>searchMethod = self._options["<STR_LIT>"])<EOL>lastNumFinished = <NUM_LIT:0><EOL>finishedModelIDs = set()<EOL>finishedModelStats = _ModelStats()<EOL>lastWorkerState = None<EOL>lastJobResults = None<EOL>lastModelMilestones = None<EOL>lastEngStatus = None<EOL>hyperSearchFinished = False<EOL>while not hyperSearchFinished:<EOL><INDENT>jobInfo = self.__searchJob.getJobStatus(self._workers)<EOL>hyperSearchFinished = jobInfo.isFinished()<EOL>modelIDs = self.__searchJob.queryModelIDs()<EOL>_emit(Verbosity.DEBUG,<EOL>"<STR_LIT>" % (<EOL>len(modelIDs), len(finishedModelIDs)))<EOL>if len(modelIDs) > <NUM_LIT:0>:<EOL><INDENT>checkModelIDs = []<EOL>for modelID in modelIDs:<EOL><INDENT>if modelID not in finishedModelIDs:<EOL><INDENT>checkModelIDs.append(modelID)<EOL><DEDENT><DEDENT>del modelIDs<EOL>if checkModelIDs:<EOL><INDENT>_emit(Verbosity.DEBUG,<EOL>"<STR_LIT>" % (len(checkModelIDs)))<EOL>errorCompletionMsg = None<EOL>for (i, modelInfo) in enumerate(_iterModels(checkModelIDs)):<EOL><INDENT>_emit(Verbosity.DEBUG,<EOL>"<STR_LIT>" % (i, modelInfo))<EOL>if modelInfo.isFinished():<EOL><INDENT>finishedModelIDs.add(modelInfo.getModelID())<EOL>finishedModelStats.update(modelInfo)<EOL>if (modelInfo.getCompletionReason().isError() and<EOL>not errorCompletionMsg):<EOL><INDENT>errorCompletionMsg = modelInfo.getCompletionMsg()<EOL><DEDENT>metrics = modelInfo.getReportMetrics()<EOL>self.__foundMetrcsKeySet.update(list(metrics.keys()))<EOL><DEDENT><DEDENT><DEDENT>numFinished = len(finishedModelIDs)<EOL>if numFinished != lastNumFinished:<EOL><INDENT>lastNumFinished = numFinished<EOL>if expectedNumModels is None:<EOL><INDENT>expModelsStr = "<STR_LIT>"<EOL><DEDENT>else:<EOL><INDENT>expModelsStr = "<STR_LIT>" % (expectedNumModels)<EOL><DEDENT>stats = finishedModelStats<EOL>print(("<STR_LIT>"<EOL>"<STR_LIT>" % (<EOL>jobID,<EOL>numFinished,<EOL>expModelsStr,<EOL>(stats.numCompletedEOF+stats.numCompletedStopped),<EOL>"<STR_LIT>" if stats.numCompletedEOF else "<STR_LIT>",<EOL>stats.numCompletedEOF,<EOL>"<STR_LIT>" if stats.numCompletedStopped else "<STR_LIT>",<EOL>stats.numCompletedStopped,<EOL>"<STR_LIT>" if stats.numCompletedKilled else "<STR_LIT>",<EOL>stats.numCompletedKilled,<EOL>"<STR_LIT>" if stats.numCompletedError else "<STR_LIT:error>",<EOL>stats.numCompletedError,<EOL>"<STR_LIT>" if stats.numCompletedError else "<STR_LIT>",<EOL>stats.numCompletedOrphaned,<EOL>"<STR_LIT>" if stats.numCompletedOther else "<STR_LIT>",<EOL>stats.numCompletedOther)))<EOL>if errorCompletionMsg:<EOL><INDENT>print("<STR_LIT>" % errorCompletionMsg)<EOL><DEDENT><DEDENT>workerState = jobInfo.getWorkerState()<EOL>if workerState != lastWorkerState:<EOL><INDENT>print("<STR_LIT>" % (pprint.pformat(workerState,<EOL>indent=<NUM_LIT:4>)))<EOL>lastWorkerState = workerState<EOL><DEDENT>jobResults = jobInfo.getResults()<EOL>if jobResults != lastJobResults:<EOL><INDENT>print("<STR_LIT>"% (pprint.pformat(jobResults, indent=<NUM_LIT:4>), time.time()-startTime))<EOL>lastJobResults = jobResults<EOL><DEDENT>modelMilestones = jobInfo.getModelMilestones()<EOL>if modelMilestones != lastModelMilestones:<EOL><INDENT>print("<STR_LIT>" % (<EOL>pprint.pformat(modelMilestones, indent=<NUM_LIT:4>)))<EOL>lastModelMilestones = modelMilestones<EOL><DEDENT>engStatus = jobInfo.getEngStatus()<EOL>if engStatus != lastEngStatus:<EOL><INDENT>print("<STR_LIT>" % (engStatus))<EOL>lastEngStatus = engStatus<EOL><DEDENT><DEDENT>if not hyperSearchFinished:<EOL><INDENT>if self._options["<STR_LIT>"] != None:<EOL><INDENT>if ((datetime.now() - lastUpdateTime) ><EOL>timedelta(minutes=self._options["<STR_LIT>"])):<EOL><INDENT>print("<STR_LIT>")<EOL>self.__cjDAO.jobCancel(jobID)<EOL>sys.exit(<NUM_LIT:1>)<EOL><DEDENT><DEDENT>time.sleep(<NUM_LIT:1>)<EOL><DEDENT><DEDENT>modelIDs = self.__searchJob.queryModelIDs()<EOL>print("<STR_LIT>" % len(modelIDs))<EOL>print("<STR_LIT>")<EOL>jobInfo = self.__searchJob.getJobStatus(self._workers)<EOL>print("<STR_LIT>" % (jobInfo.getWorkerCompletionMsg()))<EOL>
Parameters:
----------------------------------------------------------------------
retval:         nothing