Esempio n. 1
0
    time.sleep(0.05)

    for ant in UMStates:
        mPointName = buildUMStatusMPointName(ant)
        udpPlugin.submit(mPointName,
                         UMStates[ant],
                         "STRING",
                         timestamp=datetime.utcnow(),
                         operationalMode='OPERATIONAL')
        logger.info("Sent %s with value %s", mPointName, UMStates[ant])
        time.sleep(0.05)
    logger.info("Iteration done")


if __name__ == "__main__":
    logger = Log.initLogging(__file__)

    # Get the UDP port number from the command line
    if len(sys.argv) != 3:
        logger.error(
            "UDP port and loop time (seconds) expected in command line")
        sys.exit(-1)
    try:
        udpPort = int(sys.argv[1])
    except ValueError:
        logger.error("Invalid port number %s", (sys.argv[1]))
        sys.exit(-2)
    logger.info("Will send alarms to UDP port %d", udpPort)

    try:
        loopSecs = int(sys.argv[2])
Esempio n. 2
0
        action='store',
        choices=['info', 'debug', 'warning', 'error', 'critical'],
        default='info',
        required=False)

    parser.add_argument('className',
                        help='The name of the class to run the program')
    parser.add_argument('params',
                        nargs=argparse.REMAINDER,
                        help='Command line parameters')
    args = parser.parse_args()

    #Start the logger with param define by the user.
    stdoutLevel = args.levelStdOut
    consoleLevel = args.levelConsole
    logger = Log.getLogger(__file__, stdoutLevel, consoleLevel)

    logger.info("Start IASRun")
    verbose = args.verbose
    if verbose:
        logger.info("\nVerbose mode ON")

    # Get java options from JAVA_OPTS environment variable
    javaOptions = javaOpts()

    # Build the command line
    if args.language == 's' or args.language == 'scala':
        cmd = ['scala']
        if verbose:
            logger.info("Running a SCALA program.")
    else:
Esempio n. 3
0
        action='store',
        choices=['info', 'debug', 'warning', 'error', 'critical'],
        default='info',
        required=False)
    parser.add_argument(
        '-lcon',
        '--levelConsole',
        help=
        'Logging level: Set the level of the message for the console logger, default: Debug level',
        action='store',
        choices=['info', 'debug', 'warning', 'error', 'critical'],
        default='info',
        required=False)
    parser.add_argument('moduleName',
                        help='The name of the IAS module to create')
    args = parser.parse_args()
    stdoutLevel = args.levelStdOut
    consoleLevel = args.levelConsole
    logger = Log.initLogging(__file__, stdoutLevel, consoleLevel)
    if args.erase:
        try:
            ModuleSupport.removeExistingModule(args.moduleName)
        except Exception as e:
            logger.error("Error deleting the module: %s", str(e))
            exit(-1)
    try:
        ModuleSupport.createModule(args.moduleName)
    except Exception as e:
        logger.error("Error creating the module: %s", str(e))
        exit(-1)
Esempio n. 4
0
        logger.info("Using ext jars folder %s", TestCommonDefs.extJarsDirs)
        if not path.exists(TestCommonDefs.extJarsDirs):
            logger.info('Creating folder %s', TestCommonDefs.extJarsDirs)
            mkdir(TestCommonDefs.extJarsDirs)
        logger.info("Adding a JAR to IAS_EXTERNAL_JARS")
        f = open(TestCommonDefs.extJarFileName, "w+")
        for i in range(10):
            f.write("This is line %d\r\n" % (i + 1))
        f.close()
        assert path.exists(TestCommonDefs.extJarFileName)

    @classmethod
    def tearDownClass(cls):
        if path.exists(TestCommonDefs.extJarsDirs):
            logger.info('Deleting folder %s', TestCommonDefs.extJarsDirs)
            rmtree(TestCommonDefs.extJarsDirs)

    def testImportOfExtJars(self):
        ''' Checks if the jars in the IAS_EXTERNAL_JARS are added to the classpath '''
        logger.info("Importing of external jar from %s",
                    TestCommonDefs.extJarsDirs)
        cp = CommonDefs.buildClasspath()
        logger.info("Classpath = %s", cp)
        self.assertTrue(TestCommonDefs.extJarFileName in cp)


if __name__ == '__main__':
    logger = Log.getLogger(__file__)
    logger.info("Start main")
    unittest.main()
Esempio n. 5
0
from IASTools.CommonDefs import CommonDefs
from IASLogging.logConf import Log
import os

if __name__ == '__main__':
    parser = argparse.ArgumentParser(description='Get the classpath.')
    parser.add_argument(
        '-lso',
        '--levelStdOut',
        help=
        'Logging level: Set the level of the message for the file logger, default: Debug level',
        action='store',
        choices=['info', 'debug', 'warning', 'error', 'critical'],
        default='info',
        required=False)
    parser.add_argument(
        '-lcon',
        '--levelConsole',
        help=
        'Logging level: Set the level of the message for the console logger, default: Debug level',
        action='store',
        choices=['info', 'debug', 'warning', 'error', 'critical'],
        default='info',
        required=False)
    args = parser.parse_args()
    stdoutLevel = args.levelStdOut
    consoleLevel = args.levelConsole
    logger = Log.initLogging(os.path.basename(__file__), stdoutLevel,
                             consoleLevel)
    logger.info(CommonDefs.buildClasspath())
Esempio n. 6
0
from IASLogging.logConf import Log
from IASTools.CommonDefs import CommonDefs

if __name__ == '__main__':
    parser = argparse.ArgumentParser(description='Get the classpath.')
    parser.add_argument(
        '-lso',
        '--levelStdOut',
        help=
        'Logging level: Set the level of the message for the file logger, default: Debug level',
        action='store',
        choices=['info', 'debug', 'warning', 'error', 'critical'],
        default='info',
        required=False)
    parser.add_argument(
        '-lcon',
        '--levelConsole',
        help=
        'Logging level: Set the level of the message for the console logger, default: Debug level',
        action='store',
        choices=['info', 'debug', 'warning', 'error', 'critical'],
        default='info',
        required=False)
    args = parser.parse_args()
    stdoutLevel = args.levelStdOut
    consoleLevel = args.levelConsole
    logger = Log.getLogger(os.path.basename(__file__), stdoutLevel,
                           consoleLevel)
    logger.info(CommonDefs.buildClasspath())