-
Notifications
You must be signed in to change notification settings - Fork 2
/
get_stats.py
49 lines (45 loc) · 1.84 KB
/
get_stats.py
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
43
44
45
46
47
48
49
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Get details about the OBO graphs currently available on KG-OBO.
"""
import click #type: ignore
import sys
from kg_obo.stats import get_all_stats
@click.command()
@click.option("--skip",
callback=lambda _,__,x: x.split(',') if x else [],
help="One or more OBOs to ignore, comma-delimited and named by their IDs, e.g., bfo.")
@click.option("--get_only",
callback=lambda _,__,x: x.split(',') if x else [],
help="""One or more OBOs to retreive, and only these,
comma-delimited and named by their IDs, e.g., bfo.""")
@click.option("--bucket",
required=True,
nargs=1,
help="""The name of the AWS S3 bucket to retrieve nodes/edges from.""")
@click.option("--save_local",
is_flag=True,
help="""If used, keeps all downloaded graph files.
Otherwise, they are deleted.""")
@click.option("--no_robot",
is_flag=True,
help="""If used, skips all ROBOT error checking and validation.
This can save a lot of time and memory.""")
def run(skip, get_only, bucket, save_local, no_robot):
try:
if len(skip) >0:
print(f"Ignoring these OBOs: {skip}" )
if len(get_only) >0:
print(f"Will only retrieve these OBOs: {get_only}" )
if no_robot:
print(f"Will skip ROBOT error checking and validation.")
if get_all_stats(skip, get_only, bucket, save_local, no_robot):
print("Operation completed without errors.")
else:
print("Operation did not complete successfully.")
except Exception as e:
print(f"Encountered unresolvable error: {type(e)} - {e} ({e.args})")
sys.exit(1)
if __name__ == '__main__':
run()