sot / kadi

Chandra commands and events
https://sot.github.io/kadi
BSD 3-Clause "New" or "Revised" License
5 stars 3 forks source link

kadi and subprocesses #201

Closed javierggt closed 2 years ago

javierggt commented 3 years ago

We have discussed this multiple times. If we import kadi in a process, and then spawn a child process that also imports kadi, there is an exception in the child process.

Since it comes up often, I figured we would like to have a simple script to replicate the behavior to at document it at the very least, and perhaps we can fix it.

I created a script in this gist. It gives the time range of an OBSID given in the command line:

(ska3-flight-2021.2) javierg kadi $ python test_subprocess.py 18308
time range from OBSID: 2018:047:00:45:23.065-2018:047:03:36:33.565

One can pass the optional --import option, in which case it fails.

(ska3-flight-2021.2) javierg kadi $ python test_subprocess.py 18308 --import
Error getting OBS time range module 'kadi.events' has no attribute 'manvrs'
time range from OBSID: None-None
Traceback (most recent call last):
  File "test_subprocess.py", line 74, in <module>
    main()
  File "test_subprocess.py", line 71, in main
    start, stop = time_range_from_obsid(args.obsid)
  File "test_subprocess.py", line 54, in time_range_from_obsid
    raise Exception(f'OBSID time-range error: OBSID {obsid} not found in kadi')
Exception: OBSID time-range error: OBSID 18308 not found in kadi