def run(self): communication_service = Communication(host=self._master_hostname, port=self._master_port, service_name=self._name, server=False) communication_service.startup() self._services['CommunicationService'] = communication_service communication_service.register('CommunicationService', communication_service.get_queue()) #heartbeat_service = HeartBeatService(communication_service=communication_service, interval=10) #communication_service.register('HeartBeatService', heartbeat_service.get_queue()) #heartbeat_service.startup() #self._services['HeartBeatService'] = heartbeat_service storage_service = StorageService(directory=self._data_directory, communication_service=communication_service) communication_service.register('StorageService', storage_service.get_queue()) storage_service.startup() self._services['StorageService'] = storage_service index_service = IndexService(block_size=1024, index_directory=self._index_directory, communication_service=communication_service) communication_service.register('IndexService', index_service.get_queue()) index_service.startup() self._services['IndexService'] = index_service node = Node() node._id = 1 node._type = 'Person' node._properties['Name'] = 'Sagar' node._properties['Age'] = 21 add_node = AddNode(node)
def run(self): communication_service = Communication(host='localhost', port=4545, service_name='Worker', server=False) communication_service.startup() self._services['CommunicationService'] = communication_service communication_service.register('CommunicationService', communication_service.get_queue()) heartbeat_service = HeartBeatService(communication_service=communication_service, interval=5) communication_service.register('HeartBeatService', heartbeat_service.get_queue()) heartbeat_service.startup() self._services['HeartBeatService'] = heartbeat_service storage_service = StorageService(directory="C:\\Users\\Sagar\\PycharmProjects\\pygraphdb\\pygraphdb", communication_service=communication_service) communication_service.register('StorageService', storage_service.get_queue()) storage_service.startup() self._services['StorageService'] = storage_service
def run(self): communication_service = Communication(host='localhost', port=4545, service_name='Worker', server=False) communication_service.startup() self._services['CommunicationService'] = communication_service communication_service.register('CommunicationService', communication_service.get_queue()) heartbeat_service = HeartBeatService( communication_service=communication_service, interval=5) communication_service.register('HeartBeatService', heartbeat_service.get_queue()) heartbeat_service.startup() self._services['HeartBeatService'] = heartbeat_service storage_service = StorageService( directory="C:\\Users\\Sagar\\PycharmProjects\\pygraphdb\\pygraphdb", communication_service=communication_service) communication_service.register('StorageService', storage_service.get_queue()) storage_service.startup() self._services['StorageService'] = storage_service
__author__ = 'Sagar' from pygraphdb.services.worker.storageservice import Node, StorageService import logging import time from pygraphdb.services.common.communicationservice import CommunicationService logging.basicConfig(format='%(levelname)s:%(message)s', level=logging.INFO) node = Node() node._id = 1 node._type = 'Person' node.set_property('Name', 'Sagar') node.set_property('Age', 21) comm_service = CommunicationService('localhost', 4545, 'Sagar') path = "C:\\Users\\Sagar\\PycharmProjects\\pygraphdb\\pygraphdb" storage_service = StorageService(path, comm_service) storage_service.start() time.sleep(3) storage_service.add_node(node) time.sleep(3) storage_service.delete_node(1) time.sleep(3) storage_service.delete_node(1)