def parse(basePythonCodePath, sourceFilePath, particleDataHdlrObj): from mi.logging import config config.add_configuration(os.path.join(basePythonCodePath, 'res', 'config', 'mi-logging.yml')) log = get_logger() config = { DataSetDriverConfigKeys.PARTICLE_MODULE: 'mi.dataset.parser.adcps_jln', DataSetDriverConfigKeys.PARTICLE_CLASS: 'AdcpsJlnParticle' } log.trace("My ADCPS JLN Config: %s", config) def exception_callback(exception): log.debug("ERROR: " + exception) particleDataHdlrObj.setParticleDataCaptureFailure() with open(sourceFilePath, 'rb') as file_handle: parser = AdcpPd0Parser(config, None, file_handle, lambda state, ingested: None, lambda data: None, exception_callback) driver = DataSetDriver(parser, particleDataHdlrObj) driver.processFileStream() return particleDataHdlrObj
def parse(basePythonCodePath, sourceFilePath, particleDataHdlrObj): config.add_configuration( os.path.join(basePythonCodePath, 'res', 'config', 'mi-logging.yml')) log = get_logger() parser_config = { DataSetDriverConfigKeys.PARTICLE_MODULE: 'mi.dataset.parser.vel3d_k_wfp', DataSetDriverConfigKeys.PARTICLE_CLASS: [ 'Vel3dKWfpMetadataParticle', 'Vel3dKWfpInstrumentParticle', 'Vel3dKWfpStringParticle' ] } def exception_callback(exception): log.debug("ERROR: %r", exception) particleDataHdlrObj.setParticleDataCaptureFailure() with open(sourceFilePath, 'rb') as stream_handle: parser = Vel3dKWfpParser(parser_config, None, stream_handle, lambda state, file: None, lambda data: None, exception_callback) driver = DataSetDriver(parser, particleDataHdlrObj) driver.processFileStream() return particleDataHdlrObj
def parse(basePythonCodePath, sourceFilePath, particleDataHdlrObj): config.add_configuration(os.path.join(basePythonCodePath, 'res', 'config', 'mi-logging.yml')) parser_config = { DataSetDriverConfigKeys.PARTICLE_MODULE: 'mi.dataset.parser.phsen_abcdef', DataSetDriverConfigKeys.PARTICLE_CLASS: ['PhsenRecoveredMetadataDataParticle', 'PhsenRecoveredInstrumentDataParticle'] } def exception_callback(exception): log.debug("ERROR: %r", exception) particleDataHdlrObj.setParticleDataCaptureFailure() with open(sourceFilePath, 'rb') as stream_handle: parser = PhsenRecoveredParser(parser_config, None, stream_handle, lambda state, ingested: None, lambda data: None, exception_callback) driver = DataSetDriver(parser, particleDataHdlrObj) driver.processFileStream() return particleDataHdlrObj
def parse(basePythonCodePath, sourceFilePath, particleDataHdlrObj): config.add_configuration(os.path.join(basePythonCodePath, 'res', 'config', 'mi-logging.yml')) log = get_logger() parser_config = { DataSetDriverConfigKeys.PARTICLE_MODULE: 'mi.dataset.parser.flord_l_wfp', DataSetDriverConfigKeys.PARTICLE_CLASS: 'FlordLWfpInstrumentParserDataParticle' } def exception_callback(exception): log.debug("ERROR: %r", exception) particleDataHdlrObj.setParticleDataCaptureFailure() with open(sourceFilePath, 'r') as stream_handle: parser = GlobalWfpEFileParser(parser_config, None, stream_handle, lambda state, ingested: None, lambda data: log.trace("Found data: %s", data), exception_callback) driver = DataSetDriver(parser, particleDataHdlrObj) driver.processFileStream() return particleDataHdlrObj
def parse(basePythonCodePath, sourceFilePath, particleDataHdlrObj): from mi.logging import config config.add_configuration( os.path.join(basePythonCodePath, 'res', 'config', 'mi-logging.yml')) log = get_logger() config = { DataSetDriverConfigKeys.PARTICLE_MODULE: 'mi.dataset.parser.adcps_jln_stc', DataSetDriverConfigKeys.PARTICLE_CLASS: None, DataSetDriverConfigKeys.PARTICLE_CLASSES_DICT: { AdcpsJlnStcParticleClassKey.METADATA_PARTICLE_CLASS: AdcpsJlnStcMetadataTelemeteredDataParticle, AdcpsJlnStcParticleClassKey.INSTRUMENT_PARTICLE_CLASS: AdcpsJlnStcInstrumentTelemeteredDataParticle, } } log.debug("My ADCPS JLN STC Config: %s", config) def exception_callback(exception): log.debug("ERROR: %r", exception) particleDataHdlrObj.setParticleDataCaptureFailure() with open(sourceFilePath, 'rb') as file_handle: parser = AdcpsJlnStcParser(config, None, file_handle, lambda state, ingested: None, lambda data: None, exception_callback) driver = DataSetDriver(parser, particleDataHdlrObj) driver.processFileStream() return particleDataHdlrObj
def parse(basePythonCodePath, sourceFilePath, particleDataHdlrObj): try: if basePythonCodePath is not None: pass except NameError: basePythonCodePath = os.curdir sys.path.append(basePythonCodePath) from mi.logging import config config.add_configuration( os.path.join(basePythonCodePath, 'res', 'config', 'mi-logging.yml')) from mi.core.log import get_logger log = get_logger() config = { DataSetDriverConfigKeys.PARTICLE_MODULE: 'mi.dataset.parser.ctdpf_ckl_wfp_particles', DataSetDriverConfigKeys.PARTICLE_CLASS: None, DataSetDriverConfigKeys.PARTICLE_CLASSES_DICT: { 'instrument_data_particle_class': CtdpfCklWfpRecoveredDataParticle, 'metadata_particle_class': CtdpfCklWfpRecoveredMetadataParticle } } log.debug("My Config: %s", config) driver = CtdpfCklWfpDriver(sourceFilePath, particleDataHdlrObj, config) return driver.process()
def parse(basePythonCodePath, sourceFilePath, particleDataHdlrObj): config.add_configuration( os.path.join(basePythonCodePath, 'res', 'config', 'mi-logging.yml')) log = get_logger() parser_config = { DataSetDriverConfigKeys.PARTICLE_MODULE: 'mi.dataset.parser.nutnr_b_particles', DataSetDriverConfigKeys.PARTICLE_CLASS: None } def exception_callback(exception): log.debug("ERROR: %r", exception) particleDataHdlrObj.setParticleDataCaptureFailure() with open(sourceFilePath, 'r') as stream_handle: parser = NutnrBDclFullTelemeteredParser(parser_config, stream_handle, lambda state, ingested: None, lambda data: None, exception_callback) driver = DataSetDriver(parser, particleDataHdlrObj) driver.processFileStream() return particleDataHdlrObj
def init(self, debug=False): """Initialize logging for MI. Because this is a singleton it will only be initialized once.""" path = os.environ[LOGGING_CONFIG_ENVIRONMENT_VARIABLE] if LOGGING_CONFIG_ENVIRONMENT_VARIABLE in os.environ else None haveenv = path and os.path.isfile(path) if path and not haveenv: print >> os.stderr, 'WARNING: %s was set but %s was not found (using default configuration files instead)' % (LOGGING_CONFIG_ENVIRONMENT_VARIABLE, path) if path and haveenv: config.replace_configuration(path) if debug: print >> sys.stderr, str(os.getpid()) + ' configured logging from ' + path elif os.path.isfile(LOGGING_PRIMARY_FROM_FILE): config.replace_configuration(LOGGING_PRIMARY_FROM_FILE) if debug: print >> sys.stderr, str(os.getpid()) + ' configured logging from ' + LOGGING_PRIMARY_FROM_FILE else: logconfig = pkg_resources.resource_string('mi', LOGGING_PRIMARY_FROM_EGG) parsed = yaml.load(logconfig) config.replace_configuration(parsed) if debug: print >> sys.stderr, str(os.getpid()) + ' configured logging from config/' + LOGGING_PRIMARY_FROM_FILE if os.path.isfile(LOGGING_MI_OVERRIDE): config.add_configuration(LOGGING_MI_OVERRIDE) if debug: print >> sys.stderr, str(os.getpid()) + ' supplemented logging from ' + LOGGING_MI_OVERRIDE elif os.path.isfile(LOGGING_CONTAINER_OVERRIDE): config.add_configuration(LOGGING_CONTAINER_OVERRIDE) if debug: print >> sys.stderr, str(os.getpid()) + ' supplemented logging from ' + LOGGING_CONTAINER_OVERRIDE
def parse(basePythonCodePath, sourceFilePath, particleDataHdlrObj): config.add_configuration(os.path.join(basePythonCodePath, 'res', 'config', 'mi-logging.yml')) log = get_logger() parser_config = { DataSetDriverConfigKeys.PARTICLE_MODULE: 'mi.dataset.parser.vel3d_k_wfp', DataSetDriverConfigKeys.PARTICLE_CLASS: ['Vel3dKWfpMetadataParticle', 'Vel3dKWfpInstrumentParticle', 'Vel3dKWfpStringParticle'] } def exception_callback(exception): log.debug("ERROR: %r", exception) particleDataHdlrObj.setParticleDataCaptureFailure() with open(sourceFilePath, 'rb') as stream_handle: parser = Vel3dKWfpParser(parser_config, None, stream_handle, lambda state,file : None, lambda data : None, exception_callback) driver = DataSetDriver(parser, particleDataHdlrObj) driver.processFileStream() return particleDataHdlrObj
def parse(basePythonCodePath, sourceFilePath, particleDataHdlrObj): from mi.logging import config config.add_configuration(os.path.join(basePythonCodePath, 'res', 'config', 'mi-logging.yml')) log = get_logger() config = { DataSetDriverConfigKeys.PARTICLE_MODULE: 'mi.dataset.parser.adcps_jln_stc', DataSetDriverConfigKeys.PARTICLE_CLASS: None, DataSetDriverConfigKeys.PARTICLE_CLASSES_DICT: { AdcpsJlnStcParticleClassKey.METADATA_PARTICLE_CLASS: AdcpsJlnStcMetadataRecoveredDataParticle, AdcpsJlnStcParticleClassKey.INSTRUMENT_PARTICLE_CLASS: AdcpsJlnStcInstrumentRecoveredDataParticle, } } log.debug("My ADCPS JLN STC Config: %s", config) def exception_callback(exception): log.debug("ERROR: %r", exception) particleDataHdlrObj.setParticleDataCaptureFailure() with open(sourceFilePath, 'rb') as file_handle: parser = AdcpsJlnStcParser(config, None, file_handle, lambda state, ingested: None, lambda data: None, exception_callback) driver = DataSetDriver(parser, particleDataHdlrObj) driver.processFileStream() return particleDataHdlrObj
def parse(basePythonCodePath, sourceFilePath, particleDataHdlrObj): config.add_configuration(os.path.join(basePythonCodePath, 'res', 'config', 'mi-logging.yml')) parser_config = { DataSetDriverConfigKeys.PARTICLE_MODULE: 'mi.dataset.parser.dosta_abcdjm_mmp_cds', DataSetDriverConfigKeys.PARTICLE_CLASS: 'DostaAbcdjmMmpCdsParserDataParticle' } def exception_callback(exception): log.debug("ERROR: " + exception) particleDataHdlrObj.setParticleDataCaptureFailure() with open(sourceFilePath, 'rb') as stream_handle: parser = DostaAbcdjmMmpCdsParser(parser_config, None, stream_handle, lambda state, ingested: None, lambda data: None, exception_callback) driver = DataSetDriver(parser, particleDataHdlrObj) driver.processFileStream() return particleDataHdlrObj
def parse(basePythonCodePath, sourceFilePath, particleDataHdlrObj): from mi.logging import config config.add_configuration(os.path.join(basePythonCodePath, 'res', 'config', 'mi-logging.yml')) log = get_logger() config = { DataSetDriverConfigKeys.PARTICLE_CLASSES_DICT: { 'velocity': 'VelocityEarth', 'engineering': 'AdcpsEngineering', 'config': 'AdcpsConfig', 'bottom_track': 'EarthBottom', 'bottom_track_config': 'BottomConfig', } } log.trace("My ADCPS JLN Config: %s", config) def exception_callback(exception): log.error("ERROR: %r", exception) particleDataHdlrObj.setParticleDataCaptureFailure() with open(sourceFilePath, 'rb') as file_handle: parser = AdcpPd0Parser(config, file_handle, exception_callback) driver = DataSetDriver(parser, particleDataHdlrObj) driver.processFileStream() return particleDataHdlrObj
def parse(basePythonCodePath, sourceFilePath, particleDataHdlrObj): config.add_configuration(os.path.join(basePythonCodePath, 'res', 'config', 'mi-logging.yml')) driver = PresfAbcDclDriver(sourceFilePath, particleDataHdlrObj, DataTypeKey.PRESF_ABC_DCL_TELEMETERED) return driver.process()
def __init__(self, basePythonCodePath, stream_handle, particleDataHdlrObj): #configure the mi logger config.add_configuration(os.path.join(basePythonCodePath, 'res', 'config', 'mi-logging.yml')) parser = self._build_parser(stream_handle) super(SimpleDatasetDriver, self).__init__(parser, particleDataHdlrObj)
def parse(basePythonCodePath, sourceFilePath, particleDataHdlrObj): config.add_configuration(os.path.join(basePythonCodePath, 'res', 'config', 'mi-logging.yml')) log = get_logger() parser_config = { DataSetDriverConfigKeys.PARTICLE_MODULE: 'mi.dataset.parser.nutnr_b_particles', DataSetDriverConfigKeys.PARTICLE_CLASS: None } def exception_callback(exception): log.debug("ERROR: " + exception) particleDataHdlrObj.setParticleDataCaptureFailure() with open(sourceFilePath, 'r') as stream_handle: parser = NutnrBDclConcRecoveredParser(parser_config, stream_handle, lambda state, ingested : None, lambda data : None, exception_callback) driver = DataSetDriver(parser, particleDataHdlrObj) driver.processFileStream() return particleDataHdlrObj
def parse(basePythonCodePath, sourceFilePath, particleDataHdlrObj): try: if basePythonCodePath is not None: pass except NameError: basePythonCodePath = os.curdir sys.path.append(basePythonCodePath) from mi.logging import config config.add_configuration(os.path.join(basePythonCodePath, 'res', 'config', 'mi-logging.yml')) from mi.core.log import get_logger log = get_logger() """ Build and return the parser """ config = { DataSetDriverConfigKeys.PARTICLE_MODULE: 'mi.dataset.parser.ctdpf_ckl_wfp_particles', DataSetDriverConfigKeys.PARTICLE_CLASS: None, DataSetDriverConfigKeys.PARTICLE_CLASSES_DICT: { 'instrument_data_particle_class': CtdpfCklWfpTelemeteredDataParticle, 'metadata_particle_class': CtdpfCklWfpTelemeteredMetadataParticle } } log.debug("My Config: %s", config) driver = CtdpfCklWfpDriver(sourceFilePath, particleDataHdlrObj, config) return driver.process()
def parse(basePythonCodePath, sourceFilePath, particleDataHdlrObj): from mi.logging import config config.add_configuration(os.path.join(basePythonCodePath, "res", "config", "mi-logging.yml")) from mi.core.log import get_logger log = get_logger() from mi.dataset.dataset_driver import DataSetDriver, ParticleDataHandler from mi.dataset.parser.parad_k_stc_imodem import Parad_k_stc_imodemParser from mi.dataset.dataset_parser import DataSetDriverConfigKeys config = { DataSetDriverConfigKeys.PARTICLE_MODULE: "mi.dataset.parser.parad_k_stc_imodem", DataSetDriverConfigKeys.PARTICLE_CLASS: "Parad_k_stc_imodemDataParticle", } try: if particleDataHdlrObj is not None: pass except NameError: particleDataHdlrObj = ParticleDataHandler() try: if sourceFilePath is not None: pass except NameError: try: sourceFilePath = sys.argv[1] except IndexError: print "Need a source file path" sys.exit(1) def state_callback(state, ingested): pass def pub_callback(data): log.trace("Found data: %s", data) def exception_callback(exception): particleDataHdlrObj.setParticleDataCaptureFailure() stream_handle = open(sourceFilePath, "rb") try: parser = Parad_k_stc_imodemParser(config, None, stream_handle, state_callback, pub_callback, exception_callback) driver = DataSetDriver(parser, particleDataHdlrObj) driver.processFileStream() finally: stream_handle.close() stream_handle = open(sourceFilePath, "rb") return particleDataHdlrObj
def parse(basePythonCodePath, sourceFilePath, particleDataHdlrObj): config.add_configuration( os.path.join(basePythonCodePath, 'res', 'config', 'mi-logging.yml')) driver = PresfAbcDclDriver(sourceFilePath, particleDataHdlrObj, DataTypeKey.PRESF_ABC_DCL_TELEMETERED) return driver.process()
def __init__(self, basePythonCodePath, stream_handle, particleDataHdlrObj): #configure the mi logger config.add_configuration( os.path.join(basePythonCodePath, 'res', 'config', 'mi-logging.yml')) parser = self._build_parser(stream_handle) super(SimpleDatasetDriver, self).__init__(parser, particleDataHdlrObj)
def parse(basePythonCodePath, sourceFilePath, particleDataHdlrObj): config.add_configuration(os.path.join(basePythonCodePath, 'res', 'config', 'mi-logging.yml')) parser_config = { DataSetDriverConfigKeys.PARTICLE_MODULE: 'mi.dataset.parser.glider', DataSetDriverConfigKeys.PARTICLE_CLASS: 'FlortRecoveredDataParticle', } driver = FlortMDriver(basePythonCodePath, sourceFilePath, particleDataHdlrObj, parser_config) return driver.process()
def parse(basePythonCodePath, sourceFilePath, particleDataHdlrObj): config.add_configuration(os.path.join(basePythonCodePath, 'res', 'config', 'mi-logging.yml')) parser_config = { DataSetDriverConfigKeys.PARTICLE_MODULE: "mi.dataset.parser.flort_dj_dcl", DataSetDriverConfigKeys.PARTICLE_CLASS: 'FlortDjDclRecoveredInstrumentDataParticle' } driver = FlortDjDclRecoveredDriver(sourceFilePath, particleDataHdlrObj, parser_config) return driver.process()
def parse(basePythonCodePath, sourceFilePath, particleDataHdlrObj): config.add_configuration(os.path.join(basePythonCodePath, 'res', 'config', 'mi-logging.yml')) parser_config = { DataSetDriverConfigKeys.PARTICLE_MODULE: "mi.dataset.parser.spkir_abj_dcl", DataSetDriverConfigKeys.PARTICLE_CLASS: None } driver = SpkirAbjDclTelemeteredDriver(sourceFilePath, particleDataHdlrObj, parser_config) return driver.process()
def parse(basePythonCodePath, sourceFilePath, particleDataHdlrObj): config.add_configuration(os.path.join(basePythonCodePath, 'res', 'config', 'mi-logging.yml')) parser_config = { DataSetDriverConfigKeys.PARTICLE_MODULE: 'mi.dataset.parser.dosta_abcdjm_dcl', DataSetDriverConfigKeys.PARTICLE_CLASS: None } driver = DostaAbcdjmDclRecoveredDriver(sourceFilePath, particleDataHdlrObj, parser_config) return driver.process()
def parse(basePythonCodePath, sourceFilePath, particleDataHdlrObj): config.add_configuration(os.path.join(basePythonCodePath, "res", "config", "mi-logging.yml")) parser_config = { DataSetDriverConfigKeys.PARTICLE_MODULE: "mi.dataset.parser.glider", DataSetDriverConfigKeys.PARTICLE_CLASS: "FlordRecoveredDataParticle", } driver = FlordMDriver(basePythonCodePath, sourceFilePath, particleDataHdlrObj, parser_config) return driver.process()
def parse(basePythonCodePath, sourceFilePath, particleDataHdlrObj): config.add_configuration(os.path.join(basePythonCodePath, 'res', 'config', 'mi-logging.yml')) parser_config = { DataSetDriverConfigKeys.PARTICLE_MODULE: 'mi.dataset.parser.glider', DataSetDriverConfigKeys.PARTICLE_CLASS: 'FlortTelemeteredDataParticle' } driver = FlortMDriver(basePythonCodePath, sourceFilePath, particleDataHdlrObj, parser_config) return driver.process()
def parse(basePythonCodePath, sourceFilePath, particleDataHdlrObj): config.add_configuration(os.path.join(basePythonCodePath, 'res', 'config', 'mi-logging.yml')) parser_config = { DataSetDriverConfigKeys.PARTICLE_MODULE: 'mi.dataset.parser.cg_cpm_eng_cpm', DataSetDriverConfigKeys.PARTICLE_CLASS: 'CgCpmEngCpmRecoveredDataParticle' } driver = CgCpmEngCpmDriver(sourceFilePath, particleDataHdlrObj, parser_config) return driver.process()
def parse(basePythonCodePath, sourceFilePath, particleDataHdlrObj): config.add_configuration(os.path.join(basePythonCodePath, 'res', 'config', 'mi-logging.yml')) parser_config = { DataSetDriverConfigKeys.PARTICLE_MODULE: 'mi.dataset.parser.adcpt_acfgm_dcl_pd0', DataSetDriverConfigKeys.PARTICLE_CLASS: 'AdcptAcfgmPd0DclInstrumentRecoveredParticle', } driver = AdcptAcfgmDclPd0Driver(sourceFilePath, particleDataHdlrObj, parser_config) return driver.process()
def parse(basePythonCodePath, sourceFilePath, particleDataHdlrObj): config.add_configuration(os.path.join(basePythonCodePath, 'res', 'config', 'mi-logging.yml')) parser_config = { DataSetDriverConfigKeys.PARTICLE_MODULE: MODULE_NAME, DataSetDriverConfigKeys.PARTICLE_CLASS: ADCPT_ACFGM_DCL_PD8_RECOVERED_PARTICLE_CLASS, } driver = AdcptAcfgmDclPd8Driver(sourceFilePath, particleDataHdlrObj, parser_config) return driver.process()
def parse(basePythonCodePath, sourceFilePath, particleDataHdlrObj): config.add_configuration(os.path.join(basePythonCodePath, 'res', 'config', 'mi-logging.yml')) parser_config = { DataSetDriverConfigKeys.PARTICLE_MODULE: 'mi.dataset.parser.adcpa_m_glider', DataSetDriverConfigKeys.PARTICLE_CLASS: 'AdcpaMGliderRecoveredParticle', } driver = AdcpaDriver(sourceFilePath, particleDataHdlrObj, parser_config) return driver.process()
def parse(basePythonCodePath, sourceFilePath, particleDataHdlrObj): config.add_configuration(os.path.join(basePythonCodePath, "res", "config", "mi-logging.yml")) parser_config = { DataSetDriverConfigKeys.PARTICLE_MODULE: "mi.dataset.parser.adcpa_m_glider", DataSetDriverConfigKeys.PARTICLE_CLASS: "AdcpaMGliderInstrumentParticle", } driver = AdcpaDriver(sourceFilePath, particleDataHdlrObj, parser_config) return driver.process()
def parse(basePythonCodePath, sourceFilePath, particleDataHdlrObj): config.add_configuration(os.path.join(basePythonCodePath, 'res', 'config', 'mi-logging.yml')) parser_config = { DataSetDriverConfigKeys.PARTICLE_MODULE: 'mi.dataset.parser.rte_o_dcl', DataSetDriverConfigKeys.PARTICLE_CLASS: 'RteODclParserDataParticle' } driver = RteODclDriver(sourceFilePath, particleDataHdlrObj, parser_config) return driver.process()
def parse(basePythonCodePath, sourceFilePath, particleDataHdlrObj): """ Initialize the parser configuration and build the driver @param basePythonCodePath: python code path from Java @param sourceFilePath: source file from Java @param particleDataHdlrObj: particle data handler object from Java @return: processed particle data handler object """ config.add_configuration(os.path.join(basePythonCodePath, 'res', 'config', 'mi-logging.yml')) # no parser config required parser_config = {} driver = WavssADclTelemeteredDriver(sourceFilePath, particleDataHdlrObj, parser_config) return driver.process()
def parse(basePythonCodePath, sourceFilePath, particleDataHdlrObj): config.add_configuration(os.path.join(basePythonCodePath, 'res', 'config', 'mi-logging.yml')) with open(sourceFilePath, "r") as stream_handle: def exception_callback(exception): log.debug("Exception: %s", exception) particleDataHdlrObj.setParticleDataCaptureFailure() parser = DeepProfilerParser({}, stream_handle, exception_callback) driver = DataSetDriver(parser, particleDataHdlrObj) driver.processFileStream() return particleDataHdlrObj
def parse(basePythonCodePath, sourceFilePath, particleDataHdlrObj): config.add_configuration( os.path.join(basePythonCodePath, 'res', 'config', 'mi-logging.yml')) with open(sourceFilePath, "r") as stream_handle: def exception_callback(exception): log.debug("Exception: %s", exception) particleDataHdlrObj.setParticleDataCaptureFailure() parser = DeepProfilerParser({}, stream_handle, exception_callback) driver = DataSetDriver(parser, particleDataHdlrObj) driver.processFileStream() return particleDataHdlrObj
def configure_logging(logging_conf_paths, logging_config_override=None): """ Public call to configure and initialize logging. @param logging_conf_paths List of paths to logging config YML files (in read order) @param config_override Dict with config entries overriding files read """ global logging_was_configured logging_was_configured = True for path in logging_conf_paths: try: config.add_configuration(path) except Exception, e: print 'WARNING: could not load logging configuration file %s: %s' % (path, e)
def parse(basePythonCodePath, sourceFilePath, particleDataHdlrObj): config.add_configuration( os.path.join(basePythonCodePath, 'res', 'config', 'mi-logging.yml')) parser_config = { DataSetDriverConfigKeys.PARTICLE_MODULE: 'mi.dataset.parser.dosta_abcdjm_dcl', DataSetDriverConfigKeys.PARTICLE_CLASS: None } driver = DostaAbcdjmDclRecoveredDriver(sourceFilePath, particleDataHdlrObj, parser_config) return driver.process()
def parse(basePythonCodePath, sourceFilePath, particleDataHdlrObj): config.add_configuration( os.path.join(basePythonCodePath, 'res', 'config', 'mi-logging.yml')) parser_config = { DataSetDriverConfigKeys.PARTICLE_MODULE: 'mi.dataset.parser.adcpa_m_glider', DataSetDriverConfigKeys.PARTICLE_CLASS: 'AdcpaMGliderInstrumentParticle', } driver = AdcpaDriver(sourceFilePath, particleDataHdlrObj, parser_config) return driver.process()
def parse(basePythonCodePath, sourceFilePath, particleDataHdlrObj): config.add_configuration(os.path.join(basePythonCodePath, 'res', 'config', 'mi-logging.yml')) parser_config = { DataSetDriverConfigKeys.PARTICLE_CLASSES_DICT: { 'velocity': 'Velocity', 'engineering': 'Engineering', 'config': 'Config', } } driver = AdcptAcfgmDclPd0Driver(sourceFilePath, particleDataHdlrObj, parser_config) return driver.process()
def parse(basePythonCodePath, sourceFilePath, particleDataHdlrObj): config.add_configuration( os.path.join(basePythonCodePath, 'res', 'config', 'mi-logging.yml')) parser_config = { DataSetDriverConfigKeys.PARTICLE_MODULE: "mi.dataset.parser.flort_dj_dcl", DataSetDriverConfigKeys.PARTICLE_CLASS: 'FlortDjDclRecoveredInstrumentDataParticle' } driver = FlortDjDclRecoveredDriver(sourceFilePath, particleDataHdlrObj, parser_config) return driver.process()
def parse(basePythonCodePath, sourceFilePath, particleDataHdlrObj): config.add_configuration(os.path.join(basePythonCodePath, 'res', 'config', 'mi-logging.yml')) parser_config = { DataSetDriverConfigKeys.PARTICLE_MODULE: 'mi.dataset.driver.phsen_abcdef.dcl', DataSetDriverConfigKeys.PARTICLE_CLASS: None, DataSetDriverConfigKeys.PARTICLE_CLASSES_DICT: { 'metadata_particle_class_key': PhsenAbcdefDclMetadataRecoveredDataParticle, 'data_particle_class_key': PhsenAbcdefDclInstrumentRecoveredDataParticle, } } driver = Phsen_abcdef_dcl_Driver(sourceFilePath, particleDataHdlrObj, parser_config) return driver.process()
def parse(basePythonCodePath, sourceFilePath, particleDataHdlrObj): config.add_configuration(os.path.join(basePythonCodePath, 'res', 'config', 'mi-logging.yml')) parser_config = { DataSetDriverConfigKeys.PARTICLE_MODULE: 'mi.dataset.driver.WFP_ENG.STC_IMODEM', DataSetDriverConfigKeys.PARTICLE_CLASS: None, DataSetDriverConfigKeys.PARTICLE_CLASSES_DICT: { 'status_data_particle_class': WfpEngStcImodemStatusTelemeteredDataParticle, 'start_data_particle_class': WfpEngStcImodemStartTelemeteredDataParticle, 'engineering_data_particle_class': WfpEngStcImodemEngineeringTelemeteredDataParticle } } driver = WfpEngStcImodemDriver(sourceFilePath, particleDataHdlrObj, parser_config) return driver.process()
def parse(basePythonCodePath, sourceFilePath, particleDataHdlrObj): config.add_configuration(os.path.join(basePythonCodePath, 'res', 'config', 'mi-logging.yml')) parser_config = { DataSetDriverConfigKeys.PARTICLE_CLASSES_DICT: { 'velocity': 'VelocityGlider', 'engineering': 'GliderEngineering', 'config': 'GliderConfig', 'bottom_track': 'EarthBottom', 'bottom_track_config': 'BottomConfig', } } driver = AdcpaDriver(sourceFilePath, particleDataHdlrObj, parser_config) return driver.process()
def parse(basePythonCodePath, sourceFilePath, particleDataHdlrObj): config.add_configuration(os.path.join(basePythonCodePath, 'res', 'config', 'mi-logging.yml')) parser_config = { DataSetDriverConfigKeys.PARTICLE_MODULE: 'mi.dataset.parser.pco2w_abc_particles', DataSetDriverConfigKeys.PARTICLE_CLASS: None, DataSetDriverConfigKeys.PARTICLE_CLASSES_DICT: { Pco2wAbcParticleClassKey.METADATA_PARTICLE_CLASS: Pco2wAbcMetadataDataParticle, Pco2wAbcParticleClassKey.POWER_PARTICLE_CLASS: Pco2wAbcPowerDataParticle, Pco2wAbcParticleClassKey.INSTRUMENT_PARTICLE_CLASS: Pco2wAbcInstrumentDataParticle, Pco2wAbcParticleClassKey.INSTRUMENT_BLANK_PARTICLE_CLASS: Pco2wAbcInstrumentBlankDataParticle, } } driver = Pco2wAbcDriver(sourceFilePath, particleDataHdlrObj, parser_config) return driver.process()
def parse(basePythonCodePath, sourceFilePath, particleDataHdlrObj): config.add_configuration(os.path.join(basePythonCodePath, 'res', 'config', 'mi-logging.yml')) parser_config = { DataSetDriverConfigKeys.PARTICLE_MODULE: 'mi.dataset.parser.pco2w_abc_particles', DataSetDriverConfigKeys.PARTICLE_CLASSES_DICT: { Pco2wAbcParticleClassKey.METADATA_PARTICLE_CLASS: Pco2wAbcDclMetadataTelemeteredDataParticle, Pco2wAbcParticleClassKey.POWER_PARTICLE_CLASS: Pco2wAbcDclPowerTelemeteredDataParticle, Pco2wAbcParticleClassKey.INSTRUMENT_PARTICLE_CLASS: Pco2wAbcDclInstrumentTelemeteredDataParticle, Pco2wAbcParticleClassKey.INSTRUMENT_BLANK_PARTICLE_CLASS: Pco2wAbcDclInstrumentBlankTelemeteredDataParticle, } } driver = Pco2wAbcDclDriver(sourceFilePath, particleDataHdlrObj, parser_config) return driver.process()
def parse(basePythonCodePath, sourceFilePath, particleDataHdlrObj): config.add_configuration(os.path.join(basePythonCodePath, 'res', 'config', 'mi-logging.yml')) parser_config = { DataSetDriverConfigKeys.PARTICLE_MODULE: 'mi.dataset.parser.mopak_o_dcl', DataSetDriverConfigKeys.PARTICLE_CLASS: None, # particle_class configuration does nothing for multi-particle parsers # put the class names in specific config parameters so the parser can get them # use real classes as objects instead of strings to make it easier DataSetDriverConfigKeys.PARTICLE_CLASSES_DICT: {MopakParticleClassType.ACCEL_PARTCICLE_CLASS: MopakODclAccelParserDataParticle, MopakParticleClassType.RATE_PARTICLE_CLASS: MopakODclRateParserDataParticle} } driver = MopakDriver(sourceFilePath, particleDataHdlrObj, parser_config) return driver.process()
def parse(basePythonCodePath, sourceFilePath, particleDataHdlrObj): config.add_configuration( os.path.join(basePythonCodePath, 'res', 'config', 'mi-logging.yml')) parser_config = { DataSetDriverConfigKeys.PARTICLE_MODULE: 'mi.dataset.driver.phsen_abcdef.dcl', DataSetDriverConfigKeys.PARTICLE_CLASS: None, DataSetDriverConfigKeys.PARTICLE_CLASSES_DICT: { 'metadata_particle_class_key': PhsenAbcdefDclMetadataTelemeteredDataParticle, 'data_particle_class_key': PhsenAbcdefDclInstrumentTelemeteredDataParticle, } } driver = PhsenAbcdefDclDriver(sourceFilePath, particleDataHdlrObj, parser_config) return driver.process()
def parse(basePythonCodePath, sourceFilePath, particleDataHdlrObj): """ Initialize the parser configuration and build the driver @param basePythonCodePath - python code path from Java @param sourceFilePath - source file from Java @param particleDataHdlrObj - particle data handler object from Java """ config.add_configuration(os.path.join(basePythonCodePath, 'res', 'config', 'mi-logging.yml')) parser_config = { DataSetDriverConfigKeys.PARTICLE_MODULE: 'mi.dataset.parser.glider', DataSetDriverConfigKeys.PARTICLE_CLASSES_DICT: { EngineeringClassKey.METADATA: 'EngineeringMetadataDataParticle', EngineeringClassKey.DATA: 'EngineeringTelemeteredDataParticle', EngineeringClassKey.SCIENCE: 'EngineeringScienceTelemeteredDataParticle' } } driver = GliderEngineeringDriver(sourceFilePath, particleDataHdlrObj, parser_config) return driver.process()
def init(self, debug=False): """Initialize logging for MI. Because this is a singleton it will only be initialized once.""" path = os.environ[ LOGGING_CONFIG_ENVIRONMENT_VARIABLE] if LOGGING_CONFIG_ENVIRONMENT_VARIABLE in os.environ else None haveenv = path and os.path.isfile(path) if path and not haveenv: print >> os.stderr, 'WARNING: %s was set but %s was not found (using default configuration files instead)' % ( LOGGING_CONFIG_ENVIRONMENT_VARIABLE, path) if path and haveenv: config.replace_configuration(path) if debug: print >> sys.stderr, str( os.getpid()) + ' configured logging from ' + path elif os.path.isfile(LOGGING_PRIMARY_FROM_FILE): config.replace_configuration(LOGGING_PRIMARY_FROM_FILE) if debug: print >> sys.stderr, str(os.getpid( )) + ' configured logging from ' + LOGGING_PRIMARY_FROM_FILE else: logconfig = pkg_resources.resource_string( 'mi', LOGGING_PRIMARY_FROM_EGG) parsed = yaml.load(logconfig) config.replace_configuration(parsed) if debug: print >> sys.stderr, str( os.getpid() ) + ' configured logging from config/' + LOGGING_PRIMARY_FROM_FILE if os.path.isfile(LOGGING_MI_OVERRIDE): config.add_configuration(LOGGING_MI_OVERRIDE) if debug: print >> sys.stderr, str(os.getpid( )) + ' supplemented logging from ' + LOGGING_MI_OVERRIDE elif os.path.isfile(LOGGING_CONTAINER_OVERRIDE): config.add_configuration(LOGGING_CONTAINER_OVERRIDE) if debug: print >> sys.stderr, str(os.getpid( )) + ' supplemented logging from ' + LOGGING_CONTAINER_OVERRIDE
def parse(basePythonCodePath, sourceFilePath, particleDataHdlrObj): config.add_configuration( os.path.join(basePythonCodePath, 'res', 'config', 'mi-logging.yml')) parser_config = { DataSetDriverConfigKeys.PARTICLE_MODULE: 'mi.dataset.parser.dosta_abcdjm_mmp_cds', DataSetDriverConfigKeys.PARTICLE_CLASS: 'DostaAbcdjmMmpCdsParserDataParticle' } def exception_callback(exception): log.debug("ERROR: %r", exception) particleDataHdlrObj.setParticleDataCaptureFailure() with open(sourceFilePath, 'rb') as stream_handle: parser = MmpCdsParser(parser_config, stream_handle, exception_callback) driver = DataSetDriver(parser, particleDataHdlrObj) driver.processFileStream() return particleDataHdlrObj
def parse(basePythonCodePath, sourceFilePath, particleDataHdlrObj): from mi.logging import config config.add_configuration( os.path.join(basePythonCodePath, 'res', 'config', 'mi-logging.yml')) log = get_logger() config = { DataSetDriverConfigKeys.PARTICLE_MODULE: 'mi.dataset.parser.adcps_jln', DataSetDriverConfigKeys.PARTICLE_CLASS: 'AdcpsJlnParticle' } log.trace("My ADCPS JLN Config: %s", config) def exception_callback(exception): log.debug("ERROR: %r", exception) particleDataHdlrObj.setParticleDataCaptureFailure() with open(sourceFilePath, 'rb') as file_handle: parser = AdcpPd0Parser(config, file_handle, exception_callback) driver = DataSetDriver(parser, particleDataHdlrObj) driver.processFileStream() return particleDataHdlrObj
#! /usr/bin/env python """ @file ion/core/unit_test.py @author Bill French @brief Base test class for all MI tests. Provides two base classes, One for pyon tests and one for stand alone MI tests. We have the stand alone test case for tests that don't require or can't integrate with the common ION test case. """ from mi.core.log import get_logger log = get_logger() from mi.logging import config config.add_configuration('res/config/mi-logging.yml') import unittest import json from mi.core.instrument.data_particle import DataParticle from mi.core.instrument.data_particle import DataParticleKey from mi.core.instrument.data_particle import DataParticleValue from mi.idk.exceptions import IDKException class MiUnitTest(unittest.TestCase): """ Base class for non-ion tests. Use only if needed to avoid ion test common code. """