Exemple #1
0
def toOlog(imagePath, comment, omega_pv=None):
    global client

    if (client == None):
        client = OlogClient(url, username, password)
    att = Attachment(open(imagePath, "rb"))
    if (omega_pv == None):
        propOmega = Property(name='motorPosition',
                             attributes={
                                 'id': 'XF:AMXFMX{MC-Goni}Omega.RBV',
                                 'name': 'Omega',
                                 'value': 'offline',
                                 'unit': 'deg'
                             })
    else:
        propOmega = Property(name='motorPosition',
                             attributes={
                                 'id': 'XF:AMXFMX{MC-Goni}Omega.RBV',
                                 'name': 'Omega',
                                 'value': str(omega_pv.get()),
                                 'unit': 'deg'
                             })
    client.createProperty(propOmega)
    entry = LogEntry(text=comment,
                     owner="HHS",
                     logbooks=[Logbook("raster")],
                     properties=[propOmega],
                     attachments=[att])
    client.log(entry)
Exemple #2
0
 def testCreateProperty(self):
     '''
     Basic operations of creating, listing and deleting a Logbook object
     '''
     client = OlogClient(url='https://localhost:8181/Olog', username='******', password='******')
     testAttributes = {"attr":"test"}
     testProperty = Property(name='testProperty32', attributes=testAttributes)
     client.createProperty(testProperty)
     self.assertTrue(testProperty in client.listProperties(), 'failed to create the testProperty')
     '''Delete Property only deletes attributes in the service - will be fixed in the service'''
     client.delete(propertyName='testProperty32')
     self.assertTrue(testProperty not in client.listProperties(), 'failed to cleanup the testProperty')
Exemple #3
0
 def CreateProperty(self):
     '''
     Basic operations of creating, listing and deleting a property object
     TODO: the cleanup needs to be resolved
     '''
     client = OlogClient(url=getDefaultTestConfig('url'), username=getDefaultTestConfig('username'), password=getDefaultTestConfig('password'))
     testAttributes = {"attr":"test"}
     testProperty = Property(name='testProperty31', attributes=testAttributes)
     client.createProperty(testProperty)
     self.assertTrue(testProperty in client.listProperties(), 'failed to create the testProperty')
     '''Delete Property only deletes attributes in the service - will be fixed in the service'''
     client.delete(propertyName='testProperty31')
     self.assertTrue(testProperty not in client.listProperties(), 'failed to cleanup the testProperty')
Exemple #4
0
 def testProcess(self):
     client = OlogClient(url=getDefaultTestConfig('url'), username=getDefaultTestConfig('username'), password=getDefaultTestConfig('password'))
     property = Property(name='Process',
                         attributes={'processType':'diffCalc',
                                     'processId':'1234',
                                     'processAttchments':'debug.log'})
     client.createProperty(property)
     # load Data
     client.log(LogEntry(text='Initial setup',
                        owner='experimenter',
                        logbooks=[self.testLogbook],
                        properties=[property],
                        attachments=[Attachment(open('debug.log', 'rb'))]
                        ))
     # run scan
     property = Property(name='Process',
                         attributes={'processType':'diffCalc.process',
                                     'processId':'1234',
                                     'processAttchments':'.log'})
     client.log(LogEntry(text='Initial setup',
                        owner='experimenter',
                        logbooks=[self.testLogbook],
                        properties=[property]
                        ))
Exemple #5
0
 def testProcess(self):
     client = OlogClient(url='https://localhost:8181/Olog', username='******', password='******')
     property = Property(name='Process',
                         attributes={'processType':'diffCalc',
                                     'processId':'1234',
                                     'processAttchments':'debug.log'})
     client.createProperty(property)
     # load Data
     client.log(LogEntry(text='Initial setup',
                        owner='experimenter',
                        logbooks=[self.testLogbook],
                        properties=[property],
                        attachments=[Attachment(open('debug.log', 'rb'))]
                        ))
     # run scan
     property = Property(name='Process',
                         attributes={'processType':'diffCalc.process',
                                     'processId':'1234',
                                     'processAttchments':'.log'})
     client.log(LogEntry(text='Initial setup',
                        owner='experimenter',
                        logbooks=[self.testLogbook],
                        properties=[property]
                        ))