Debugging¶
Unregistered events¶
Often the easiest way to debug unregistered events is to do so live in an active container.
-
Log on to frb-vsop, then list the running services using
docker service ls
. -
Find out what node the datatrail service is running on using
docker service ps [SERVICE]
. -
You may have to alter compose file so that the service stays open.
-
Log in to that node and enter the container using
docker exec -it [CONTAINER ID] bash
-
Install Vim (or another editor),
apt update; apt-install vim -y
. -
You can now edit the file to debug the issue. After adding print statements,
pip install .
the project and run. -
Trace issue and repeat step 5, until issue is resolved.
-
Don't forget to write your changes to the file outside of the container too!
Deleting an unregistered event¶
Danger
Be careful when doing so, as datatrail doesn't look before the last registered date for events. Deleting the wrong event can lead to losing the event within datatrail.
from chime_frb_api.modules.results import Results
res = Results(base_url="https://frb.chimenet.ca/results/")
r = res.view(
"datatrail-unregistered-events",
query={"event": 9623657},
projection={}
)
r[0]["id"] = "63214728958be5902bd05634"
res.delete_ids("datatrail-unregistered-events", ["63214728958be5902bd05634"])
Out: {'datatrail-unregistered-events': True}
Registering file replicas that are at Minoc but not in the Datatrail database¶
Given a list of file names that are believed to be at minoc, which are not registered in
Datatrail. The first thing to do is check that they really exist there this can be done
using the CADCClient
class. The CADCClient
has to be initialised with the
cadcprox_config
option pointing to a valide cadcproxy.pem
certificate. Using the info
method within that class we can verify that the file exists at minoc (CANFAR):
from datatrail_admin.protocols.cadcclient import CADCClient
c = CADCClient(cadcprox_config='/path/to/cadcproxy.pem')
c.info(file='/file/to/search/for.h5')
Out: ('cadc:CHIMEFRB/data/chime/baseband/raw/2019/06/25/astro_42435604/baseband_42435604_956.h5',
'baseband_42435604_956.h5',
177297728,
None,
None,
datetime.datetime(2023, 1, 11, 22, 38, 43),
'e08ad3ed56c13a2d5dddad34cf5cf992')
If the file does exist at then the command above will return information on the file's
name, path, date of creation, md5sum, and more. In order to register the file replica
with Datatrail, we will need to create a payload for the file replica which will contain
some of the information from the info
call.
replica = {
"file_name": "name_of_file"
"file_path": "/path/of/file"
"md5sum": "hagoi34ngkjhsa"
"date_created": datetime.datetime(YY, MM, DD, HH, mm)
}
payload = {
"storage_name": "minoc"
"file_replicas": [replica]
}
With this payload you can work through the steps of commit_api:add_file_replica
to
register the file replica with datatrail. Function is found here.