ds_man.delete(ds, del_raw_data=del_raw, force=force) @post('/v1/datasets/<ds_id>/add-optical-image') @sm_modify_dataset('ADD_OPTICAL_IMAGE') def add_optical_image(ds_man, ds, params): img_id = params['url'].split('/')[-1] ds_man.add_optical_image(ds, img_id, params['transform']) @post('/v1/datasets/<ds_id>/del-optical-image') @sm_modify_dataset('DEL_OPTICAL_IMAGE') def del_optical_image(ds_man, ds, params): ds_man.del_optical_image(ds) if __name__ == '__main__': parser = argparse.ArgumentParser(description='SM Engine REST API') parser.add_argument('--config', dest='config_path', default='conf/config.json', type=str, help='SM config path') args = parser.parse_args() SMConfig.set_path(args.config_path) init_loggers(SMConfig.get_conf()['logs']) logger = logging.getLogger(name='api') logger.info('Starting SM api') run(**SMConfig.get_conf()['bottle'])
from sm.engine.search_job import SearchJob if __name__ == "__main__": parser = argparse.ArgumentParser(description='SM process dataset at a remote spark location.') parser.add_argument('--ds-id', dest='ds_id', type=str, help='Dataset id') parser.add_argument('--ds-name', dest='ds_name', type=str, help='Dataset name') parser.add_argument('--input-path', type=str, help='Path to a dataset location') parser.add_argument('--no-clean', dest='no_clean', action='store_true', help="Don't clean dataset txt files after job is finished") parser.add_argument('--config', dest='sm_config_path', default='conf/config.json', type=str, help='SM config path') args = parser.parse_args() SMConfig.set_path(args.sm_config_path) sm_config = SMConfig.get_conf() init_loggers(sm_config['logs']) db = DB(sm_config['db']) img_store = ImageStoreServiceWrapper(sm_config['services']['img_service_url']) ds_man = SMDaemonDatasetManager(db, ESExporter(db), img_store, mode='local') try: ds = create_ds_from_files(args.ds_id, args.ds_name, args.input_path) ds_man.add(ds, SearchJob, del_first=True) except Exception as e: logging.getLogger('engine').error(e) sys.exit(1) sys.exit()
with warn_only(): local('rm -rf {}'.format(self.data_dir_path)) if __name__ == '__main__': parser = argparse.ArgumentParser(description='Scientific tests runner') parser.add_argument('-r', '--run', action='store_true', help='compare current search results with previous') parser.add_argument('-s', '--save', action='store_true', help='store current search results') parser.add_argument('--config', dest='sm_config_path', default=join(proj_root(), 'conf/config.json'), help='path to sm config file') parser.add_argument('--mock-img-store', action='store_true', help='whether to mock the Image Store Service') args = parser.parse_args() SMConfig.set_path(args.sm_config_path) init_loggers(SMConfig.get_conf()['logs']) sci_tester = SciTester(args.sm_config_path) if args.run: run_search_successful = False search_results_different = False try: sci_tester.run_search(args.mock_img_store) run_search_successful = True search_results_different = sci_tester.search_results_are_different() except Exception as e: if not run_search_successful: raise Exception('Search was not successful!') from e elif search_results_different: raise Exception('Search was successful but the results are different!') from e
from sm.engine.search_job import SearchJob if __name__ == "__main__": parser = argparse.ArgumentParser(description='SM process dataset at a remote spark location.') parser.add_argument('--ds-id', dest='ds_id', type=str, help='Dataset id') parser.add_argument('--ds-name', dest='ds_name', type=str, help='Dataset name') parser.add_argument('--input-path', type=str, help='Path to a dataset location') parser.add_argument('--no-clean', dest='no_clean', action='store_true', help="Don't clean dataset txt files after job is finished") parser.add_argument('--config', dest='sm_config_path', default='conf/config.json', type=str, help='SM config path') args = parser.parse_args() SMConfig.set_path(args.sm_config_path) sm_config = SMConfig.get_conf() init_loggers(sm_config['logs']) db = DB(sm_config['db']) img_store = ImageStoreServiceWrapper(sm_config['services']['img_service_url']) ds_man = SMDaemonDatasetManager(db, ESExporter(db), img_store, mode='local') try: ds = create_ds_from_files(args.ds_id, args.ds_name, args.input_path) ds_man.add(ds, SearchJob, del_first=True) except Exception as e: logging.getLogger('engine').error(e, exc_info=True) sys.exit(1) sys.exit()