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


Python RunManager.delete_everything_for_this_run方法代码示例

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


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

示例1: __init__

# 需要导入模块: from opus_core.services.run_server.run_manager import RunManager [as 别名]
# 或者: from opus_core.services.run_server.run_manager.RunManager import delete_everything_for_this_run [as 别名]
    def __init__(self):
        GenericOptionGroup.__init__(self, usage="python %prog [options] configuration",
            description="Delete results of a simulation run.")
        self.parser.add_option("--run-id", dest="run_id", default=None, 
                                action="store", 
                                help="The simulation run to delete.")
        self.parser.add_option("--years-to-delete", dest="years_to_delete", 
                                default=None, action="store", 
                                help="Python expression specifying list of years to delete from the simulation's cache.")

if __name__ == "__main__":
    try: import wingdbstub
    except: pass
    option_group = StartRunOptionGroup()
    parser = option_group.parser
    (options, args) = parser.parse_args()

    
    run_manager = RunManager(option_group.get_services_database_configuration(options))

    if options.run_id is None:
        parser.print_help()
    elif options.years_to_delete:
        years_to_delete = eval(options.years_to_delete)
        if not isinstance(years_to_delete, list):
            years_to_delete = [years_to_delete]
        run_manager.delete_year_dirs_in_cache(options.run_id, 
                                                 years_to_delete=years_to_delete)
    else:
        run_manager.delete_everything_for_this_run(options.run_id)
开发者ID:christianurich,项目名称:VIBe2UrbanSim,代码行数:32,代码来源:delete_run.py

示例2: on_pbnStartModel_released

# 需要导入模块: from opus_core.services.run_server.run_manager import RunManager [as 别名]
# 或者: from opus_core.services.run_server.run_manager.RunManager import delete_everything_for_this_run [as 别名]
    def on_pbnStartModel_released(self):
        duplicate = False
        self.diagnostic_go_button.setEnabled(True)

        if self.running and not self.paused:
            # Take care of pausing a run
            success = self.runThread.pause()
            if success:
                self.paused = True
                self.timer.stop()
                self.pbnStartModel.setText(QString("Resume simulation run..."))
        elif self.running and self.paused:
            # Need to resume a paused run
            success = self.runThread.resume()
            if success:
                self.paused = False
                self.timer.start(1000)
                self.pbnStartModel.setText(QString("Pause simulation run..."))
        elif not self.running:
            run_name = str(self.leRunName.text())
            if run_name == '':
                run_name = None
            else:
                run_id = None
                run_nodes = get_available_run_nodes(self.project)
                for run_node in run_nodes:
                    existing_run_name = run_node.tag
                    if run_name == existing_run_name:
                        duplicate = True
                        r = run_node.get('run_id')
                        if r is not None:
                            run_id = int(r)
                        break
                if duplicate:
                    dlg_dup = OverwriteRunDialog(self)

                    if dlg_dup.exec_() == QDialog.Rejected:
                        return
                    delete_simulation_run(self.project, run_node.tag) # todo change to run_node.get('name')
            # Update the XML
            self.project.update_xml_config()
            self.updateConfigAndGuiForRun()

            # Fire up a new thread and run the model
            self.pbnStartModel.setText(QString("Pause simulation run..."))
            # References to the GUI elements for status for this run...
            self.progressBarTotal = self.runProgressBarTotal
            self.progressBarYear = self.runProgressBarYear
            self.progressBarModel = self.runProgressBarModel

            #self.pbnRemoveModel.setEnabled(False)
            #self.pbnStartModel.setEnabled(False)

            # Initializing values
            self.progressBarTotal.setValue(0)
            self.progressBarYear.setValue(0)
            self.progressBarModel.setValue(0)
            self.progressBarTotal.setRange(0,0)
            self.progressBarYear.setRange(0,0)
            self.progressBarModel.setRange(0,0)

            batch_name = str(self.cboOptionalIndicatorBatch.currentText())
            if batch_name == '(None)':
                batch_name = None

            self.runThread = RunModelThread(get_mainwindow_instance(),
                                            self,
                                            batch_name,
                                            run_name)

            if duplicate and run_id is not None:
                from opus_core.services.run_server.run_manager import RunManager as ServicesRunManager
                run_manager = ServicesRunManager(ServicesDatabaseConfiguration())
                run_manager.delete_everything_for_this_run(run_id = run_id)
                run_manager.close()


            # Use this signal from the thread if it is capable of producing its own status signal
            QObject.connect(self.runThread, SIGNAL("runFinished(PyQt_PyObject)"),
                            self.runFinishedFromThread)
            QObject.connect(self.runThread, SIGNAL("runError(PyQt_PyObject)"),
                            self.runErrorFromThread)
            # Use this timer to call a function in the thread to check status if the thread is unable
            # to produce its own signal above
            self.timer = QTimer()
            QObject.connect(self.timer, SIGNAL("timeout()"),
                            self.runStatusFromThread)
            self.timer.start(1000)
            self.running = True
            self.paused = False
            self.runThread.start()
        else:
            print "Unexpected state in the model run..."
开发者ID:christianurich,项目名称:VIBe2UrbanSim,代码行数:95,代码来源:simulation_gui_element.py


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