Exemple #1
0
 def __init__(self, appNetworkConfig, logProcessName):
     """
     Constructor.  Will use local time for the file name by default.
     :param logFileName: file name to use for logging.
     :type logFileName: str
     """
     self.processNode = processNode.ProcessNode(appNetworkConfig,
                                                logProcessName)
Exemple #2
0
    def importProcessConfig(self, fullConfigPath):
        """
        Imports process configuration file and tries to add all the processes to the master
        list (to be used for spinning up each process).
        :param fullConfigPath: full file path to process config file
        :type fullConfigPath: str
        :raises: ValueError
        """
        self.fullConfigPath = fullConfigPath
        self.processNode = processNode.ProcessNode(fullConfigPath,
                                                   PROCESSMANAGERNAME)
        masterProcessConfig = processNodeUtils.importConfigJson(fullConfigPath)
        processList = masterProcessConfig['processList']

        for process in processList:
            #if ('processPath' in process):
            if (process['processName'] != PROCESSMANAGERNAME):
                self.processInputList.append(process)
Exemple #3
0
    def __init__(self, processName, fullConfigPath):
        gpsInterfaceNode = processNode.ProcessNode(fullConfigPath, processName)
        inputFilePath = os.path.join(
            scriptDir, 'inputData/Track on 2015-03-01 at 15-30 MST.gpx')

        gpx_file = open(inputFilePath, 'r')

        gpx = gpxpy.parse(gpx_file)
        for track in gpx.tracks:
            for segment in track.segments:
                for point in segment.points:
                    gpsDataMsg = {
                        'latitude': point.latitude,
                        'longitude': point.longitude,
                        'altitude': point.elevation
                    }
                    gpsInterfaceNode.send('gpsData', gpsDataMsg)
                    gpsInterfaceNode.log(logLevel=0, message=gpsDataMsg)
                    time.sleep(0.25)

        gpsInterfaceNode.send('proc', {'action': 'stop'})
 def __init__(self, processName, fullConfigPath):
     self.polygon = [(-33.416032, -70.593016), (-33.415370, -70.589604),
                     (-33.417340, -70.589046), (-33.417949, -70.592351),
                     (-33.416032, -70.593016)]
     self.pointInPolygonNode = processNode.ProcessNode(
         fullConfigPath, processName)
 def __init__(self, pathToNetworkConfig, processName):
     self.processNode = processNode.ProcessNode(pathToNetworkConfig,
                                                processName)
     self.responseList = []
"""
.. module:: sub
    :synopsis: subscriber
"""

import os
import sys
scriptDir = os.path.dirname(os.path.realpath(__file__))
import testConstants
sys.path.append(os.path.join(scriptDir, '..', '..', 'src'))
import processNode
import time
import pdb
import loggerNode
import logMessageAdapter

processNode = processNode.ProcessNode(
    os.path.join(scriptDir, 'appNetworkConfig3.json'), sys.argv[1])

count = 0
basicMsg = {'count': count}
while (True):
    if (basicMsg['count'] > testConstants.NUM_TEST_MSGS):
        break

    processNode.send('fancy', basicMsg)
    processNode.log(logLevel=0, message=basicMsg)
    basicMsg['count'] += 1

processNode.log(logLevel=1, message='Done processing')