Forked from
DM / dm-docs
261 commits behind, 166 commits ahead of the upstream repository.
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
observedFile.py 1.01 KiB
#!/usr/bin/env python
import time
from dmObject import DmObject
class ObservedFile(DmObject):
DEFAULT_KEY_LIST = [ 'path', 'lastUpdatedTimestamp' ]
def __init__(self, dict={}, filePath=None, daqPath=None, experiment=None):
DmObject.__init__(self, dict)
if filePath:
self['filePath'] = filePath
if daqPath:
self['daqPath'] = daqPath
if experiment:
self['experiment'] = experiment
def setLastUpdatedTimestampToNow(self):
self['lastUpdateTimestamp'] = time.time()
def getLastUpdatedTimestamp(self):
self.get('lastUpdateTimestamp')
def getFilePath(self):
return self.get('filePath')
def getDaqPath(self):
return self.get('daqPath')
def getExperiment(self):
return self.get('experiment')
####################################################################
# Testing
if __name__ == '__main__':
of = ObservedFile(path='tmp/xyz')
print of
of.setLastUpdatedTimestampToNow()
print of