Beispiel #1
0
    def __init__(self, parent=None):
        ConfigPanel.__init__(self, parent)

        self.initialized = False

        layout = QtGui.QFormLayout()
        layout.setLabelAlignment(QtCore.Qt.AlignRight)

        def jid(ert):
            """Returns the pointer to the current job (self.job)"""
            jl = ert.enkf.site_config_get_installed_jobs(ert.site_config)
            return ert.job_queue.ext_joblist_get_job(jl, self.job.name)

        self.stdin = PathChooser(self,
                                 "",
                                 "config/systemenv/install_job_stdin",
                                 show_files=True,
                                 must_be_set=False,
                                 must_exist=True)
        self.stdin.setter = lambda ert, value: ert.job_queue.ext_job_set_stdin_file(
            jid(ert), value)
        self.stdin.getter = lambda ert: ert.job_queue.ext_job_get_stdin_file(
            jid(ert))

        self.stdout = PathChooser(self,
                                  "",
                                  "config/systemenv/install_job_stdout",
                                  show_files=True,
                                  must_be_set=True,
                                  must_exist=False)
        self.stdout.setter = lambda ert, value: ert.job_queue.ext_job_set_stdout_file(
            jid(ert), value)
        self.stdout.getter = lambda ert: ert.job_queue.ext_job_get_stdout_file(
            jid(ert))

        self.stderr = PathChooser(self,
                                  "",
                                  "config/systemenv/install_job_stderr",
                                  show_files=True,
                                  must_be_set=True,
                                  must_exist=False)
        self.stderr.setter = lambda ert, value: ert.job_queue.ext_job_set_stderr_file(
            jid(ert), value)
        self.stderr.getter = lambda ert: ert.job_queue.ext_job_get_stderr_file(
            jid(ert))

        self.target_file = PathChooser(
            self,
            "",
            "config/systemenv/install_job_target_file",
            show_files=True,
            must_be_set=False,
            must_exist=False)
        self.target_file.setter = lambda ert, value: ert.job_queue.ext_job_set_target_file(
            jid(ert), value)
        self.target_file.getter = lambda ert: ert.job_queue.ext_job_get_target_file(
            jid(ert))

        self.executable = PathChooser(
            self,
            "",
            "config/systemenv/install_job_executable",
            show_files=True,
            must_be_set=True,
            must_exist=True,
            is_executable_file=True)
        self.executable.setter = lambda ert, value: ert.job_queue.ext_job_set_executable(
            jid(ert), value)
        self.executable.getter = lambda ert: ert.job_queue.ext_job_get_executable(
            jid(ert))

        def setEnv(ert, value):
            job = jid(ert)
            ert.job_queue.ext_job_clear_environment(job)

            for env in value:
                ert.job_queue.ext_job_add_environment(job, env[0], env[1])

        self.env = KeywordTable(self,
                                "",
                                "config/systemenv/install_job_env",
                                colHead1="Variable",
                                colHead2="Value")
        self.env.setter = setEnv
        self.env.getter = lambda ert: ert.getHash(
            ert.job_queue.ext_job_get_environment(jid(ert)))

        self.arglist = StringBox(self, "",
                                 "config/systemenv/install_job_arglist")
        self.arglist.setter = lambda ert, value: ert.job_queue.ext_job_set_private_args_from_string(
            jid(ert), value)
        self.arglist.getter = lambda ert: ert.job_queue.ext_job_get_private_args_as_string(
            jid(ert))

        self.max_running = IntegerSpinner(
            self, "", "config/systemenv/install_job_max_running", 0, 10000)
        self.max_running.setter = lambda ert, value: ert.job_queue.ext_job_set_max_running(
            jid(ert), value)
        self.max_running.getter = lambda ert: ert.job_queue.ext_job_get_max_running(
            jid(ert))

        self.max_running_minutes = IntegerSpinner(
            self, "", "config/systemenv/install_job_max_running_minutes", 0,
            10000)
        self.max_running_minutes.setter = lambda ert, value: ert.job_queue.ext_job_set_max_running_minutes(
            jid(ert), value)
        self.max_running_minutes.getter = lambda ert: ert.job_queue.ext_job_get_max_running_minutes(
            jid(ert))

        self.startPage("Standard")
        self.add("Executable.:", self.executable)
        self.add("Stdout:", self.stdout)
        self.add("Stderr:", self.stderr)
        self.add("Target file:", self.target_file)
        self.add("Arglist.:", self.arglist)
        self.endPage()

        self.startPage("Advanced")
        self.add("Stdin:", self.stdin)
        self.add("Max running:", self.max_running)
        self.max_running.setInfo("(0=unlimited)")
        self.add("Max running minutes:", self.max_running_minutes)
        self.max_running_minutes.setInfo("(0=unlimited)")
        self.add("Env.:", self.env)
        self.endPage()
Beispiel #2
0
class JobConfigPanel(ConfigPanel):
    def __init__(self, parent=None):
        ConfigPanel.__init__(self, parent)

        self.initialized = False

        layout = QtGui.QFormLayout()
        layout.setLabelAlignment(QtCore.Qt.AlignRight)

        def jid(ert):
            """Returns the pointer to the current job (self.job)"""
            jl = ert.enkf.site_config_get_installed_jobs(ert.site_config)
            return ert.job_queue.ext_joblist_get_job(jl, self.job.name)

        self.stdin = PathChooser(self,
                                 "",
                                 "config/systemenv/install_job_stdin",
                                 show_files=True,
                                 must_be_set=False,
                                 must_exist=True)
        self.stdin.setter = lambda ert, value: ert.job_queue.ext_job_set_stdin_file(
            jid(ert), value)
        self.stdin.getter = lambda ert: ert.job_queue.ext_job_get_stdin_file(
            jid(ert))

        self.stdout = PathChooser(self,
                                  "",
                                  "config/systemenv/install_job_stdout",
                                  show_files=True,
                                  must_be_set=True,
                                  must_exist=False)
        self.stdout.setter = lambda ert, value: ert.job_queue.ext_job_set_stdout_file(
            jid(ert), value)
        self.stdout.getter = lambda ert: ert.job_queue.ext_job_get_stdout_file(
            jid(ert))

        self.stderr = PathChooser(self,
                                  "",
                                  "config/systemenv/install_job_stderr",
                                  show_files=True,
                                  must_be_set=True,
                                  must_exist=False)
        self.stderr.setter = lambda ert, value: ert.job_queue.ext_job_set_stderr_file(
            jid(ert), value)
        self.stderr.getter = lambda ert: ert.job_queue.ext_job_get_stderr_file(
            jid(ert))

        self.target_file = PathChooser(
            self,
            "",
            "config/systemenv/install_job_target_file",
            show_files=True,
            must_be_set=False,
            must_exist=False)
        self.target_file.setter = lambda ert, value: ert.job_queue.ext_job_set_target_file(
            jid(ert), value)
        self.target_file.getter = lambda ert: ert.job_queue.ext_job_get_target_file(
            jid(ert))

        self.executable = PathChooser(
            self,
            "",
            "config/systemenv/install_job_executable",
            show_files=True,
            must_be_set=True,
            must_exist=True,
            is_executable_file=True)
        self.executable.setter = lambda ert, value: ert.job_queue.ext_job_set_executable(
            jid(ert), value)
        self.executable.getter = lambda ert: ert.job_queue.ext_job_get_executable(
            jid(ert))

        def setEnv(ert, value):
            job = jid(ert)
            ert.job_queue.ext_job_clear_environment(job)

            for env in value:
                ert.job_queue.ext_job_add_environment(job, env[0], env[1])

        self.env = KeywordTable(self,
                                "",
                                "config/systemenv/install_job_env",
                                colHead1="Variable",
                                colHead2="Value")
        self.env.setter = setEnv
        self.env.getter = lambda ert: ert.getHash(
            ert.job_queue.ext_job_get_environment(jid(ert)))

        self.arglist = StringBox(self, "",
                                 "config/systemenv/install_job_arglist")
        self.arglist.setter = lambda ert, value: ert.job_queue.ext_job_set_private_args_from_string(
            jid(ert), value)
        self.arglist.getter = lambda ert: ert.job_queue.ext_job_get_private_args_as_string(
            jid(ert))

        self.max_running = IntegerSpinner(
            self, "", "config/systemenv/install_job_max_running", 0, 10000)
        self.max_running.setter = lambda ert, value: ert.job_queue.ext_job_set_max_running(
            jid(ert), value)
        self.max_running.getter = lambda ert: ert.job_queue.ext_job_get_max_running(
            jid(ert))

        self.max_running_minutes = IntegerSpinner(
            self, "", "config/systemenv/install_job_max_running_minutes", 0,
            10000)
        self.max_running_minutes.setter = lambda ert, value: ert.job_queue.ext_job_set_max_running_minutes(
            jid(ert), value)
        self.max_running_minutes.getter = lambda ert: ert.job_queue.ext_job_get_max_running_minutes(
            jid(ert))

        self.startPage("Standard")
        self.add("Executable.:", self.executable)
        self.add("Stdout:", self.stdout)
        self.add("Stderr:", self.stderr)
        self.add("Target file:", self.target_file)
        self.add("Arglist.:", self.arglist)
        self.endPage()

        self.startPage("Advanced")
        self.add("Stdin:", self.stdin)
        self.add("Max running:", self.max_running)
        self.max_running.setInfo("(0=unlimited)")
        self.add("Max running minutes:", self.max_running_minutes)
        self.max_running_minutes.setInfo("(0=unlimited)")
        self.add("Env.:", self.env)
        self.endPage()

    def add(self, label, widget):
        self.addRow(widget, label)

    def setJob(self, job):
        self.job = job

        self.initialize(self.stdin.getModel())

        self.cmproxy = ContentModelProxy(
        )  #Since only the last change matters and no insert and remove is done
        self.cmproxy.proxify(self.stdin, self.stdout, self.stderr,
                             self.target_file, self.executable, self.env,
                             self.arglist, self.max_running,
                             self.max_running_minutes)

        self.stdin.fetchContent()
        self.stdout.fetchContent()
        self.stderr.fetchContent()
        self.target_file.fetchContent()
        self.executable.fetchContent()
        self.env.fetchContent()
        self.arglist.fetchContent()
        self.max_running.fetchContent()
        self.max_running_minutes.fetchContent()

    def saveJob(self):
        if self.executable.isValid() and self.stderr.isValid(
        ) and self.stdout.isValid():
            self.cmproxy.apply()

            ert = self.stdin.getModel()
            jl = ert.enkf.site_config_get_installed_jobs(ert.site_config)
            jid = ert.job_queue.ext_joblist_get_job(jl, self.job.name)
            ert.job_queue.ext_job_save(jid)
            return None
        else:
            return "These fields are required: executable, stdout and stderr!"
Beispiel #3
0
def createQueueSystemPage(configPanel, parent):
    configPanel.startPage("Queue System")

    r = configPanel.addRow(
        ComboChoice(parent, ["LSF", "RSH", "LOCAL"], "Queue system",
                    "config/queue_system/queue_system"))
    r.getter = lambda ert: ert.enkf.site_config_get_queue_name(ert.site_config)
    r.setter = lambda ert, value: ert.enkf.site_config_set_job_queue(
        ert.site_config, str(value))

    internalPanel = ConfigPanel(parent)

    internalPanel.startPage("LSF")

    r = internalPanel.addRow(
        StringBox(parent, "LSF Queue", "config/queue_system/lsf_queue"))
    r.getter = lambda ert: ert.enkf.site_config_get_lsf_queue(ert.site_config)
    r.setter = lambda ert, value: ert.enkf.site_config_set_lsf_queue(
        ert.site_config, str(value))

    r = internalPanel.addRow(
        IntegerSpinner(parent, "Max running",
                       "config/queue_system/max_running_lsf", 1, 1000))
    r.getter = lambda ert: ert.enkf.site_config_get_max_running_lsf(
        ert.site_config)
    r.setter = lambda ert, value: ert.enkf.site_config_set_max_running_lsf(
        ert.site_config, value)

    r = internalPanel.addRow(
        StringBox(parent, "Resources", "config/queue_system/lsf_resources"))
    r.getter = lambda ert: ert.enkf.site_config_get_lsf_request(ert.site_config
                                                                )
    r.setter = lambda ert, value: ert.enkf.site_config_set_lsf_request(
        ert.site_config, str(value))

    internalPanel.endPage()

    internalPanel.startPage("RSH")

    r = internalPanel.addRow(
        PathChooser(parent,
                    "Command",
                    "config/queue_system/rsh_command",
                    show_files=True,
                    must_exist=True,
                    is_executable_file=True))
    r.getter = lambda ert: ert.enkf.site_config_get_rsh_command(ert.site_config
                                                                )
    r.setter = lambda ert, value: ert.enkf.site_config_set_rsh_command(
        ert.site_config, str(value))

    r = internalPanel.addRow(
        IntegerSpinner(parent, "Max running",
                       "config/queue_system/max_running_rsh", 1, 1000))
    r.getter = lambda ert: ert.enkf.site_config_get_max_running_rsh(
        ert.site_config)
    r.setter = lambda ert, value: ert.enkf.site_config_set_max_running_rsh(
        ert.site_config, value)

    r = internalPanel.addRow(
        KeywordTable(parent, "Host List", "config/queue_system/rsh_host_list",
                     "Host", "Number of jobs"))
    r.getter = lambda ert: ert.getHash(
        ert.enkf.site_config_get_rsh_host_list(ert.site_config), True)

    def add_rsh_host(ert, listOfKeywords):
        ert.enkf.site_config_clear_rsh_host_list(ert.site_config)

        for keyword in listOfKeywords:
            if keyword[1].strip() == "":
                max_running = 1
            else:
                max_running = int(keyword[1])

            ert.enkf.site_config_add_rsh_host(ert.site_config, keyword[0],
                                              max_running)

    r.setter = add_rsh_host

    internalPanel.endPage()

    internalPanel.startPage("LOCAL")

    r = internalPanel.addRow(
        IntegerSpinner(parent, "Max running",
                       "config/queue_system/max_running_local", 1, 1000))
    r.getter = lambda ert: ert.enkf.site_config_get_max_running_local(
        ert.site_config)
    r.setter = lambda ert, value: ert.enkf.site_config_set_max_running_local(
        ert.site_config, value)

    internalPanel.endPage()
    configPanel.addRow(internalPanel)

    configPanel.endPage()
Beispiel #4
0
    def __init__(self, parent=None):
        ConfigPanel.__init__(self, parent)

        self.initialized = False

        layout = QtGui.QFormLayout()
        layout.setLabelAlignment(QtCore.Qt.AlignRight)

        def jid(ert):
            """Returns the pointer to the current job (self.job)"""
            jl = ert.enkf.site_config_get_installed_jobs(ert.site_config)
            return ert.job_queue.ext_joblist_get_job(jl, self.job.name)

        self.stdin = PathChooser(
            self, "", "config/systemenv/install_job_stdin", show_files=True, must_be_set=False, must_exist=True
        )
        self.stdin.setter = lambda ert, value: ert.job_queue.ext_job_set_stdin_file(jid(ert), value)
        self.stdin.getter = lambda ert: ert.job_queue.ext_job_get_stdin_file(jid(ert))

        self.stdout = PathChooser(
            self, "", "config/systemenv/install_job_stdout", show_files=True, must_be_set=True, must_exist=False
        )
        self.stdout.setter = lambda ert, value: ert.job_queue.ext_job_set_stdout_file(jid(ert), value)
        self.stdout.getter = lambda ert: ert.job_queue.ext_job_get_stdout_file(jid(ert))

        self.stderr = PathChooser(
            self, "", "config/systemenv/install_job_stderr", show_files=True, must_be_set=True, must_exist=False
        )
        self.stderr.setter = lambda ert, value: ert.job_queue.ext_job_set_stderr_file(jid(ert), value)
        self.stderr.getter = lambda ert: ert.job_queue.ext_job_get_stderr_file(jid(ert))

        self.target_file = PathChooser(
            self, "", "config/systemenv/install_job_target_file", show_files=True, must_be_set=False, must_exist=False
        )
        self.target_file.setter = lambda ert, value: ert.job_queue.ext_job_set_target_file(jid(ert), value)
        self.target_file.getter = lambda ert: ert.job_queue.ext_job_get_target_file(jid(ert))

        self.executable = PathChooser(
            self,
            "",
            "config/systemenv/install_job_executable",
            show_files=True,
            must_be_set=True,
            must_exist=True,
            is_executable_file=True,
        )
        self.executable.setter = lambda ert, value: ert.job_queue.ext_job_set_executable(jid(ert), value)
        self.executable.getter = lambda ert: ert.job_queue.ext_job_get_executable(jid(ert))

        def setEnv(ert, value):
            job = jid(ert)
            ert.job_queue.ext_job_clear_environment(job)

            for env in value:
                ert.job_queue.ext_job_add_environment(job, env[0], env[1])

        self.env = KeywordTable(self, "", "config/systemenv/install_job_env", colHead1="Variable", colHead2="Value")
        self.env.setter = setEnv
        self.env.getter = lambda ert: ert.getHash(ert.job_queue.ext_job_get_environment(jid(ert)))

        self.arglist = StringBox(self, "", "config/systemenv/install_job_arglist")
        self.arglist.setter = lambda ert, value: ert.job_queue.ext_job_set_private_args_from_string(jid(ert), value)
        self.arglist.getter = lambda ert: ert.job_queue.ext_job_get_private_args_as_string(jid(ert))

        self.max_running = IntegerSpinner(self, "", "config/systemenv/install_job_max_running", 0, 10000)
        self.max_running.setter = lambda ert, value: ert.job_queue.ext_job_set_max_running(jid(ert), value)
        self.max_running.getter = lambda ert: ert.job_queue.ext_job_get_max_running(jid(ert))

        self.max_running_minutes = IntegerSpinner(
            self, "", "config/systemenv/install_job_max_running_minutes", 0, 10000
        )
        self.max_running_minutes.setter = lambda ert, value: ert.job_queue.ext_job_set_max_running_minutes(
            jid(ert), value
        )
        self.max_running_minutes.getter = lambda ert: ert.job_queue.ext_job_get_max_running_minutes(jid(ert))

        self.startPage("Standard")
        self.add("Executable.:", self.executable)
        self.add("Stdout:", self.stdout)
        self.add("Stderr:", self.stderr)
        self.add("Target file:", self.target_file)
        self.add("Arglist.:", self.arglist)
        self.endPage()

        self.startPage("Advanced")
        self.add("Stdin:", self.stdin)
        self.add("Max running:", self.max_running)
        self.max_running.setInfo("(0=unlimited)")
        self.add("Max running minutes:", self.max_running_minutes)
        self.max_running_minutes.setInfo("(0=unlimited)")
        self.add("Env.:", self.env)
        self.endPage()
Beispiel #5
0
class JobConfigPanel(ConfigPanel):
    def __init__(self, parent=None):
        ConfigPanel.__init__(self, parent)

        self.initialized = False

        layout = QtGui.QFormLayout()
        layout.setLabelAlignment(QtCore.Qt.AlignRight)

        def jid(ert):
            """Returns the pointer to the current job (self.job)"""
            jl = ert.enkf.site_config_get_installed_jobs(ert.site_config)
            return ert.job_queue.ext_joblist_get_job(jl, self.job.name)

        self.stdin = PathChooser(
            self, "", "config/systemenv/install_job_stdin", show_files=True, must_be_set=False, must_exist=True
        )
        self.stdin.setter = lambda ert, value: ert.job_queue.ext_job_set_stdin_file(jid(ert), value)
        self.stdin.getter = lambda ert: ert.job_queue.ext_job_get_stdin_file(jid(ert))

        self.stdout = PathChooser(
            self, "", "config/systemenv/install_job_stdout", show_files=True, must_be_set=True, must_exist=False
        )
        self.stdout.setter = lambda ert, value: ert.job_queue.ext_job_set_stdout_file(jid(ert), value)
        self.stdout.getter = lambda ert: ert.job_queue.ext_job_get_stdout_file(jid(ert))

        self.stderr = PathChooser(
            self, "", "config/systemenv/install_job_stderr", show_files=True, must_be_set=True, must_exist=False
        )
        self.stderr.setter = lambda ert, value: ert.job_queue.ext_job_set_stderr_file(jid(ert), value)
        self.stderr.getter = lambda ert: ert.job_queue.ext_job_get_stderr_file(jid(ert))

        self.target_file = PathChooser(
            self, "", "config/systemenv/install_job_target_file", show_files=True, must_be_set=False, must_exist=False
        )
        self.target_file.setter = lambda ert, value: ert.job_queue.ext_job_set_target_file(jid(ert), value)
        self.target_file.getter = lambda ert: ert.job_queue.ext_job_get_target_file(jid(ert))

        self.executable = PathChooser(
            self,
            "",
            "config/systemenv/install_job_executable",
            show_files=True,
            must_be_set=True,
            must_exist=True,
            is_executable_file=True,
        )
        self.executable.setter = lambda ert, value: ert.job_queue.ext_job_set_executable(jid(ert), value)
        self.executable.getter = lambda ert: ert.job_queue.ext_job_get_executable(jid(ert))

        def setEnv(ert, value):
            job = jid(ert)
            ert.job_queue.ext_job_clear_environment(job)

            for env in value:
                ert.job_queue.ext_job_add_environment(job, env[0], env[1])

        self.env = KeywordTable(self, "", "config/systemenv/install_job_env", colHead1="Variable", colHead2="Value")
        self.env.setter = setEnv
        self.env.getter = lambda ert: ert.getHash(ert.job_queue.ext_job_get_environment(jid(ert)))

        self.arglist = StringBox(self, "", "config/systemenv/install_job_arglist")
        self.arglist.setter = lambda ert, value: ert.job_queue.ext_job_set_private_args_from_string(jid(ert), value)
        self.arglist.getter = lambda ert: ert.job_queue.ext_job_get_private_args_as_string(jid(ert))

        self.max_running = IntegerSpinner(self, "", "config/systemenv/install_job_max_running", 0, 10000)
        self.max_running.setter = lambda ert, value: ert.job_queue.ext_job_set_max_running(jid(ert), value)
        self.max_running.getter = lambda ert: ert.job_queue.ext_job_get_max_running(jid(ert))

        self.max_running_minutes = IntegerSpinner(
            self, "", "config/systemenv/install_job_max_running_minutes", 0, 10000
        )
        self.max_running_minutes.setter = lambda ert, value: ert.job_queue.ext_job_set_max_running_minutes(
            jid(ert), value
        )
        self.max_running_minutes.getter = lambda ert: ert.job_queue.ext_job_get_max_running_minutes(jid(ert))

        self.startPage("Standard")
        self.add("Executable.:", self.executable)
        self.add("Stdout:", self.stdout)
        self.add("Stderr:", self.stderr)
        self.add("Target file:", self.target_file)
        self.add("Arglist.:", self.arglist)
        self.endPage()

        self.startPage("Advanced")
        self.add("Stdin:", self.stdin)
        self.add("Max running:", self.max_running)
        self.max_running.setInfo("(0=unlimited)")
        self.add("Max running minutes:", self.max_running_minutes)
        self.max_running_minutes.setInfo("(0=unlimited)")
        self.add("Env.:", self.env)
        self.endPage()

    def add(self, label, widget):
        self.addRow(widget, label)

    def initialize(self, ert):
        if not self.initialized:
            ert.prototype("long site_config_get_installed_jobs(long)")
            ert.prototype("char* ext_job_get_stdin_file(long)", lib=ert.job_queue)
            ert.prototype("void ext_job_set_stdin_file(long, char*)", lib=ert.job_queue)
            ert.prototype("char* ext_job_get_stdout_file(long)", lib=ert.job_queue)
            ert.prototype("void ext_job_set_stdout_file(long, char*)", lib=ert.job_queue)
            ert.prototype("char* ext_job_get_stderr_file(long)", lib=ert.job_queue)
            ert.prototype("void ext_job_set_stderr_file(long, char*)", lib=ert.job_queue)
            ert.prototype("char* ext_job_get_target_file(long)", lib=ert.job_queue)
            ert.prototype("void ext_job_set_target_file(long, char*)", lib=ert.job_queue)
            ert.prototype("char* ext_job_get_executable(long)", lib=ert.job_queue)
            ert.prototype("void ext_job_set_executable(long, char*)", lib=ert.job_queue)
            ert.prototype("char* ext_job_get_private_args_as_string(long)", lib=ert.job_queue)
            ert.prototype("void ext_job_set_private_args_from_string(long, char*)", lib=ert.job_queue)
            ert.prototype("int ext_job_get_max_running(long)", lib=ert.job_queue)
            ert.prototype("void ext_job_set_max_running(long, int)", lib=ert.job_queue)
            ert.prototype("int ext_job_get_max_running_minutes(long)", lib=ert.job_queue)
            ert.prototype("void ext_job_set_max_running_minutes(long, int)", lib=ert.job_queue)
            ert.prototype("long ext_job_get_environment(long)", lib=ert.job_queue)
            ert.prototype("void ext_job_add_environment(long, char*, char*)", lib=ert.job_queue)
            ert.prototype("void ext_job_clear_environment(long)", lib=ert.job_queue)
            ert.prototype("void ext_job_save(long)", lib=ert.job_queue)
            ert.prototype("long ext_joblist_get_job(long, char*)", lib=ert.job_queue)

            self.initialized = True

    def setJob(self, job):
        self.job = job

        self.initialize(self.stdin.getModel())

        self.cmproxy = ContentModelProxy()  # Since only the last change matters and no insert and remove is done
        self.cmproxy.proxify(
            self.stdin,
            self.stdout,
            self.stderr,
            self.target_file,
            self.executable,
            self.env,
            self.arglist,
            self.max_running,
            self.max_running_minutes,
        )

        self.stdin.fetchContent()
        self.stdout.fetchContent()
        self.stderr.fetchContent()
        self.target_file.fetchContent()
        self.executable.fetchContent()
        self.env.fetchContent()
        self.arglist.fetchContent()
        self.max_running.fetchContent()
        self.max_running_minutes.fetchContent()

    def saveJob(self):
        if self.executable.isValid() and self.stderr.isValid() and self.stdout.isValid():
            self.cmproxy.apply()

            ert = self.stdin.getModel()
            jl = ert.enkf.site_config_get_installed_jobs(ert.site_config)
            jid = ert.job_queue.ext_joblist_get_job(jl, self.job.name)
            ert.job_queue.ext_job_save(jid)
            return None
        else:
            return "These fields are required: executable, stdout and stderr!"
Beispiel #6
0
def createEclipsePage(configPanel, parent):
    configPanel.startPage("Eclipse")

    r = configPanel.addRow(PathChooser(parent, "Eclipse Base", "config/eclipse/eclbase", path_format=True))
    r.getter = lambda ert : ert.enkf.ecl_config_get_eclbase(ert.ecl_config)
    r.setter = lambda ert, value : ert.enkf.enkf_main_set_eclbase(ert.main , str(value))

    r = configPanel.addRow(PathChooser(parent, "Data file", "config/eclipse/data_file", show_files=True))
    r.getter = lambda ert : ert.enkf.ecl_config_get_data_file(ert.ecl_config)
    r.setter = lambda ert, value : ert.enkf.enkf_main_set_data_file(ert.main , str(value))

    r = configPanel.addRow(PathChooser(parent, "Grid", "config/eclipse/grid", show_files=True))
    r.getter = lambda ert : ert.enkf.ecl_config_get_gridfile(ert.ecl_config)
    r.setter = lambda ert, value : ert.enkf.ecl_config_set_grid(ert.ecl_config, str(value))

    r = configPanel.addRow(PathChooser(parent, "Schedule file" , "config/eclipse/schedule_file" , show_files = True))
    r.getter = lambda ert : ert.enkf.ecl_config_get_schedule_file(ert.ecl_config)
    r.setter = lambda ert, value : ert.enkf.ecl_config_set_schedule_file(ert.ecl_config, str(value))


    r = configPanel.addRow(PathChooser(parent, "Init section", "config/eclipse/init_section", show_files=True))
    r.getter = lambda ert : ert.enkf.ecl_config_get_init_section(ert.ecl_config)
    r.setter = lambda ert, value : ert.enkf.ecl_config_set_init_section(ert.ecl_config, str(value))


    r = configPanel.addRow(PathChooser(parent, "Refcase", "config/eclipse/refcase", show_files=True))
    r.getter = lambda ert : ert.enkf.ecl_config_get_refcase_name(ert.ecl_config)
    r.setter = lambda ert, value : ert.enkf.ecl_config_load_refcase(ert.ecl_config, str(value))

    r = configPanel.addRow(PathChooser(parent, "Schedule prediction file", "config/eclipse/schedule_prediction_file", show_files=True))
    r.getter = lambda ert : ert.enkf.enkf_main_get_schedule_prediction_file(ert.main)
    r.setter = lambda ert, value : ert.enkf.enkf_main_set_schedule_prediction_file(ert.main, ert.nonify( value ))

    r = configPanel.addRow(KeywordTable(parent, "Data keywords", "config/eclipse/data_kw"))
    r.getter = lambda ert : ert.getSubstitutionList(ert.enkf.enkf_main_get_data_kw(ert.main))

    def add_data_kw(ert, listOfKeywords):
        ert.enkf.enkf_main_clear_data_kw(ert.main)

        for keyword in listOfKeywords:
            ert.enkf.enkf_main_add_data_kw(ert.main, keyword[0], keyword[1])

    r.setter = add_data_kw



    configPanel.addSeparator()

    internalPanel = ConfigPanel(parent)

    internalPanel.startPage("Static keywords")

    r = internalPanel.addRow(KeywordList(parent, "", "config/eclipse/add_static_kw"))
    r.getter = lambda ert : ert.getStringList(ert.enkf.ecl_config_get_static_kw_list(ert.ecl_config))

    def add_static_kw(ert, listOfKeywords):
        ert.enkf.ecl_config_clear_static_kw(ert.ecl_config)

        for keyword in listOfKeywords:
            ert.enkf.ecl_config_add_static_kw(ert.ecl_config, keyword)

    r.setter = add_static_kw

    internalPanel.endPage()

    # todo: add support for fixed length schedule keywords
    #internalPanel.startPage("Fixed length schedule keywords")
    #
    #r = internalPanel.addRow(KeywordList(widget, "", "add_fixed_length_schedule_kw"))
    #r.getter = lambda ert : ert.getAttribute("add_fixed_length_schedule_kw")
    #r.setter = lambda ert, value : ert.setAttribute("add_fixed_length_schedule_kw", value)
    #
    #internalPanel.endPage()

    configPanel.addRow(internalPanel)

    configPanel.endPage()