COREZMQ_SERVER_FILE = os.path.join(os.getcwd(), 'node_modules', 'webgme-bindings', 'bin', 'corezmq_server.js') if not os.path.isfile(COREZMQ_SERVER_FILE): COREZMQ_SERVER_FILE = os.path.join(os.getcwd(), 'bin', 'corezmq_server.js') # Star the server (see bin/corezmq_server.js for more options e.g. for how to pass a pluginConfig) node_process = subprocess.Popen(['node', COREZMQ_SERVER_FILE, PROJECT_NAME, '-p', PORT, '-m', METADATA_PATH], stdout=sys.stdout, stderr=sys.stderr) logger.info('Node-process running at PID {0}'.format(node_process.pid)) # Create an instance of WebGME and the plugin webgme = WebGME(PORT, logger) def exit_handler(): logger.info('Cleaning up!') webgme.disconnect() node_process.send_signal(signal.SIGTERM) atexit.register(exit_handler) commit_hash = webgme.project.get_branch_hash(BRANCH_NAME) plugin = ConfigReader(webgme, commit_hash, BRANCH_NAME, ACTIVE_NODE_PATH, ACTIVE_SELECTION_PATHS, NAMESPACE) # Do the work plugin.main() # The exit_handler will be invoked after this line