Skip to content
Snippets Groups Projects
computationhost_model.py 762 B
Newer Older
root's avatar
root committed
# Python imports
root's avatar
root committed
from uuid import uuid4

root's avatar
root committed
# Third-party imports
from neomodel import StructuredNode, StringProperty, IntegerProperty, UniqueIdProperty, RelationshipTo

root's avatar
root committed
class ComputationHost(StructuredNode):
root's avatar
root committed
	
	"""
	Defines node properties and relationships
	Provides data serializer
	"""
	
	# Properties
root's avatar
root committed
	ip=StringProperty()
	uuid=StringProperty(unique_index=True, default=uuid4)
	hostName=StringProperty()
root's avatar
root committed
	friendlyName=StringProperty()
	workingDirectory=StringProperty()
root's avatar
root committed

	@property
	def serialize(self):

		"""
		Serializer for node properties
		"""
		
		return {
		'computationhost_node_properties': {
		'ip': self.ip,
		'uuid': self.uuid,
		'hostName': self.hostName,
		'friendlyName': self.friendlyName,
		'workingDirectory': self.workingDirectory,
		},
root's avatar
root committed
		}