'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 = PythonBindingsWait(webgme, commit_hash, BRANCH_NAME, ACTIVE_NODE_PATH, ACTIVE_SELECTION_PATHS, NAMESPACE) # Do the work
logger.info('sys.args: {0}'.format(sys.argv)) PORT = sys.argv[1] COMMIT_HASH = sys.argv[2].strip('"') BRANCH_NAME = sys.argv[3].strip('"') ACTIVE_NODE_PATH = sys.argv[4].strip('"') ACTIVE_SELECTION_PATHS = [] if sys.argv[5] != '""': ACTIVE_SELECTION_PATHS = sys.argv[5].strip('"').split(',') if ACTIVE_SELECTION_PATHS[0] == '': ACTIVE_SELECTION_PATHS.pop(0) NAMESPACE = sys.argv[6].strip('"') logger.debug('commit-hash: {0}'.format(COMMIT_HASH)) logger.debug('branch-name: {0}'.format(BRANCH_NAME)) logger.debug('active-node-path: {0}'.format(ACTIVE_NODE_PATH)) logger.debug('active-selection-paths: {0}'.format(ACTIVE_SELECTION_PATHS)) logger.debug('name-space: {0}'.format(NAMESPACE)) # Create an instance of WebGME and the plugin webgme = WebGME(PORT, logger) plugin = PythonExtraFunctions(webgme, COMMIT_HASH, BRANCH_NAME, ACTIVE_NODE_PATH, ACTIVE_SELECTION_PATHS, NAMESPACE) # Do the work plugin.main() # Finally disconnect from the zmq-server webgme.disconnect()