当前位置: 首页>>代码示例>>Python>>正文


Python ProgressDialog.getTargetResult方法代码示例

本文整理汇总了Python中cecog.gui.progressdialog.ProgressDialog.getTargetResult方法的典型用法代码示例。如果您正苦于以下问题:Python ProgressDialog.getTargetResult方法的具体用法?Python ProgressDialog.getTargetResult怎么用?Python ProgressDialog.getTargetResult使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在cecog.gui.progressdialog.ProgressDialog的用法示例。


在下文中一共展示了ProgressDialog.getTargetResult方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: ClusterDisplay

# 需要导入模块: from cecog.gui.progressdialog import ProgressDialog [as 别名]
# 或者: from cecog.gui.progressdialog.ProgressDialog import getTargetResult [as 别名]

#.........这里部分代码省略.........

    def _on_jobid_entered(self, txt):
        self._jobid = str(txt)

    @pyqtSlot()
    def _on_submit_job(self):
        self._submit_settings.set_section(SECTION_NAME_GENERAL)
        if not self._submit_settings.get2('constrain_positions'):
            positions = []

            for plate_id in self.imagecontainer.plates:
                self.imagecontainer.set_plate(plate_id)
                meta_data = self.imagecontainer.get_meta_data()
                positions += ['%s___%s' % (plate_id, p) for p in meta_data.positions]
            self._submit_settings.set2('positions', ','.join(positions))
            nr_items = len(positions)
        else:
            positions = self._submit_settings.get2('positions')
            nr_items = len(positions.split(','))

        # FIXME: we need to get the current value for 'position_granularity'
        settings_dummy = self._clusterframe.get_special_settings(self._settings)
        position_granularity = settings_dummy.get('Cluster', 'position_granularity')

        path_out = self._submit_settings.get2('pathout')
        emails = str(self._txt_mail.text()).split(',')
        try:
            self.dlg = ProgressDialog("submitting jobs...", None, 0, 0, self)
            settings_str = self._submit_settings.to_string()
            func = lambda: self._service.submit_job('cecog_batch', settings_str,
                                                    path_out, emails, nr_items,
                                                    position_granularity, VERSION)
            self.dlg.exec_(func)
            jobid = self.dlg.getTargetResult()
        except Exception as e:
            exception(self, 'Error on job submission (%s)' %str(e))
        else:
            # FIXME: no idea how DRMAA 1.0 compatible this is
            if type(jobid) == types.ListType:
                self._jobid = ','.join(jobid)
                main_jobid = jobid[0].split('.')[0]
            else:
                self._jobid = str(jobid)
                main_jobid = jobid
            self._txt_jobid.setText(self._jobid)
            self._update_job_status()
            information(self, 'Job submitted successfully',
                        "Job successfully submitted to the cluster.\nJob ID: %s, items: %d" % (main_jobid, nr_items))

    @pyqtSlot()
    def _on_terminate_job(self):
        try:
            self.dlg = ProgressDialog("terminating jobs...", None, 0, 0, self)
            func = lambda: self._service.control_job(self._jobid, JOB_CONTROL_TERMINATE)
            self.dlg.exec_(func)
        except Exception as e:
            exception(self, 'Error on job termination (%s)' %str(e))
        else:
            self._btn_toogle.setChecked(False)
            self._toggle_state = JOB_CONTROL_SUSPEND
            self._btn_toogle.setText(self._toggle_state)
            self._update_job_status()

    @pyqtSlot()
    def _on_toggle_job(self):
        try:
开发者ID:manerotoni,项目名称:cecog,代码行数:70,代码来源:cluster.py

示例2: ClusterDisplay

# 需要导入模块: from cecog.gui.progressdialog import ProgressDialog [as 别名]
# 或者: from cecog.gui.progressdialog.ProgressDialog import getTargetResult [as 别名]

#.........这里部分代码省略.........
    def _on_submit_job(self):

        self._submit_settings.set_section(SECTION_NAME_GENERAL)
        if not self._submit_settings.get2('constrain_positions'):
            positions = []

            for plate_id in self.imagecontainer.plates:
                self.imagecontainer.set_plate(plate_id)
                meta_data = self.imagecontainer.get_meta_data()
                positions += ['%s___%s' % (plate_id, p) for p in meta_data.positions]
            self._submit_settings.set2('positions', ','.join(positions))
            nr_items = len(positions)
        else:
            positions = self._submit_settings.get2('positions')
            nr_items = len(positions.split(','))

        settings_dummy = self._clusterframe.get_special_settings(self._settings)

        apc = AppPreferences()
        batch_size = apc.batch_size
        pathout = self._submit_settings.get2('pathout')

        if not self._submit_settings('General', 'skip_finished'):
            self.clear_output_directory(self._settings("General", "pathout"))

        try:
            self.dlg = ProgressDialog("Submitting Jobs...", None, 0, 0, self)
            settings_str = self._submit_settings.to_string()

            func = lambda: self._service.submit_job('cecog_batch', settings_str,
                                                    pathout, nr_items,
                                                    batch_size, version)
            self.dlg.exec_(func)
            jobid = self.dlg.getTargetResult()
        except Exception as e:
            QMessageBox.critical(
                self, "Error", 'Job submission failed (%s)' %str(e))
        else:
            # FIXME: no idea how DRMAA 1.0 compatible this is
            if type(jobid) == types.ListType:
                self._jobid = ','.join(jobid)
                main_jobid = jobid[0].split('.')[0]
            else:
                self._jobid = str(jobid)
                main_jobid = jobid
            self._txt_jobid.setText(self._jobid)
            self._update_job_status()
            QMessageBox.information(
                self, "Information", ("Job(s) successfully submitted\n"
                                      "Job ID: %s, #jobs: %d" % (main_jobid, nr_items)))

    @pyqtSlot()
    def _on_terminate_job(self):
        if self.jobIds is None:
            return

        try:
            self.dlg = ProgressDialog("Terminating Jobs...", None, 0, 0, self)
            func = lambda: self._service.control_job(self._jobid, JOB_CONTROL_TERMINATE)
            self.dlg.exec_(func)
        except Exception as e:
            QMessageBox.critical(
                self, "Error", "Job termination failed (%s)" %str(e))
        else:
            self._btn_toogle.setChecked(False)
            self._toggle_state = JOB_CONTROL_SUSPEND
开发者ID:CellCognition,项目名称:cecog,代码行数:70,代码来源:cluster.py


注:本文中的cecog.gui.progressdialog.ProgressDialog.getTargetResult方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。