logger.info("Loading instrument: {}".format(instrument)) # Grab it from the notes record = sample_record(notes_df, dataset, instrument) # If that fails, just grab a file from the original datasets if record is None: logger.warning("Dataset {} has no instrument '{}'".format( dataset, instrument)) continue tiny_dataset.append(record) return tiny_dataset if __name__ == "__main__": utils.setup_logging('INFO') logger.info("Building tiny dataset from notes_df.") ROOT_DIR = os.path.join( os.path.dirname(__file__), os.pardir, os.pardir) CONFIG_PATH = os.path.join(ROOT_DIR, "data", "master_config.yaml") config = C.Config.from_yaml(CONFIG_PATH) TINY_DATASET_JSON = os.path.normpath( os.path.join(ROOT_DIR, config['data/tiny'])) tinyds = build_tiny_dataset_from_old_dataframe(config) tinyds = Dataset(tinyds) logger.debug("Tiny Dataset has {} records.".format(len(tinyds))) # Save it. logger.info("Saving dataset to: {}".format(TINY_DATASET_JSON)) tinyds.save_json(TINY_DATASET_JSON)
logger.info("Loading instrument: {}".format(instrument)) # Grab it from the notes record = sample_record(notes_df, dataset, instrument) # If that fails, just grab a file from the original datasets if record is None: logger.warning("Dataset {} has no instrument '{}'".format( dataset, instrument)) continue tiny_dataset.append(record) return tiny_dataset if __name__ == "__main__": utils.setup_logging('INFO') logger.info("Building tiny dataset from notes_df.") ROOT_DIR = os.path.join(os.path.dirname(__file__), os.pardir, os.pardir) CONFIG_PATH = os.path.join(ROOT_DIR, "data", "master_config.yaml") config = C.Config.from_yaml(CONFIG_PATH) TINY_DATASET_JSON = os.path.normpath( os.path.join(ROOT_DIR, config['data/tiny'])) tinyds = build_tiny_dataset_from_old_dataframe(config) tinyds = Dataset(tinyds) logger.debug("Tiny Dataset has {} records.".format(len(tinyds))) # Save it. logger.info("Saving dataset to: {}".format(TINY_DATASET_JSON)) tinyds.save_json(TINY_DATASET_JSON) sys.exit(os.path.exists(TINY_DATASET_JSON) is False)
if arguments['data']: test_type = 'data' elif arguments['model']: test_type = 'model' elif arguments['unit']: test_type = 'unit' logger.info('Running {} tests'.format(test_type)) result = run_tests(test_type) elif arguments['collect_results']: experiment_name = arguments.get('<experiment_name>', None) destination = arguments['<results_destination>'] integration_mode = arguments['--integration'] result = collect_results(config, destination, experiment_name, use_integration=integration_mode) return result if __name__ == "__main__": # parser.add_argument("-c", "--master_config", default=CONFIG_PATH) arguments = docopt(__doc__) utils.setup_logging(logging.DEBUG if arguments['--verbose'] else logging.INFO) handle_arguments(arguments)