Beispiel #1
0
    def test_getFilename(self):
        with TestAreaContext("python/ert_log/log") as work_area:
            test_log_filename = "log_test_file.txt"
            ErtLog.init(1, test_log_filename, True)
            message = "This is fun"
            ErtLog.log(1, message)

            self.assertEqual(ErtLog.getFilename(), test_log_filename)
Beispiel #2
0
    def test_getFilename(self):
        with TestAreaContext("python/ert_log/log") as work_area:
            test_log_filename = "log_test_file.txt"
            ErtLog.init(1, test_log_filename, True)
            message = "This is fun"
            ErtLog.log(1, message)

            self.assertEqual(ErtLog.getFilename(), test_log_filename)
Beispiel #3
0
    def test_write_log(self):
        with TestAreaContext("python/ert_log/log") as work_area:
            test_log_filename = "test_log"
            ErtLog.cnamespace.init(1, test_log_filename, "unittester", True)
            message = "This is fun"
            ErtLog.log(1, message)

            self.assertTrue(os.path.isfile(test_log_filename))

            with open(test_log_filename, "r") as f:
                text = f.readlines()
                self.assertTrue(len(text) > 0)
                self.assertTrue(message in text[-1])
Beispiel #4
0
    def test_log(self):
        with TestAreaContext("python/ert_log/log") as work_area:
            test_log_filename = "test_log"
            ErtLog.init(1, test_log_filename, True)
            message = "This is fun"
            ErtLog.log(1, message)

            self.assertTrue(os.path.isfile(test_log_filename))

            with open(test_log_filename, "r") as f:
                text = f.readlines()
                self.assertTrue(len(text) > 0)
                self.assertTrue(message in text[-1])
Beispiel #5
0
 def checkHaveSufficientRealizations(self, num_successful_realizations):
     if num_successful_realizations == 0:
         raise ErtRunError("Simulation failed! All realizations failed!")
     elif not self.ert().analysisConfig().haveEnoughRealisations(
             num_successful_realizations,
             self.ert().getEnsembleSize()):
         raise ErtRunError(
             "Too many simulations have failed! You can add/adjust MIN_REALIZATIONS to allow failures in your simulations.\n\n"
             "Check ERT log file '%s' or simulation folder for details." %
             ErtLog.getFilename())
Beispiel #6
0
    def runSimulations(self):
        self.setPhase(0, "Running simulations...", indeterminate=False)
        active_realization_mask = ActiveRealizationsModel().getActiveRealizationsMask()

        self.setPhaseName("Pre processing...", indeterminate=True)
        self.ert().getEnkfSimulationRunner().createRunPath(active_realization_mask, 0)
        self.ert().getEnkfSimulationRunner().runWorkflows( HookRuntime.PRE_SIMULATION )

        self.setPhaseName("Running ensemble experiment...", indeterminate=False)

        success = self.ert().getEnkfSimulationRunner().runEnsembleExperiment(active_realization_mask)

        if not success:
            raise ErtRunError("Simulation or loading of results failed! \n"
                              "Check ERT log file '%s' or simulation folder for details." % ErtLog.getFilename())

        self.setPhaseName("Post processing...", indeterminate=True)
        self.ert().getEnkfSimulationRunner().runWorkflows( HookRuntime.POST_SIMULATION )

        self.setPhase(1, "Simulations completed.") # done...
Beispiel #7
0
 def checkHaveSufficientRealizations(self, num_successful_realizations):
     if num_successful_realizations == 0:
         raise ErtRunError("Simulation failed! All realizations failed!")
     elif not self.ert().analysisConfig().haveEnoughRealisations(num_successful_realizations, self.ert().getEnsembleSize()):
         raise ErtRunError("Too many simulations have failed! You can add/adjust MIN_REALIZATIONS to allow failures in your simulations.\n\n"
                           "Check ERT log file '%s' or simulation folder for details." % ErtLog.getFilename())