def start(configFileName): if not g.prepare(configFileName): return # read COPASI model file etc. strategyManager = strategy.StrategyManager() if not strategyManager.prepare(isDummy=False): return # start the web server if bool(g.getConfig("web.enable")): process.createBackgroundThread(executeWebserver, strategyManager) # start the selected parameter sweep strategy strategyManager.execute()
def startFromWeb(configFileName): if not g.prepare(configFileName): g.log(LOG_ERROR, "Preparing from config file failed: " + configFileName) return None # read COPASI model file etc. strategyManager = strategy.StrategyManager() if not strategyManager.prepare(isDummy=False): g.log(LOG_ERROR, "Preparing for execution failed") return None # start the selected parameter sweep strategy asynchronously process.createBackgroundThread(lambda s: s.execute(), strategyManager) return strategyManager
def main(): if len(sys.argv) > 1 and sys.argv[1] == "web": # web-only mode; load the last saved web config, if present g.loadConfig(os.path.join(SELF_PATH, "tmpweb", "config.json"), isQuiet=True) # create an empty strategy and wait for input commands strategyManager = strategy.StrategyManager() strategyManager.prepare(isDummy=True) # start the web server process.createBackgroundThread(executeWebserver, strategyManager) wait() else: # normal mode if not start(sys.argv[1] if len(sys.argv) > 1 else None): return -1 # if "hang" mode is configured, do not quit until Ctrl+C is pressed if bool(g.getConfig("hangMode")): wait() return 0