Changeset 687 in tmcsimulator for trunk/src/python/unifiedlogger/cms_watcher.py
- Timestamp:
- 10/02/2022 10:32:42 AM (4 years ago)
- File:
-
- 1 edited
-
trunk/src/python/unifiedlogger/cms_watcher.py (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/python/unifiedlogger/cms_watcher.py
r549 r687 1 import json, time 1 import json, time, ConfigParser 2 2 from copy import deepcopy 3 3 … … 9 9 currList = [] # current messages 10 10 locationMap = {} # map of CMS ID's to locations 11 filepath = "webapps/dynamicdata" # default during development 11 12 12 13 # Utility functions … … 17 18 18 19 # Read the cms message file 19 def readFile(): 20 with open ("webapps/dynamicdata/cms_messages.json",'r') as myfile: 20 def readFile(): 21 global filepath 22 with open (filepath+"/cms_messages.json",'r') as myfile: 21 23 jsonData=myfile.read() 22 24 23 return json.loads(jsonData)['data']25 return json.loads(jsonData)['data'] 24 26 25 27 # Read the static file of cms locations and create a lookup map … … 56 58 msgList[idx]['cms']['message']['phase2']['Line3']) 57 59 58 def setup(): 59 extractMessages(initialize()) 60 def setup(dir): 61 global filepath 62 # get path to input file from configuration 63 config = ConfigParser.ConfigParser() 64 config.read(dir+'/logging_service.cfg') 65 filepath = config.get('Paths', 'UnifiedLogPath') 66 67 extractMessages(initialize()) 60 68 61 69 # compare previous messages to current messages to look for changes … … 86 94 def main(): 87 95 global currList 88 setup( )96 setup("config/devlinux") 89 97 # Loop Forever 90 98 while True:
Note: See TracChangeset
for help on using the changeset viewer.
