Example #1
0
        public void DeleteSearch(Guid searchId)
        {
            var entity = _tableStorageProvider.GetEntity <SearchEntity>(SearchEntity.AllUsersPk, searchId.ToString());

            if (entity == null)
            {
                throw new Exception("No such search " + searchId);
            }

            if (entity.InputContainer != null)
            {
                _blobStorageProvider.DeleteContainer(entity.InputContainer);
            }

            if (entity.OutputContainer != null)
            {
                _blobStorageProvider.DeleteContainer(entity.OutputContainer);
            }

            if (entity.JobId != null)
            {
                try
                {
                    _batchClient.JobOperations.DeleteJob(entity.JobId);
                }
                catch (BatchException be)
                {
                    if (be.RequestInformation.HttpStatusCode != HttpStatusCode.NotFound)
                    {
                        throw;
                    }
                }
            }

            var queries = _tableStorageProvider.ListEntities <SearchQueryEntity>(entity.RowKey);

            if (queries != null)
            {
                Parallel.ForEach(queries, q =>
                {
                    _tableStorageProvider.DeleteEntity(q);
                });
            }

            _tableStorageProvider.DeleteEntity(entity);
        }
Example #2
0
 public void ResetConfiguration()
 {
     try
     {
         var entities = _tableStorageProvider.ListEntities <ConfigurationEntity>();
         if (entities != null)
         {
             Parallel.ForEach(entities, entity => _tableStorageProvider.DeleteEntity(entity));
         }
     }
     catch (Exception e)
     {
         Console.WriteLine("Failed to reset config {0}", e);
     }
     _configuration = _defaultConfiguration;
 }
        public void DeleteRepository(string repoId)
        {
            var entity =
                _tableStorageProvider.GetEntity <ExternalRepository>(ExternalRepository.DefaultPk, repoId);

            if (entity == null)
            {
                throw new Exception("Repository not found: " + repoId);
            }

            if (entity.Readonly)
            {
                throw new Exception("Repository is readonly: " + repoId);
            }

            _tableStorageProvider.DeleteEntity(entity);
        }
Example #4
0
 private void CleanupAfterFailure(string jobId, DatabaseEntity entity)
 {
     try
     {
         _tableStorageProvider.DeleteEntity(entity);
     }
     catch (Exception)
     {
     }
     try
     {
         _batchClient.JobOperations.DeleteJob(jobId);
     }
     catch (Exception)
     {
     }
 }
Example #5
0
        public void DeleteDatabase(string databaseName)
        {
            var db = GetDatabase(databaseName);

            if (db != null)
            {
                try
                {
                    var databaseProvider = GetDatabaseProvider(db);
                    databaseProvider.DeleteDatabase(databaseName);
                }
                catch (Exception)
                {
                    Console.WriteLine("Error deleteing database " + databaseName);
                }

                _tableStorageProvider.DeleteEntity(db);
            }
        }
        public void DeleteAnalysis(Guid analysisId)
        {
            var entity = _tableStorageProvider.GetEntity <AnalysisEntity>(AnalysisEntity.AllUsersPk, analysisId.ToString());

            if (entity == null)
            {
                throw new Exception("No such analysis " + analysisId);
            }

            if (entity.InputContainer != null)
            {
                _blobStorageProvider.DeleteContainer(entity.InputContainer);
            }

            if (entity.OutputContainer != null)
            {
                _blobStorageProvider.DeleteContainer(entity.OutputContainer);
            }

            if (entity.JobId != null)
            {
                try
                {
                    _batchClient.JobOperations.DeleteJob(entity.JobId);
                }
                catch (BatchException be)
                {
                    if (be.RequestInformation.HttpStatusCode != HttpStatusCode.NotFound)
                    {
                        throw;
                    }
                }
            }

            _tableStorageProvider.DeleteEntity(entity);
        }