Exemplo n.º 1
0
    def verify_json_dump(self, selected_jobs, global_args, umask):
        self.assertTrue(os.path.isfile(self.JOBS_JSON_FILE))
        config = load_configs(self.JOBS_JSON_FILE)

        self.assertEqual(umask, int(config["umask"], 8))
        self.assertEqual(len(selected_jobs), len(config["jobList"]))

        ert_version = config["ert_version"]
        loaded_version = Version(ert_version[0], ert_version[1], ert_version[2])
        self.assertEqual(Version.currentVersion(), loaded_version)
        
        for i in range(len(selected_jobs)):
            job = joblist[selected_jobs[i]]
            loaded_job = config["jobList"][i]

            # Since no argList is loaded as an empty list by ext_job
            arg_list_back_up = job["argList"]
            job["argList"] = empty_list_if_none(job["argList"])

            # Since name is set to default if none provided by ext_job
            name_back_up = job["name"]
            job["name"] = default_name_if_none(job["name"])

            for key in json_keywords:
                self.assertEqual(job[key], loaded_job[key])

            job["argList"] = arg_list_back_up
            job["name"] = name_back_up
Exemplo n.º 2
0
    def requireVersion(major, minor, micro="git"):
        required_version = Version(major, minor, micro)
        current_version = Version.currentVersion()

        if required_version < current_version:
            return True
        else:
            return False
Exemplo n.º 3
0
    def test_eq(self):
        v1 = Version(1, 2, 3)
        v2 = Version(1, 2, 3)

        self.assertTrue(v1 == v2)
        self.assertEqual(v1, v2)
        self.assertEqual(str(v1), str(v2))
        self.assertEqual(repr(v1), repr(v2))
        self.assertFalse(v1 != v2)

        v1 = Version(1, 2, "X")
        v2 = Version(1, 2, "Y")
        self.assertTrue(v1 != v2)
        self.assertFalse(v1 == v2)

        v1 = Version(1, 2, "X")
        v2 = Version(1, 2, 0)
        self.assertTrue(v1 != v2)
        self.assertFalse(v1 == v2)

        v1 = Version(1, 2, "X")
        v2 = Version(1, 3, "X")
        self.assertTrue(v1 != v2)
        self.assertFalse(v1 == v2)

        v1 = Version(1, 2, "X")
        v2 = (1, 3, "X")
        self.assertTrue(v1 != v2)
        self.assertFalse(v1 == v2)
Exemplo n.º 4
0
    def test_eq(self):
        v1 = Version(1, 2, 3)
        v2 = Version(1, 2, 3)

        self.assertTrue(v1 == v2)
        self.assertFalse(v1 != v2)

        v1 = Version(1, 2, "X")
        v2 = Version(1, 2, "Y")
        self.assertTrue(v1 != v2)
        self.assertFalse(v1 == v2)

        v1 = Version(1, 2, "X")
        v2 = Version(1, 2, 0)
        self.assertTrue(v1 != v2)
        self.assertFalse(v1 == v2)

        v1 = Version(1, 2, "X")
        v2 = Version(1, 3, "X")
        self.assertTrue(v1 != v2)
        self.assertFalse(v1 == v2)

        v1 = Version(1, 2, "X")
        v2 = (1, 3, "X")
        self.assertTrue(v1 != v2)
        self.assertFalse(v1 == v2)
Exemplo n.º 5
0
def main(argv):

    app = QApplication(argv) #Early so that QT is initialized before other imports
    app.setWindowIcon(resourceIcon("application/window_icon_cutout"))

    if len(argv) == 1:
        sys.stderr.write("Missing configuration file")
        sys.exit(1)

    config_file = argv[1]
    strict = True
        
    if not os.path.exists(config_file):
        print("Can not run without a configuration file.")
        sys.exit(1)

    if os.path.isdir(config_file):
        print("The specified configuration file is a directory!")
        sys.exit(1)


    splash = ErtSplash()
    splash.version = "Version %s" % Version.getVersion()
    splash.timestamp = Version.getBuildTime()

    splash.show()
    splash.repaint()

    now = time.time()


    ert = EnKFMain(config_file, strict=strict, verbose=False)
    ert_gui.configureErtNotifier(ert, config_file)

    window = PlotWindow(ert, None)

    sleep_time = 2 - (time.time() - now)

    if sleep_time > 0:
        time.sleep(sleep_time)

    window.show()
    splash.finish(window)
    window.activateWindow()
    window.raise_()
    finished_code = app.exec_()

    ert.free()

    sys.exit(finished_code)
Exemplo n.º 6
0
def main(argv):

    app = QApplication(
        argv)  #Early so that QT is initialized before other imports
    app.setWindowIcon(util.resourceIcon("application/window_icon_cutout"))

    if len(argv) == 1:
        sys.stderr.write("Missing configuration file")
        sys.exit(1)

    config_file = argv[1]
    strict = True

    if not os.path.exists(config_file):
        print("Can not run without a configuration file.")
        sys.exit(1)

    if os.path.isdir(config_file):
        print("The specified configuration file is a directory!")
        sys.exit(1)

    splash = ErtSplash()
    splash.version = "Version %s" % Version.getVersion()
    splash.timestamp = Version.getBuildTime()

    splash.show()
    splash.repaint()

    now = time.time()

    ert = EnKFMain(config_file, strict=strict, verbose=False)
    ErtConnector.setErt(ert)

    window = PlotWindow(ert, None)

    sleep_time = 2 - (time.time() - now)

    if sleep_time > 0:
        time.sleep(sleep_time)

    window.show()
    splash.finish(window)
    window.activateWindow()
    window.raise_()
    finished_code = app.exec_()

    ert.free()

    sys.exit(finished_code)
Exemplo n.º 7
0
    def test_create(self):
        v1 = Version(1, 8, 6)
        self.assertFalse(v1.isDevelVersion())

        self.assertEqual(v1.versionString(), "1.8.6")
        self.assertEqual(v1.versionTuple(), (1, 8, 6))

        v2 = Version(2, 0, "X")
        self.assertTrue(v2.isDevelVersion())
Exemplo n.º 8
0
    def requireVersion(major , minor , micro = "git"):
        required_version = Version(major, minor , micro)
        current_version = Version.currentVersion()

        if required_version < current_version:
            return True
        else:
            return False
Exemplo n.º 9
0
    def test_import(self):
        from ert import Version as globalVersion
        v1 = globalVersion(1, 1, 2)
        v2 = Version(1, 1, 2)

        self.assertTrue(v1 == v2)
        self.assertEqual(v1, v2)
        self.assertEqual(repr(v1), repr(v2))
Exemplo n.º 10
0
    def test_ge(self):
        v1 = Version(1, 2, 3)
        v2 = Version(1, 2, 3)
        v3 = (1, 2, 2)

        self.assertEqual(str(v1), str(v2))
        self.assertEqual(repr(v1), repr(v2))

        self.assertTrue(v1 >= v2)
        self.assertFalse(v1 < v2)

        self.assertTrue(v1 >= v3)
        self.assertFalse(v1 < v3)

        v1 = Version(1, 2, "X")
        v2 = Version(1, 1, 9)
        self.assertTrue(v1 > v2)

        v2 = Version(1, 2, "X")
        self.assertTrue(v1 >= v2)

        v2 = Version(1, 2, 0)
        self.assertFalse(v1 >= v2)

        self.assertNotEqual(str(v1), str(v2))
        self.assertNotEqual(repr(v1), repr(v2))
Exemplo n.º 11
0
    def test_create(self):
        v1 = Version(1, 8, 6)
        self.assertFalse(v1.isDevelVersion())

        self.assertEqual(v1.versionString(), "1.8.6")
        self.assertEqual(v1.versionTuple(), (1, 8, 6))

        v2 = Version(2, 0, "X")
        self.assertTrue(v2.isDevelVersion())
Exemplo n.º 12
0
    def createInfoLayout():
        info_layout = QVBoxLayout()

        ert = QLabel()
        ert.setAlignment(Qt.AlignHCenter)

        title_font = QFont()
        title_font.setPointSize(40)
        ert.setFont(title_font)
        ert.setText("ERT")

        info_layout.addWidget(ert)
        info_layout.addStretch(1)
        ert_title = QLabel()
        ert_title.setAlignment(Qt.AlignHCenter)
        ert_title.setText("Ensemble based Reservoir Tool")
        info_layout.addWidget(ert_title)

        version = QLabel()
        version.setAlignment(Qt.AlignHCenter)
        version.setText("Version: %s" % Version.getVersion())
        info_layout.addWidget(version)

        timestamp = QLabel()
        timestamp.setAlignment(Qt.AlignHCenter)
        timestamp.setText("Build time: %s" % Version.getBuildTime())
        info_layout.addWidget(timestamp)

        git_commit = QLabel()
        git_commit.setAlignment(Qt.AlignHCenter)
        git_commit.setText("Git commit hash: %s" %
                           Version.getGitCommit(short=True))
        info_layout.addWidget(git_commit)

        info_layout.addStretch(5)

        return info_layout
Exemplo n.º 13
0
    def createInfoLayout():
        info_layout = QVBoxLayout()

        ert = QLabel()
        ert.setAlignment(Qt.AlignHCenter)

        title_font = QFont()
        title_font.setPointSize(40)
        ert.setFont(title_font)
        ert.setText("ERT")

        info_layout.addWidget(ert)
        info_layout.addStretch(1)
        ert_title = QLabel()
        ert_title.setAlignment(Qt.AlignHCenter)
        ert_title.setText("Ensemble based Reservoir Tool")
        info_layout.addWidget(ert_title)

        version = QLabel()
        version.setAlignment(Qt.AlignHCenter)
        version.setText("Version: %s" % Version.getVersion())
        info_layout.addWidget(version)

        timestamp = QLabel()
        timestamp.setAlignment(Qt.AlignHCenter)
        timestamp.setText("Build time: %s" % Version.getBuildTime())
        info_layout.addWidget(timestamp)

        git_commit = QLabel()
        git_commit.setAlignment(Qt.AlignHCenter)
        git_commit.setText("Git commit hash: %s" % Version.getGitCommit(short=True))
        info_layout.addWidget(git_commit)

        info_layout.addStretch(5)

        return info_layout
Exemplo n.º 14
0
    def test_ge(self):
        v1 = Version(1, 2, 3)
        v2 = Version(1, 2, 3)
        v3 = (1, 2, 2)

        self.assertTrue(v1 >= v2)
        self.assertFalse(v1 < v2)

        self.assertTrue(v1 >= v3)
        self.assertFalse(v1 < v3)

        v1 = Version(1, 2, "X")
        v2 = Version(1, 1, 9)
        self.assertTrue(v1 > v2)

        v2 = Version(1, 2, "X")
        self.assertTrue(v1 >= v2)

        v2 = Version(1, 2, 0)
        self.assertFalse(v1 >= v2)
Exemplo n.º 15
0
def main(argv):

    app = QApplication(argv) #Early so that QT is initialized before other imports
    app.setWindowIcon(util.resourceIcon("application/window_icon_cutout"))

    if len(argv) == 1:
        config_file = QFileDialog.getOpenFileName(None, "Open Configuration File")

        config_file = str(config_file)

        if len(config_file) == 0:
            print("-----------------------------------------------------------------")
            print("-- You must supply the name of configuration file as the first --")
            print("-- commandline argument:                                       --")
            print("--                                                             --")
            print("-- bash%  gert <config_file>                                   --")
            print("--                                                             --")
            print("-- If the configuration file does not exist, gert will create  --")
            print("-- create a new configuration file.                            --")
            print("-----------------------------------------------------------------")

            sys.exit(1)
    else:
        config_file = argv[1]

    help_center = HelpCenter("ERT")
    help_center.setHelpLinkPrefix(os.getenv("ERT_SHARE_PATH") + "/gui/help/")
    help_center.setHelpMessageLink("welcome_to_ert")

    strict = True
        
    verbose = False
    verbose_var = os.getenv("ERT_VERBOSE", "False")
    lower_verbose_var = verbose_var.lower() 
    if lower_verbose_var == "true": 
        verbose = True


    if not os.path.exists(config_file):
        print("Trying to start new config")
        new_configuration_dialog = NewConfigurationDialog(config_file)
        success = new_configuration_dialog.exec_()
        if not success:
            print("Can not run without a configuration file.")
            sys.exit(1)
        else:
            config_file = new_configuration_dialog.getConfigurationPath()
            first_case_name = new_configuration_dialog.getCaseName()
            dbase_type = new_configuration_dialog.getDBaseType()
            num_realizations = new_configuration_dialog.getNumberOfRealizations()
            storage_path = new_configuration_dialog.getStoragePath()

            EnKFMain.createNewConfig(config_file, storage_path, first_case_name, dbase_type, num_realizations)
            strict = False


    if os.path.isdir(config_file):
        print("The specified configuration file is a directory!")
        sys.exit(1)


    splash = ErtSplash()
    splash.version = "Version %s" % Version.getVersion()
    splash.timestamp = Version.getBuildTime()

    splash.show()
    splash.repaint()

    now = time.time()


    ert = Ert(EnKFMain(config_file, strict=strict, verbose=verbose))
    ErtConnector.setErt(ert.ert())

    window = GertMainWindow()
    window.setWidget(SimulationPanel())

    plugin_handler = PluginHandler(ert.ert(), ert.ert().getWorkflowList().getPluginJobs(), window)

    help_tool = HelpTool("ERT", window)

    window.addDock("Configuration Summary", SummaryPanel(), area=Qt.BottomDockWidgetArea)
    window.addTool(IdeTool(os.path.basename(config_file), ert.reloadERT, help_tool))
    window.addTool(PlotTool(ert.ert()))
    window.addTool(ExportTool())
    window.addTool(WorkflowsTool())
    window.addTool(ManageCasesTool())
    window.addTool(PluginsTool(plugin_handler))
    window.addTool(LoadResultsTool())
    window.addTool(help_tool)

    sleep_time = 2 - (time.time() - now)

    if sleep_time > 0:
        time.sleep(sleep_time)

    window.show()
    splash.finish(window)
    window.activateWindow()
    window.raise_()
    finished_code = app.exec_()

    ert.ert().free()

    sys.exit(finished_code)
Exemplo n.º 16
0
 def test_root_version(self):
     cv = Version.currentVersion( )
     self.assertEqual( ert.__version__ , cv.versionString() )
Exemplo n.º 17
0
    def test_import(self):
        from ert import Version as globalVersion
        v1 = globalVersion(1, 1, 2)
        v2 = Version(1, 1, 2)

        self.assertTrue(v1 == v2)
Exemplo n.º 18
0
 def test_current(self):
     current = Version.currentVersion()
     self.assertTrue(current > (0, 0, 0))
Exemplo n.º 19
0
 def test_root_version(self):
     cv = Version.currentVersion()
     self.assertEqual(ert.__version__, cv.versionString())
Exemplo n.º 20
0
 def test_current(self):
     current = Version.currentVersion()
     self.assertTrue(current > (0, 0, 0))
     pfx = 'Version(major='
     self.assertEqual(pfx, repr(current)[:len(pfx)])
Exemplo n.º 21
0
 def test_current(self):
     current = Version.currentVersion()
     self.assertTrue(current > (0, 0, 0))
     pfx = 'Version(major='
     self.assertEqual(pfx, repr(current)[:len(pfx)])
Exemplo n.º 22
0
 def test_current(self):
     current = Version.currentVersion()
     self.assertTrue(current > (0, 0, 0))
Exemplo n.º 23
0
def main(argv):
    app = QApplication(argv) #Early so that QT is initialized before other imports
    app.setWindowIcon(util.resourceIcon("application/window_icon_cutout"))

    splash = ErtSplash()
    splash.version = "Version %s" % Version.getVersion()
    splash.timestamp = Version.getBuildTime()

    splash.show()
    splash.repaint()
    
    now = time.time()

    help_center = HelpCenter("ERT")
    help_center.setHelpLinkPrefix(os.getenv("ERT_SHARE_PATH") + "/gui/help/")
    help_center.setHelpMessageLink("welcome_to_ert")

    strict = True
    site_config = os.getenv("ERT_SITE_CONFIG")
    if len(argv) == 1:
        print("-----------------------------------------------------------------")
        print("-- You must supply the name of configuration file as the first --")
        print("-- commandline argument:                                       --")
        print("--                                                             --")
        print("-- bash%  gert <config_file>                                   --")
        print("--                                                             --")
        print("-- If the configuration file does not exist, gert will create  --")
        print("-- create a new configuration file.                            --")
        print("-----------------------------------------------------------------")
    else:
        enkf_config = argv[1]
        if not os.path.exists(enkf_config):
            print("Trying to start new config")
            new_configuration_dialog = NewConfigurationDialog(enkf_config)
            success = new_configuration_dialog.exec_()
            if not success:
                print("Can not run without a configuration file.")
                sys.exit(1)
            else:
                enkf_config = new_configuration_dialog.getConfigurationPath()
                first_case_name = new_configuration_dialog.getCaseName()
                dbase_type = new_configuration_dialog.getDBaseType()
                num_realizations = new_configuration_dialog.getNumberOfRealizations()
                storage_path = new_configuration_dialog.getStoragePath()

                EnKFMain.createNewConfig(enkf_config, storage_path, first_case_name, dbase_type, num_realizations)
                strict = False

        ert = Ert(EnKFMain(enkf_config, site_config=site_config, strict=strict))
        ErtConnector.setErt(ert.ert())

        window = GertMainWindow()
        window.setWidget(SimulationPanel())

        help_tool = HelpTool("ERT", window)

        window.addDock("Configuration Summary", SummaryPanel(), area=Qt.BottomDockWidgetArea)
        window.addTool(IdeTool(os.path.basename(enkf_config), ert.reloadERT, help_tool))
        window.addTool(PlotTool())
        window.addTool(ExportTool())
        window.addTool(WorkflowsTool(ert.reloadERT))
        window.addTool(ManageCasesTool())
        window.addTool(LoadResultsTool())
        window.addTool(help_tool)

        sleep_time = 2 - (time.time() - now)

        if sleep_time > 0:
            time.sleep(sleep_time)

        window.show()
        splash.finish(window)
        window.activateWindow()
        window.raise_()
        finished_code = app.exec_()

        ert.ert().free()

        sys.exit(finished_code)