def run(self):
<EOL>descriptionPyModule = helpers.loadExperimentDescriptionScriptFromDir(<EOL>self._experimentDir)<EOL>expIface = helpers.getExperimentDescriptionInterfaceFromModule(<EOL>descriptionPyModule)<EOL>expIface.normalizeStreamSources()<EOL>modelDescription = expIface.getModelDescription()<EOL>self._modelControl = expIface.getModelControl()<EOL>streamDef = self._modelControl['<STR_LIT>']<EOL>from nupic.data.stream_reader import StreamReader<EOL>readTimeout = <NUM_LIT:0><EOL>self._inputSource = StreamReader(streamDef, isBlocking=False,<EOL>maxTimeout=readTimeout)<EOL>fieldStats = self._getFieldStats()<EOL>self._model = ModelFactory.create(modelDescription)<EOL>self._model.setFieldStatistics(fieldStats)<EOL>self._model.enableLearning()<EOL>self._model.enableInference(self._modelControl.get("<STR_LIT>", None))<EOL>self.__metricMgr = MetricsManager(self._modelControl.get('<STR_LIT>',None),<EOL>self._model.getFieldInfo(),<EOL>self._model.getInferenceType())<EOL>self.__loggedMetricPatterns = self._modelControl.get("<STR_LIT>", [])<EOL>self._optimizedMetricLabel = self.__getOptimizedMetricLabel()<EOL>self._reportMetricLabels = matchPatterns(self._reportKeyPatterns,<EOL>self._getMetricLabels())<EOL>self._periodic = self._initPeriodicActivities()<EOL>numIters = self._modelControl.get('<STR_LIT>', -<NUM_LIT:1>)<EOL>learningOffAt = None<EOL>iterationCountInferOnly = self._modelControl.get('<STR_LIT>', <NUM_LIT:0>)<EOL>if iterationCountInferOnly == -<NUM_LIT:1>:<EOL><INDENT>self._model.disableLearning()<EOL><DEDENT>elif iterationCountInferOnly > <NUM_LIT:0>:<EOL><INDENT>assert numIters > iterationCountInferOnly, "<STR_LIT>""<STR_LIT>""<STR_LIT>"<EOL>learningOffAt = numIters - iterationCountInferOnly<EOL><DEDENT>self.__runTaskMainLoop(numIters, learningOffAt=learningOffAt)<EOL>self._finalize()<EOL>return (self._cmpReason, None)<EOL>
Runs the OPF Model

        Parameters:
        -------------------------------------------------------------------------
        retval:  (completionReason, completionMsg)
                  where completionReason is one of the ClientJobsDAO.CMPL_REASON_XXX
                    equates.