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!
Events missing verification¶
Some events can fall into a state where they are unregistered and in the dataset
event-missing-verification
. If the event is not already in the list of events to
be verified, it must be added.
To check it is in the list to be verified by tsars have a look on this webpage: https://frb.chimenet.ca/frb-web/analysis-verification
Sending events to be verified by tsars
Multiple can be sent at once using the following code:
r = requests.post("https://frb.chimenet.ca/chimefrb/astro_events/add_event_for_verification/", data={"event_nos": [428076019, 428035545, 426796083, 424206605, 417172149, 417113923, 422455825, 416916496, 395719522, 384158897, 381681830, 376111196, 367275594]})
You can check that they have been added by looking at the website above.
One more step which will be outdated soon is to send the events to intensity ml to create the waterfall plots that tsars use for classification. Without these plots, tsars cannot classify the event
from chime_frb_api.modules import distributor
dist = distributor.Distributor(base_url="http://frb-vsop.chime:8002")
events = [428076019, 428035545, 426796083, 424206605, 417172149, 417113923, 422455825, 416916496, 395719522, 384158897, 381681830, 376111196, 367275594, 426207392, 426179440, 428092541]
for e in events:
status = dist.deposit_work(distributor_name="intensity-ml", work=e)
print(status)
[True]
[True]
[True]
[True]
[True]
[True]
[True]
[True]
[True]
[True]
[True]
[True]
[True]
[True]
[True]
[True]
Note
The second step requires frb-vsop
to be accessible over the local network.
The frb-l4
machine can be used to issue these commands with the precommissioning
user.
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.