Querying Data¶
Find dataset¶
To find a dataset registered in datatrail and get its list of file replicas as a function of storage element run:
datatrail-admin query find -n 9386707 -s chime.event.intensity.raw
Finding: 9386707 chime.event.intensity.raw
{
'contains_datasets': 0,
'datasets_contained': [],
'file_replica_locations': {
'chime': [
'/data/chime/intensity/raw/2018/07/25/astro_9386707/1166/astro_9386707_20180725175943123139_beam1166_00101532_01.msgpack',
'/data/chime/intensity/raw/2018/07/25/astro_9386707/1166/astro_9386707_20180725175943123139_beam1166_00101540_01.msgpack',
'/data/chime/intensity/raw/2018/07/25/astro_9386707/0166/astro_9386707_20180725175943123139_beam0166_00101530_01.msgpack',
...
]
'minoc': [
...
]
...
}
}
Finding: 9386707 chime.event.intensity.raw
{
'contains_datasets': 0,
'datasets_contained': [],
'file_replica_locations': {
'chime': [
'/data/chime/intensity/raw/2018/07/25/astro_9386707/1166/astro_9386707_20180725175943123139_beam1166_00101532_01.msgpack',
'/data/chime/intensity/raw/2018/07/25/astro_9386707/1166/astro_9386707_20180725175943123139_beam1166_00101540_01.msgpack',
'/data/chime/intensity/raw/2018/07/25/astro_9386707/0166/astro_9386707_20180725175943123139_beam0166_00101530_01.msgpack',
...
]
'minoc': [
...
]
...
}
}
or via python API
Python
from datatrail_admin import query
scope = "chime.event.intensity.raw"
name = "9386707"
ds = query.dataset_find(scope, name)
print(ds)
Example: Successful Output
Python
{
'contains_datasets': 0,
'datasets_contained': [],
'file_replica_locations': {
'chime': [
'/data/chime/intensity/raw/2018/07/25/astro_9386707/0166/astro_9386707_20180725175943123139_beam0166_00101535_01.ms
gpack',
'/data/chime/intensity/raw/2018/07/25/astro_9386707/1166/astro_9386707_20180725175943123139_beam1166_00101530_01.msgpack',
],
'minoc': [
'data/chime/intensity/raw/2018/07/25/astro_9386707/0166/astro_9386707_20180725175943123139_beam0166_00101535_01.msg
pack',
'data/chime/intensity/raw/2018/07/25/astro_9386707/1166/astro_9386707_20180725175943123139_beam1166_00101536_01.msg
pack',
]
}
}
If a dataset name and scope pair does not exist then it will throw an error.