class SBE49InstrumentDescription(ResourceDescription): """ This has the metadata common to SBE49 instruments """ manufacturer = TypedAttribute(str) model = TypedAttribute(str) """
class PublisherResource(StatefulResource): """ A registry object which contains information about publishers """ #Name - inherited! publisher = TypedAttribute(str) #The identity of the publisher topics = TypedAttribute(list) # List of Topic Resource References content_type = TypedAttribute(str) #What types are there? @classmethod def create(cls, name, publisher_proc, topics, content_type): """ """ inst = cls.create_new_resource() inst.name = name inst.publisher = publisher_proc.receiver.spawned.id.full if not hasattr(topics, '__iter__'): topics = [topics] for topic in topics: inst.topics.append(topic.reference(head=True)) inst.content_type = content_type return inst
class DMGroupData(CDMResource): #Name - inherited attributes = TypedAttribute(list) dimensions = TypedAttribute(list) variables = TypedAttribute(list) dmdataresource = TypedAttribute(ResourceReference) archive_grpid = TypedAttribute(int, 0)
class ArchiveResource(StatefulResource): # Is it stateful or information? #Name (Logical IRODS Name) - inherited datatype = TypedAttribute(str, 'dap') cache_policy = TypedAttribute(str, 'none') backup_policy = TypedAttribute(str, 'none') topic = TypedAttribute(ResourceReference) #locations = TypedAttribute(list,[]) # List of Archive Location objects dmdataresource = TypedAttribute(ResourceReference)
class DataProductResource(StatefulResource): ''' Intended for the data product registry. ''' instrument_ref = TypedAttribute(ResourceReference) topic = TypedAttribute(ResourceReference) dataformat = TypedAttribute(str) description = TypedAttribute(str)
class Queue(DataObject): ''' @Brief The exchange message Queue is really an exchange registry object @TODO move to the exchange registry and use it properly! ''' type = TypedAttribute(str) name = TypedAttribute(str) args = TypedAttribute(dict)
class Publication(DataObject): """ A container message for things published """ topic_ref = TypedAttribute( ResourceReference) # The registered reference to a topic data = TypedAttribute(DataMessageObject) # Any Data Object! publisher = TypedAttribute(str) # The identity of the publisher
class InstrumentAgentResourceInstance(AgentInstance): """ Intended for the "Agent Registry", this is the instance information for an instrument agent that is running. This should reflect the individual instrument agent information. """ driver_process_id = TypedAttribute(str) instrument_ref = TypedAttribute(ResourceReference)
class SBE49InstrumentResource(InstrumentResource): """ The stuff specific to SBE49s so that you can actually talk to it enough to get more information for now. """ baudrate = TypedAttribute(int, default=9600) outputformat = TypedAttribute(int, default=0) description = TypedAttribute(ResourceReference) #reference the description """
class DMVariableData(CDMResource): """ """ #Name - inherited attributes = TypedAttribute(list) dimensions = TypedAttribute(list) type = TypedAttribute(str) dmdataresource = TypedAttribute(ResourceReference) archive_varid = TypedAttribute(str) # Varid or name?
class InstrumentResourceDescription(ResourceDescription): """ Indended for the "Instrument Registry", this is some basic metadata common to a class of all instrument resources in the system. """ # The type of instrument we are registering instrument_type = TypedAttribute(str)
class SubscriptionResource(StatefulResource): """ Informaiton about a subscriber """ #Name - inherited #owner = TypedAttribute(ResourceReference) # Don't worry about owner yet # hack for now to allow naming one-three more topic descriptions used to find topics that are subscribed to! topic1 = TypedAttribute(PubSubTopicResource) topic2 = TypedAttribute(PubSubTopicResource) topic3 = TypedAttribute(PubSubTopicResource) workflow = TypedAttribute(dict) ''' Only specify who you attach to - not who you produce to - consistent with pubsub model! <consumer name>:{'module':'path.to.module','cosumeclass':'<ConsumerClassName>',\ 'attach':<topicX> or <consumer name> or <list of consumers and topics>,\ 'Process Parameters':{<conumser property keyword arg>: <property value>},\ ''' #Used internally #current_topics = TypedAttribute(list) # List of Topic Resource References #consumer_procids = TypedAttribute(dict) # list of child consumer ids - need a process registry queues = TypedAttribute(list) # list of queue objects consumer_args = TypedAttribute(dict)
class DMDimensionData(CDMResource): #Name - inherited dim = TypedAttribute(int, 0) unlimited = TypedAttribute(bool, False) shared = TypedAttribute(bool, False) is_variable_length = TypedAttribute(bool, False) dmdataresource = TypedAttribute(ResourceReference) archive_dimid = TypedAttribute(int, 0) # Varid or name?
class DMDataResource(InformationResource): ''' @Note <class> must be a type which python can instantiate with eval! ''' #Name - inherited metadata = TypedAttribute(ResourceReference) packetsreceived = TypedAttribute(int, 0) packetspersisted = TypedAttribute(int, 0) input_archive = TypedAttribute(ResourceReference) input_topic = TypedAttribute(ResourceReference) ingested_archive = TypedAttribute(ResourceReference) ingested_topic = TypedAttribute(ResourceReference)
class PubSubTopicResource(InformationResource): """ A topic definition which can be stored in the registry Contains a Name, a Keyword, an Exchange Queue, and an AOI """ #name - inherited, a handle for the topic queue = TypedAttribute(Queue) keywords = TypedAttribute(str) aoi = TypedAttribute(AOI) @classmethod def create(cls, name, keywords, aoi=None): """ @Brief Create a topic resource and set parameters @param name is the topic name @param keywords are comma seperated key words for the topic """ inst = cls() inst.name = name inst.keywords = keywords if aoi: inst.aoi = aoi return inst
class IngestionStreamResource(StatefulResource): # name - inherited from StatefulResource input_topic_ref = TypedAttribute(ResourceReference) #input_format = TypedAttribute(str) ingested_topic_ref = TypedAttribute(ResourceReference) #ingested_format = TypedAttribute(str) persisting_input = TypedAttribute(bool) persisteing_ingested = TypedAttribute(bool) ingesting = TypedAttribute(bool) dataregistry = TypedAttribute(ResourceReference)
class InstrumentDriverResource(StatefulResource): """ Intended for the "Agent Registry", this is the instance information for an instrument driver that is running. This should reflect the individual instrument driver information. """ # The ID of the instrument the driver interacts with instrument_instance = TypedAttribute(str) description = TypedAttribute(ResourceReference) #owner = TypedAttribute(ResourceReference) spawnargs = TypedAttribute(str) type = TypedAttribute(str) process_id = TypedAttribute(str) subject = TypedAttribute(ResourceReference) data_sets = TypedAttribute(list)
class InstrumentResource(StatefulResource): ''' Intended for the "Instrument Registry," some basic instrument metadata to hang onto for now. A few fields to start with can always be appended to for a more complete listing (or even subclassing as needed). @todo Flesh this out with much much much more comprehensive metadata ''' manufacturer = TypedAttribute(str) model = TypedAttribute(str) serial_num = TypedAttribute(str) fw_version = TypedAttribute(str) description = TypedAttribute(str) ''' These are things that can be used to talk to an instrument in the CI ''' agent_message_address = TypedAttribute(str) agent_event_address = TypedAttribute(str)
class DataMessageObject(DataObject): """ Base Class for Data PubSub Message Objects """ notification = TypedAttribute(str) timestamp = TypedAttribute(float)
class IntegerAttribute(AttributeData): """ #@Todo convert to use numpy types """ i = TypedAttribute(int)
class FloatAttribute(AttributeData): """ #@Todo convert to use numpy types """ f = TypedAttribute(float)
class CDMResource(InformationResource): ''' A resource class to describe Unidata Common data model data ''' groups = TypedAttribute(list)
class StringAttribute(AttributeData): """ #@Todo convert to use numpy types """ s = TypedAttribute(str)
class DMAttributeData(CDMResource): #Name - inherited value = TypedAttribute(AttributeData) archive_attid = TypedAttribute(int, 0) # Varid or name? dmdataresource = TypedAttribute(ResourceReference)
class DMStructureData(CDMResource): """ """ #Name - inherited members = TypedAttribute(list)
class DAPMessageObject(DataMessageObject): """Container object for messaging DAP data""" das = TypedAttribute(str) dds = TypedAttribute(str) dods = TypedAttribute(str)
class StringMessageObject(DataMessageObject): """Container object for messaging STRING data""" data = TypedAttribute(str)
class DictionaryMessageObject(DataMessageObject): """Container object for messaging DICTIONARY data""" data = TypedAttribute(dict)