def __init__(self, pr): """Create the database connection""" self.pr = pr # create connections for cuboid bucket and cuboid dyanmo table self.cuboid_bucket = CuboidBucket( self.pr.project_name, endpoint_url=ndingest_settings.S3_ENDPOINT) self.cuboidindex_db = CuboidIndexDB( self.pr.project_name, endpoint_url=ndingest_settings.DYNAMO_ENDPOINT)
def setup_class(self): """Setup Parameters""" if 'S3_ENDPOINT' in dir(settings): self.endpoint_url = settings.S3_ENDPOINT else: self.endpoint_url = None CuboidBucket.createBucket(endpoint_url=self.endpoint_url) self.cuboid_bucket = CuboidBucket(nd_proj.project_name, endpoint_url=self.endpoint_url)
def __init__(self, db): """Connect to the S3 backend""" try: self.db = db self.project_name = self.db.proj.project_name self.cuboidindex_db = CuboidIndexDB(self.project_name) self.cuboid_bucket = CuboidBucket(self.project_name) except Exception, e: logger.error("Cannot connect to S3 backend") raise SpatialDBError("Cannot connect to S3 backend")
def __init__(self, token_name, host_name=HOST_NAME): # configuring the logger based on the dataset we are uploading self.logger = logging.getLogger(token_name) self.logger.setLevel(logging.INFO) fh = logging.FileHandler('{}_upload.log'.format(token_name)) self.logger.addHandler(fh) self.info_interface = InfoInterface(host_name, token_name) self.project_name = self.info_interface.project_name self.cuboidindex_db = CuboidIndexDB(self.project_name) self.cuboid_bucket = CuboidBucket(self.project_name)
def setup_class(self): """Setup class parameters""" # create the tile index table. skip if it exists try: TileIndexDB.createTable(endpoint_url="http://localhost:8000") CuboidIndexDB.createTable(endpoint_url="http://localhost:8000") except Exception as e: pass self.tileindex_db = TileIndexDB(nd_proj.project_name, endpoint_url="http://localhost:8000") # create the tile bucket TileBucket.createBucket(endpoint_url="http://localhost:4567") self.tile_bucket = TileBucket(nd_proj.project_name, endpoint_url="http://localhost:4567") self.tiles = [self.x_tile, self.y_tile, self.z_tile] = [0, 0, 0] message_id = "testing" receipt_handle = "123456" # insert SUPER_CUBOID_SIZE tiles in the bucket for z_index in (self.z_tile, settings.SUPER_CUBOID_SIZE[2], 1): tile_handle = cStringIO.StringIO() self.tile_bucket.putObject( tile_handle, nd_proj.channel_name, nd_proj.resolution, self.x_tile, self.y_tile, z_index, message_id, receipt_handle, ) # creating the cuboid bucket CuboidBucket.createBucket(endpoint_url="http://localhost:4567") self.cuboid_bucket = CuboidBucket(nd_proj.project_name, endpoint_url="http://localhost:4567") # create the ingest queue IngestQueue.createQueue(nd_proj, endpoint_url="http://localhost:4568") self.ingest_queue = IngestQueue(nd_proj, endpoint_url="http://localhost:4568") # send message to the ingest queue morton_index = XYZMorton(self.tiles) supercuboid_key = self.cuboid_bucket.generateSupercuboidKey( nd_proj.channel_name, nd_proj.resolution, morton_index) response = self.ingest_queue.sendMessage(supercuboid_key) # create the cleanup queue CleanupQueue.createQueue(nd_proj, endpoint_url="http://localhost:4568")
def __init__(self, token_name, host_name=HOST_NAME): """Create the bucket and intialize values""" # configuring the logger based on the dataset we are uploading self.logger = logging.getLogger(token_name) self.logger.setLevel(logging.INFO) fh = logging.FileHandler('{}.log'.format(token_name)) self.logger.addHandler(fh) # setting up the project metadata self.info_interface = InfoInterface(host_name, token_name) # creating the resource interface to the remote server # self.resource_interface = ResourceInterface(self.info_interface.dataset_name, self.info_interface.project_name, host_name, logger=self.logger) # self.proj = self.resource_interface.getProject() # create the s3 I/O and index objects self.cuboidindex_db = CuboidIndexDB(self.info_interface.project_name) self.cuboid_bucket = CuboidBucket(self.info_interface.project_name)
def __init__(self, dataset_name, project_name, host_name=HOST_NAME): # self.resource_interface = ResourceInterface(dataset_name, project_name, host_name) self.cuboid_bucket = CuboidBucket(project_name) self.cuboidindex_db = CuboidIndexDB(project_name)