Skip to content
Snippets Groups Projects
Commit 630aa8f0 authored by root's avatar root
Browse files

Update model properties

parent d1636931
No related branches found
No related tags found
No related merge requests found
Showing
with 68 additions and 77 deletions
File added
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
from neomodel import StructuredNode, StringProperty, IntegerProperty,UniqueIdProperty, RelationshipTo
from uuid import uuid4
class ComputingHost(StructuredNode):
ip=StringProperty()
uuid=StringProperty(unique_index=True, default=uuid4)
hostname=StringProperty()
friendlyname=StringProperty()
workingdirectory=StringProperty()
@property
def serialize(self):
"""
Serializer for node properties
"""
return {
'node_properties': {
'ip': self.name,
'uuid': self.uuid,
'hostname': self.sh_files,
'friendlyname': self.sh_files_number,
'workingdirectory': self.workingdirectory,
},
}
\ No newline at end of file
# Import libraries
from neomodel import StructuredNode, StringProperty, IntegerProperty,UniqueIdProperty, RelationshipTo from neomodel import StructuredNode, StringProperty, IntegerProperty,UniqueIdProperty, RelationshipTo
from uuid import uuid4 from uuid import uuid4
# Import models
from api.models.ocf_model import OCF from api.models.ocf_model import OCF
from api.models.storagehost_model import StorageHost from api.models.storagehost_model import StorageHost
from api.models.computinghost_model import ComputingHost from api.models.computationhost_model import ComputationHost
from api.models.user_model import User from api.models.user_model import User
class Construct(StructuredNode): class Construct(StructuredNode):
"""
Defines node properties and relationships
Provides data serializer
"""
# Properties
uuid=StringProperty(unique_index=True, default=uuid4) uuid=StringProperty(unique_index=True, default=uuid4)
userUuid=StringProperty(unique_index=True, default=uuid4)
name=StringProperty() name=StringProperty()
# Relationships # Relationships
has_ocf=RelationshipTo(OCF, 'HAS') has_ocf=RelationshipTo(OCF, 'HAS')
has_storage_host=RelationshipTo(StorageHost, 'HAS') has_storage_host=RelationshipTo(StorageHost, 'HAS')
has_computing_host=RelationshipTo(ComputingHost, 'HAS') has_computation_host=RelationshipTo(ComputationHost, 'HAS')
has_user=RelationshipTo(User, 'HAS') has_user=RelationshipTo(User, 'HAS')
@property @property
...@@ -22,6 +31,7 @@ class Construct(StructuredNode): ...@@ -22,6 +31,7 @@ class Construct(StructuredNode):
return { return {
'node_properties': { 'node_properties': {
'uuid': self.uuid, 'uuid': self.uuid,
'userUuid': self.userUuid,
'name': self.name, 'name': self.name,
}, },
} }
...@@ -38,8 +48,8 @@ class Construct(StructuredNode): ...@@ -38,8 +48,8 @@ class Construct(StructuredNode):
# 'nodes_related': self.serialize_relationships(self.storagehost.all()), # 'nodes_related': self.serialize_relationships(self.storagehost.all()),
# }, # },
# { # {
# 'nodes_type': 'ComputingHost', # 'nodes_type': 'ComputationHost',
# 'nodes_related': self.serialize_relationships(self.computinghost.all()), # 'nodes_related': self.serialize_relationships(self.computationhost.all()),
# }, # },
# { # {
# 'nodes_type': 'User', # 'nodes_type': 'User',
......
# Import libraries
from neomodel import StructuredNode, StringProperty, IntegerProperty,UniqueIdProperty, RelationshipTo from neomodel import StructuredNode, StringProperty, IntegerProperty,UniqueIdProperty, RelationshipTo
from uuid import uuid4 from uuid import uuid4
# Import models
from api.models.dataset_model import Dataset from api.models.dataset_model import Dataset
class DataCollection(StructuredNode): class DataCollection(StructuredNode):
"""
Defines node properties and relationships
Provides data serializer
"""
# Properties
uuid=StringProperty(unique_index=True, default=uuid4) uuid=StringProperty(unique_index=True, default=uuid4)
imagesnumber=IntegerProperty() imagesNumber=IntegerProperty()
flux=IntegerProperty() flux=StringProperty()
resolution=StringProperty() resolution=StringProperty()
wavelength=IntegerProperty() wavelength=IntegerProperty()
transmission=IntegerProperty() transmission=IntegerProperty()
exposuretime=IntegerProperty() exposureTime=IntegerProperty()
detectordistance=IntegerProperty() detectorDistance=IntegerProperty()
beamlinename=StringProperty() beamlineName=StringProperty()
# Relationships # Relationships
generates=RelationshipTo(Dataset, 'GENERATES') generates=RelationshipTo(Dataset, 'GENERATES')
...@@ -27,13 +36,13 @@ class DataCollection(StructuredNode): ...@@ -27,13 +36,13 @@ class DataCollection(StructuredNode):
return { return {
'node_properties': { 'node_properties': {
"uuid": self.uuid, "uuid": self.uuid,
"imagesNumber": self.imagesnumber, "imagesNumber": self.imagesNumber,
"flux": self.flux, "flux": self.flux,
"resolution": self.resolution, "resolution": self.resolution,
"wavelength": self.wavelength, "wavelength": self.wavelength,
"transmission": self.transmission, "transmission": self.transmission,
"exposureTime": self.exposuretime, "exposureTime": self.exposureTime,
"detectorDistance": self.detectordistance , "detectorDistance": self.detectorDistance ,
"beamlineName": self.beamlinename, "beamlineName": self.beamlineName,
}, },
} }
\ No newline at end of file
...@@ -5,22 +5,18 @@ from api.models.dpstep_model import DPStep ...@@ -5,22 +5,18 @@ from api.models.dpstep_model import DPStep
from api.models.storagehost_model import StorageHost from api.models.storagehost_model import StorageHost
from api.models.construct_model import Construct from api.models.construct_model import Construct
class Dataset(StructuredNode): class Dataset(StructuredNode):
# Properties # Properties
uuid=StringProperty(unique_index=True, default=uuid4) uuid=StringProperty(unique_index=True, default=uuid4)
name=StringProperty() fileTemplateName=StringProperty()
# dataset_file_no=IntegerProperty() userUuid=StringProperty()
# dataset_size=StringProperty() crystalUuid=StringProperty()
filetemplatename=StringProperty() currentPath=StringProperty(max_length=500)
useruuid=StringProperty() generationPath=StringProperty(max_length=500)
crystaluuid=StringProperty() blStartingDate=StringProperty()
currentpath=StringProperty() beamlineName=StringProperty()
generationpath=StringProperty() facilityName=StringProperty()
blstartingdate=DateTimeProperty()
beamlinename=StringProperty()
facilityname=StringProperty()
# Relationships # Relationships
input_of=RelationshipTo(DPStep, 'INPUT') input_of=RelationshipTo(DPStep, 'INPUT')
...@@ -37,17 +33,14 @@ class Dataset(StructuredNode): ...@@ -37,17 +33,14 @@ class Dataset(StructuredNode):
return { return {
'node_properties': { 'node_properties': {
'uuid': self.uuid, 'uuid': self.uuid,
'name': self.name, 'fileTemplateName': self.fileTemplateName,
'filetemplatename': self.filetemplatename, 'userUuid': self.userUuid,
'useruuid': self.useruuid, 'crystalUuid': self.crystalUuid,
'crystaluuid': self.crystaluuid, 'currentPath': self.currentPath,
'currentpath': self.currentpath, 'generationPath': self.generationPath,
'generationpath': self.generationpath, 'blStartingDate': self.blStartingDate,
'blstartingdate': self.blstartingdate, 'beamlineName': self.beamlineName,
'beamlinename': self.beamlinename, 'facilityName': self.facilityName,
'facilityname': self.facilityname,
# 'dataset_file_no': self.dataset_file_no,
# 'dataset_size': self.dataset_size,
}, },
} }
# Import libraries
from neomodel import StructuredNode, StringProperty, IntegerProperty,UniqueIdProperty, RelationshipTo from neomodel import StructuredNode, StringProperty, IntegerProperty,UniqueIdProperty, RelationshipTo
from uuid import uuid4 from uuid import uuid4
# Improt models
from api.models.reflectionstructurefactors_model import RefelctionStructureFactors from api.models.reflectionstructurefactors_model import RefelctionStructureFactors
from api.models.coordinates_model import Coordinates from api.models.coordinates_model import Coordinates
class OCF(StructuredNode): class OCF(StructuredNode):
"""
Defines node properties and relationships
Provides data serializer
"""
# Properties # Properties
uuid=StringProperty(unique_index=True, default=uuid4) uuid=StringProperty(unique_index=True, default=uuid4)
name=StringProperty() name=StringProperty()
pipedreamcommand=StringProperty() userUuid=StringProperty(unique_index=True, default=uuid4)
priority=StringProperty() pipedreamCommand=StringProperty()
useruuid=StringProperty() priority=IntegerProperty()
# Relationships # Relationships
has_rsf=RelationshipTo(RefelctionStructureFactors, 'HAS') has_rsf=RelationshipTo(RefelctionStructureFactors, 'HAS')
...@@ -27,9 +34,9 @@ class OCF(StructuredNode): ...@@ -27,9 +34,9 @@ class OCF(StructuredNode):
return { return {
'node_properties': { 'node_properties': {
'uuid': self.uuid, 'uuid': self.uuid,
'userUuid': self.userUuid,
'name': self.name, 'name': self.name,
'pipedreamCommand': self.pipedreamcommand, 'pipedreamCommand': self.pipedreamCommand,
'priority': self.priority, 'priority': self.priority,
'useruuid': self.useruuid,
}, },
} }
\ No newline at end of file
...@@ -4,9 +4,9 @@ from uuid import uuid4 ...@@ -4,9 +4,9 @@ from uuid import uuid4
class StorageHost(StructuredNode): class StorageHost(StructuredNode):
ip=StringProperty() ip=StringProperty()
uuid=StringProperty(unique_index=True, default=uuid4) uuid=StringProperty(unique_index=True, default=uuid4)
hostname=StringProperty() hostName=StringProperty()
friendlyname=StringProperty() friendlyName=StringProperty()
workingdirectory=StringProperty() workingDirectory=StringProperty()
@property @property
def serialize(self): def serialize(self):
...@@ -17,10 +17,10 @@ class StorageHost(StructuredNode): ...@@ -17,10 +17,10 @@ class StorageHost(StructuredNode):
return { return {
'node_properties': { 'node_properties': {
'ip': self.name, 'ip': self.ip,
'uuid': self.uuid, 'uuid': self.uuid,
'hostname': self.sh_files, 'hostName': self.hostName,
'friendlyname': self.sh_files_number, 'friendlyName': self.friendlyName,
'workingdirectory': self.workingdirectory, 'workingDirectory': self.workingDirectory,
}, },
} }
\ No newline at end of file
...@@ -5,14 +5,12 @@ class User(StructuredNode): ...@@ -5,14 +5,12 @@ class User(StructuredNode):
# Properties # Properties
uuid=StringProperty(unique_index=True, default=uuid4) uuid=StringProperty(unique_index=True, default=uuid4)
name=StringProperty()
@property @property
def serialize(self): def serialize(self):
return { return {
'node_properties': { 'node_properties': {
'uuid': self.uuid, 'uuid': self.uuid
'name': self.name,
}, },
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment