def start_tvb(arguments, browser=True): """ Fire CherryPy server and listen on a free port """ if PARAM_RESET_DB in arguments: # When specified, clean everything in DB reset() arguments.remove(PARAM_RESET_DB) if not os.path.exists(TvbProfile.current.TVB_STORAGE): try: os.makedirs(TvbProfile.current.TVB_STORAGE) except Exception: sys.exit( "You do not have enough rights to use TVB storage folder:" + str(TvbProfile.current.TVB_STORAGE)) try: initialize(arguments) except InvalidSettingsException as excep: LOGGER.exception(excep) sys.exit() # Mark that the interface is Web ABCDisplayer.VISUALIZERS_ROOT = TvbProfile.current.web.VISUALIZERS_ROOT init_cherrypy(arguments) if StorageInterface.encryption_enabled( ) and StorageInterface.app_encryption_handler(): storage_interface = StorageInterface() storage_interface.start() storage_interface.startup_cleanup() # Fire a browser page at the end. if browser: run_browser() expose_rest_api() # Launch CherryPy loop forever. LOGGER.info("Finished starting TVB version %s in %.3f s", TvbProfile.current.version.CURRENT_VERSION, time.time() - STARTUP_TIC) cherrypy.engine.block() cherrypy.log.error_log
if not has_finished(operation.status): burst_finished = False break if burst_finished and parent_burst is not None and parent_burst.status != BurstConfiguration.BURST_ERROR: burst_service.mark_burst_finished(parent_burst) else: parent_burst = burst_service.get_burst_for_operation_id( operation_id) if parent_burst is not None: burst_service.mark_burst_finished(parent_burst) log.debug("Successfully finished operation " + str(operation_id)) except Exception as excep: log.error("Could not execute operation " + str(operation_id)) log.exception(excep) parent_burst = burst_service.get_burst_for_operation_id(operation_id) if parent_burst is not None: burst_service.mark_burst_finished(parent_burst, error_message=str(excep)) if __name__ == '__main__': OPERATION_ID = sys.argv[1] storage_interface = StorageInterface() storage_interface.start() do_operation_launch(OPERATION_ID) storage_interface.mark_stop() storage_interface.join()