def wait_for_repository_installation(self, repository_ids): final_states = [ install_model.ToolShedRepository.installation_status.ERROR, install_model.ToolShedRepository.installation_status.INSTALLED ] # Wait until all repositories are in a final state before returning. This ensures that subsequent tests # are running against an installed repository, and not one that is still in the process of installing. if repository_ids: for repository_id in repository_ids: galaxy_repository = test_db_util.get_repository( self.security.decode_id(repository_id)) log.debug( 'Repository %s with ID %s has initial state %s.' % \ ( str( galaxy_repository.name ), str( repository_id ), str( galaxy_repository.status ) ) ) timeout_counter = 0 while galaxy_repository.status not in final_states: test_db_util.refresh(galaxy_repository) log.debug( 'Repository %s with ID %s is in state %s, continuing to wait.' % \ ( str( galaxy_repository.name ), str( repository_id ), str( galaxy_repository.status ) ) ) timeout_counter = timeout_counter + 1 if timeout_counter % 10 == 0: log.debug( 'Waited %d seconds for repository %s.' % (timeout_counter, str(galaxy_repository.name))) # This timeout currently defaults to 10 minutes. if timeout_counter > repository_installation_timeout: raise AssertionError( 'Repository installation timed out after %d seconds, repository state is %s.' % \ ( timeout_counter, repository.status ) ) break time.sleep(1) # Set all metadata on each installed repository. for repository_id in repository_ids: galaxy_repository = test_db_util.get_repository( self.security.decode_id(repository_id)) if not galaxy_repository.metadata: log.debug('Setting metadata on repository %s' % str(galaxy_repository.name)) timeout_counter = 0 url = '/admin_toolshed/reset_repository_metadata?id=%s' % repository_id self.visit_url(url) while not galaxy_repository.metadata: test_db_util.refresh(galaxy_repository) timeout_counter = timeout_counter + 1 if timeout_counter % 10 == 0: log.debug( 'Waited %d seconds for repository %s.' % (timeout_counter, str(galaxy_repository.name))) # This timeout currently defaults to 10 minutes. if timeout_counter > repository_installation_timeout: raise AssertionError( 'Repository installation timed out after %d seconds, repository state is %s.' % \ ( timeout_counter, galaxy_repository.status ) ) break time.sleep(1)
def wait_for_repository_installation( self, repository_ids ): final_states = [ install_model.ToolShedRepository.installation_status.ERROR, install_model.ToolShedRepository.installation_status.INSTALLED ] # Wait until all repositories are in a final state before returning. This ensures that subsequent tests # are running against an installed repository, and not one that is still in the process of installing. if repository_ids: for repository_id in repository_ids: galaxy_repository = test_db_util.get_repository( self.security.decode_id( repository_id ) ) log.debug( 'Repository %s with ID %s has initial state %s.' % \ ( str( galaxy_repository.name ), str( repository_id ), str( galaxy_repository.status ) ) ) timeout_counter = 0 while galaxy_repository.status not in final_states: test_db_util.refresh( galaxy_repository ) log.debug( 'Repository %s with ID %s is in state %s, continuing to wait.' % \ ( str( galaxy_repository.name ), str( repository_id ), str( galaxy_repository.status ) ) ) timeout_counter = timeout_counter + 1 if timeout_counter % 10 == 0: log.debug( 'Waited %d seconds for repository %s.' % ( timeout_counter, str( galaxy_repository.name ) ) ) # This timeout currently defaults to 10 minutes. if timeout_counter > repository_installation_timeout: raise AssertionError( 'Repository installation timed out after %d seconds, repository state is %s.' % \ ( timeout_counter, repository.status ) ) break time.sleep( 1 ) # Set all metadata on each installed repository. for repository_id in repository_ids: galaxy_repository = test_db_util.get_repository( self.security.decode_id( repository_id ) ) if not galaxy_repository.metadata: log.debug( 'Setting metadata on repository %s' % str( galaxy_repository.name ) ) timeout_counter = 0 url = '/admin_toolshed/reset_repository_metadata?id=%s' % repository_id self.visit_url( url ) while not galaxy_repository.metadata: test_db_util.refresh( galaxy_repository ) timeout_counter = timeout_counter + 1 if timeout_counter % 10 == 0: log.debug( 'Waited %d seconds for repository %s.' % ( timeout_counter, str( galaxy_repository.name ) ) ) # This timeout currently defaults to 10 minutes. if timeout_counter > repository_installation_timeout: raise AssertionError( 'Repository installation timed out after %d seconds, repository state is %s.' % \ ( timeout_counter, galaxy_repository.status ) ) break time.sleep( 1 )
def wait_for_repository_installation( self, repository_ids ): final_states = [ model.ToolShedRepository.installation_status.ERROR, model.ToolShedRepository.installation_status.INSTALLED ] # Wait until all repositories are in a final state before returning. This ensures that subsequent tests # are running against an installed repository, and not one that is still in the process of installing. if repository_ids: for repository_id in repository_ids: galaxy_repository = test_db_util.get_repository( self.security.decode_id( repository_id ) ) timeout_counter = 0 while galaxy_repository.status not in final_states: test_db_util.refresh( galaxy_repository ) timeout_counter = timeout_counter + 1 # This timeout currently defaults to 180 seconds, or 3 minutes. if timeout_counter > common.repository_installation_timeout: raise AssertionError( 'Repository installation timed out, %d seconds elapsed, repository state is %s.' % \ ( timeout_counter, repository.status ) ) break time.sleep( 1 )