Python: Global Beacon Indexing¶
Global Beacon lets anyone in your organization find datasets based on the entities it contains (i.e. variants, genes). Only datasets that contain entities can be indexed.
For more information about Global Beacons please look at Global Beacons Overview section.
GitHub examples
Please find the full example in the solvebio-python
repository on GitHub:
global beacon indexing example notebook.
Importing SolveBio library and logging in¶
1 2 3 4 5 6 | # Importing SolveBio library from solvebio import login from solvebio import Object # Logging to SolveBio login() |
Enabling Global Beacon on dataset¶
Getting the dataset:
1 2 3 4 | # Getting the dataset dataset_full_path = "solvebio:public:/beacon-test-dataset" dataset = Object.get_by_full_path(dataset_full_path) dataset |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | | Fields | Data | |-------------------------+----------------------------------------------------| | account_id | 51 | | ancestor_object_ids | [] | | availability | available | | class_name | Object | | created_at | 2021-11-29T11:24:42.093Z | | dataset_description | test | | dataset_documents_count | 26312 | | dataset_full_name | 1658666726768179211 | | dataset_id | 1658666726768179211 | | depth | 0 | | description | test | | documents_count | 26312 | | filename | beacon-test-dataset | | full_path | solvebio:public:/beacon-test-dataset | | global_beacon | | | has_children | False | | has_folder_children | False | | id | 1658666726768179211 | | is_deleted | False | | is_transformable | False | | last_accessed | 2022-01-12T13:04:24Z | | last_modified | 2021-11-29T11:27:06.214Z | | md5 | | | metadata | {} | | mimetype | application/vnd.solvebio.dataset | | num_children | 0 | | num_descendants | 0 | | object_type | dataset | | parent_object_id | | | path | /beacon-test-dataset | | size | | | storage_class | Standard-IA | | tags | ['test', 'other tag'] | | updated_at | 2022-01-13T09:59:14.268Z | | upload_url | | | url | | | user | { "class_name": "User", "email": "nkrivacevi ... | | user_id | 8677 | | vault_id | 7205 | | vault_name | public | |
Enabling Global Beacon:
1 2 | # Enabling Global Beacon on dataset dataset.enable_global_beacon() |
1 2 3 4 5 6 | {'id': 125, 'datastore_id': 6, 'dataset_id': 1658666726768179211, 'status': 'indexing', 'progress_percent': 0, 'is_deleted': False} |
Please note that in the response, attribute status is indexing
. While indexing is still in progress you won't be able to perform Global Beacon Search.
Checking the status of Global Beacon¶
Let’s check now the status of Global Beacon indexing for the datasets:
1 2 | # Getting the status of global beacon on the dataset dataset.get_global_beacon_status() |
1 2 3 4 5 6 | {'id': 125, 'datastore_id': 6, 'dataset_id': 1658666726768179211, 'status': 'completed', 'progress_percent': 100, 'is_deleted': False} |
As we can see, indexing has been completed (status is completed
and progress percentage is 100%
).
Disabling Global Beacon on dataset¶
Now when we made sure that global beacon exists for the dataset, when we don't need it any more, we can disable/delete it.
1 2 | # Disabling Global Beacon on dataset dataset.disable_global_beacon() |
1 2 3 4 5 6 | {'id': 125, 'datastore_id': 6, 'dataset_id': 1658666726768179211, 'status': 'destroying', 'progress_percent': 0, 'is_deleted': False} |
We can see in the response that the status is now destroying
.