Commit 688868c5 authored by Tammo Jan Dijkema's avatar Tammo Jan Dijkema
Browse files

Clean up tracking info

parent c3645089
import socket
import logging
import time
import atexit
from datetime import datetime
from astropy.coordinates import SkyCoord, RangeError
from configparser import ConfigParser
......@@ -22,6 +23,13 @@ _AZIMUTH_GEAR = 15006.75 # from dt_ctrl.ctrl
_ELEVATION_GEAR = 44803.125
def clearTrackingInfo():
try:
os.remove("/tmp/telescope_trackinginfo")
except OSError:
pass
class Telescope:
def __init__(self, setmode=None, consoleHost=None, waitForFirstUpdate=False):
"""
......@@ -628,6 +636,7 @@ class Telescope:
f.write(str(pid) + '\n')
f.write(script_name + '\n')
f.write(script_arguments)
atexit.register(clearTrackingInfo)
def getTrackingInfo(self):
"""
......@@ -647,7 +656,7 @@ class Telescope:
if psutil.pid_exists(int(pid)):
return script_name.strip(), script_arguments.strip()
else:
os.remove("/tmp/telescope_trackinginfo")
clearTrackingInfo()
return None
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment