def load_identifier_client(): token = load_tokens()['identifiers.globus.org']['access_token'] ic = IdentifierClient('Identifier', base_url='https://identifiers.globus.org/', app_name='My Local App', authorizer=AccessTokenAuthorizer(token)) return ic
def mint_minid(file_info): namespace = MINID_PROD if MINT_PROD else MINID_TEST token = load_tokens()['identifiers.globus.org']['access_token'] # You must specify the `base_url` ic = IdentifierClient('Identifier', base_url='https://identifiers.globus.org/', app_name='My Local App', authorizer=AccessTokenAuthorizer(token)) kwargs = { 'visible_to': ['public'], 'location': [file_info['location']], 'checksums': [{ 'function': 'md5', 'value': file_info['md5'] }], 'metadata': { 'Title': 'CRAM Alignment file for GTEx Sample {}.recab.cram' ''.format(file_info['id']), 'contentSize': file_info['size'] } } kwargs = {k: json.dumps(v) for k, v in kwargs.items()} minid = ic.create_identifier(namespace=namespace, **kwargs) return minid.data['identifier']
def gen_bdbag(remote_file_manifest, title, bag_name): tokens = load_tokens() minid = bag_create(remote_file_manifest, tokens[CONCIERGE_SCOPE_NAME]['access_token'], minid_metadata={'title': title}, minid_test=(not PRODUCTION_MINIDS), bag_name=bag_name, # server='http://localhost:8000' ) return minid
def ingest(): with open(SEARCH_DATA) as f: ingest_doc = json.loads(f.read()) tokens = load_tokens() auther = globus_sdk.AccessTokenAuthorizer( tokens['search.api.globus.org']['access_token']) sc = globus_sdk.SearchClient(authorizer=auther) preview = [ent['subject'] for ent in ingest_doc['ingest_data']['gmeta']] print('\n'.join(preview)) print('Ingest these to "{}"?'.format( sc.get_index(INDEX).data['display_name'])) user_input = input('Y/N> ') if user_input in ['yes', 'Y', 'y', 'yarr']: sc.ingest(INDEX, ingest_doc) print('Finished') else: print('Aborting')