def openbis_instance(): instance = Openbis("http://localhost:20000") print("\nLOGGING IN...") instance.login('admin', 'anypassword') yield instance instance.logout() print("LOGGED OUT...")
def test_token(openbis_instance): assert openbis_instance.hostname is not None new_instance = Openbis(openbis_instance.url) new_instance.login('admin', 'any_test_password') assert new_instance.token is not None assert new_instance.is_token_valid() is True new_instance.logout() assert new_instance.is_token_valid() is False invalid_connection = Openbis(openbis_instance.url) with pytest.raises(Exception): invalid_connection.login('invalid_username', 'invalid_password') assert invalid_connection.token is None assert invalid_connection.is_token_valid() is False
run_minvar(o, samples_to_analyse, tqdm_out, files_to_delete) logging.info('-----------RETROSEQ Analysis session finished-----------') #time.sleep(300) logging.info('-----------CONSENSUS Analysis session starting-----------') # Fetch all consensus samples that are mapped res_test_mapped = o.get_experiment( '/IMV/CONSENSUS/CONSENSUS_INFO').get_samples(mapped=True) rtm = set(res_test_mapped.df['identifier']) # All consensus samples that have already been analyzed try: res_test_analysed = o.get_experiment( '/IMV/CONSENSUS/CONSENSUS_INFO').get_samples(mapped=True, analysed=True) rta = set(res_test_analysed.df['identifier']) except ValueError: rta = set() logging.info('Found %d mapped samples', len(rtm)) logging.info('Found %d analysed samples', len(rta)) samples_to_analyse = list(rtm - rta)[:analyses_per_run] logging.info('CONSENSUS Analysis will proceed on %d samples', len(samples_to_analyse)) files_to_delete = [] # store files that will be deleted at the end run_smaltalign(o, samples_to_analyse, tqdm_out, files_to_delete) logging.info('-----------CONSENSUS Analysis session finished-----------') o.logout()