示例#1
0
    def teardown_class(self):
        """Teardown class parameters"""

        # cleanup tilebucket
        for z_index in (self.z_tile, settings.SUPER_CUBOID_SIZE[2], 1):
            tile_key = self.tile_bucket.encodeObjectKey(
                nd_proj.channel_name,
                nd_proj.resolution,
                self.x_tile,
                self.y_tile,
                z_index,
            )
            self.tile_bucket.deleteObject(tile_key)

        morton_index = XYZMorton(self.tiles)
        supercuboid_key = self.cuboid_bucket.generateSupercuboidKey(
            nd_proj.channel_name, nd_proj.resolution, self.tiles)
        self.cuboid_bucket.deleteObject(supercuboid_key)
        # delete created entities
        TileIndexDB.deleteTable(endpoint_url="http://localhost:8000")
        CuboidIndexDB.deleteTable(endpoint_url="http://localhost:8000")
        IngestQueue.deleteQueue(nd_proj, endpoint_url="http://localhost:4568")
        CleanupQueue.deleteQueue(nd_proj, endpoint_url="http://localhost:4568")
        TileBucket.deleteBucket(endpoint_url="http://localhost:4567")
        try:
            CuboidBucket.deleteBucket(endpoint_url="http://localhost:4567")
        except Exception as e:
            pass
示例#2
0
def deleteTestDB ( project_name, token_name='unittest' ):
  

  try:
    # get the objects
    tk = NDToken.fromName(token_name)
    tk.delete()
    pr = NDProject.fromName(project_name)
    ds = pr.datasetcfg
    # tk = Token.objects.get(token_name=token_name)
    # pr = Project.objects.get(project_name=project_name)
    # ds = Dataset.objects.get(dataset_name=pr.dataset_id)
    
    # get the channel list
    # channel_list = Channel.objects.filter(project_id=pr)
    
    # get the correct object for the kvengine
    # pd = NDProjectsDB.getProjDB(pr)
    
    for ch in pr.projectChannels():
      ch.delete()
      # delete the channel table
      # pd.deleteNDChannel(ch.channel_name)
      # delete the channel
      # ch.delete()
    # delete the project database
    # pd.deleteNDProject()
    # delete the objects
    pr.delete()
    ds.delete()
    
    # delete s3 bucket and dynamo table
    if KV_ENGINE == REDIS:
      CuboidIndexDB.deleteTable()
      CuboidBucket.deleteBucket()
  except Exception, e:
    print(e)
    raise e
示例#3
0
def deleteTestDB(project_name, token_name='unittest'):

    try:
        # get the objects
        tk = NDToken.fromName(token_name)
        tk.delete()
        pr = NDProject.fromName(project_name)
        ds = pr.datasetcfg
        # tk = Token.objects.get(token_name=token_name)
        # pr = Project.objects.get(project_name=project_name)
        # ds = Dataset.objects.get(dataset_name=pr.dataset_id)

        # get the channel list
        # channel_list = Channel.objects.filter(project_id=pr)

        # get the correct object for the kvengine
        # pd = NDProjectsDB.getProjDB(pr)

        for ch in pr.projectChannels():
            ch.delete()
            # delete the channel table
            # pd.deleteNDChannel(ch.channel_name)
            # delete the channel
            # ch.delete()
        # delete the project database
        # pd.deleteNDProject()
        # delete the objects
        pr.delete()
        ds.delete()

        # delete s3 bucket and dynamo table
        if KV_ENGINE == REDIS:
            CuboidIndexDB.deleteTable()
            CuboidBucket.deleteBucket()
    except Exception, e:
        print(e)
        raise e
示例#4
0
from django.contrib.auth.models import User
from nduser.models import Project
from nduser.models import Dataset
from nduser.models import Token
from nduser.models import Channel
from ndproj.nddataset import NDDataset
from ndproj.ndproject import NDProject
from ndproj.ndchannel import NDChannel
from ndproj.ndtoken import NDToken
from ndlib.ndtype import *
from test_settings import *
if KV_ENGINE == REDIS:
  from ndingest.nddynamo.cuboidindexdb import CuboidIndexDB
  from ndingest.ndbucket.cuboidbucket import CuboidBucket
  try:
    CuboidIndexDB.deleteTable()
    CuboidBucket.deleteBucket()
  except Exception as e:
    pass

def createTestDB ( project_name, channel_list=['unit_anno'], channel_type=ANNOTATION, channel_datatype=UINT32, public=PUBLIC_TRUE, ximagesize=10000, yimagesize=10000, zimagesize=1000, xvoxelres=4.0, yvoxelres=4.0, zvoxelres=3.0, scalingoption=ZSLICES, scalinglevels=5, readonly=READONLY_FALSE, propagate=NOT_PROPAGATED, window=[0,0], time=[0,15], default=False, nd_version=ND_VERSION, token_name='unittest', user='******', dataset_name="unittest", base_resolution=0):
  """Create a unit test data base on the specified sit and name"""
  
  # setting s3backend to true if Redis and creating s3 bucket and dynamo table
  if KV_ENGINE == REDIS:
    s3backend = S3_TRUE
    CuboidIndexDB.createTable()
    CuboidBucket.createBucket()    
  else:
    s3backend = S3_FALSE
示例#5
0
 def teardown_class(self):
     """Teardown class parameters"""
     TileIndexDB.deleteTable(endpoint_url=settings.DYNAMO_ENDPOINT)
     CuboidIndexDB.deleteTable(endpoint_url=settings.DYNAMO_ENDPOINT)
     CleanupQueue.deleteQueue(nd_proj, endpoint_url=settings.SQS_ENDPOINT)
示例#6
0
from django.contrib.auth.models import User
from nduser.models import Project
from nduser.models import Dataset
from nduser.models import Token
from nduser.models import Channel
from ndproj.nddataset import NDDataset
from ndproj.ndproject import NDProject
from ndproj.ndchannel import NDChannel
from ndproj.ndtoken import NDToken
from ndlib.ndtype import *
from test_settings import *
if KV_ENGINE == REDIS:
    from ndingest.nddynamo.cuboidindexdb import CuboidIndexDB
    from ndingest.ndbucket.cuboidbucket import CuboidBucket
    try:
        CuboidIndexDB.deleteTable()
        CuboidBucket.deleteBucket()
    except Exception as e:
        pass


def createTestDB(project_name,
                 channel_list=['unit_anno'],
                 channel_type=ANNOTATION,
                 channel_datatype=UINT32,
                 public=PUBLIC_TRUE,
                 ximagesize=10000,
                 yimagesize=10000,
                 zimagesize=1000,
                 xvoxelres=4.0,
                 yvoxelres=4.0,
示例#7
0
 def teardown_class(self):
     """Teardown parameters"""
     CuboidIndexDB.deleteTable(endpoint_url=settings.DYNAMO_ENDPOINT)