How to bodge an immediate observation in for testing purposes
From SatNOGS Wiki
Revision as of 20:22, 7 May 2020 by Matburnham (talk | contribs)
During development, I wanted a fake pass in my scheduler for an LRPT satellite. I grabbed the associated observation object from the network and then modified the start and end time. It's not perfect, but it works well enough to check for immediate gotchas.
You need to modify satnogs-client's tasks.py:
... def status_listener(): LOGGER.info('Starting scheduler...') SCHEDULER.start() SCHEDULER.remove_all_jobs() interval = settings.SATNOGS_NETWORK_API_QUERY_INTERVAL SCHEDULER.add_job(get_jobs, 'interval', minutes=interval) msg = 'Registering `get_jobs` periodic task ({0} min. interval)'.format(interval) LOGGER.info(msg) interval = settings.SATNOGS_NETWORK_API_POST_INTERVAL msg = 'Registering `post_data` periodic task ({0} min. interval)'.format(interval) LOGGER.info(msg) SCHEDULER.add_job(post_data, 'interval', minutes=interval) # ADD THIS BODGE # obj = {'id': 2170286, 'start': '2020-05-07T18:32:06Z', 'end': '2020-05-07T18:42:06Z', 'ground_station': 1507, 'tle0': 'METEOR-M 2', 'tle1': '1 40069U 14037A 20128.41275588 -.00000023 00000-0 89535-5 0 9998', 'tle2': '2 40069 98.5069 167.4916 0006638 49.0804 311.0953 14.20672256302383', 'frequency': 137100000, 'mode': 'LRPT', 'transmitter': 'CojkGDaq3u42nRdLdfczng', 'baud': 80000.0} obj['start'] = (datetime.datetime.utcnow() + datetime.timedelta(seconds=30)).isoformat(timespec='seconds') obj['end'] = (datetime.datetime.utcnow() + datetime.timedelta(seconds=120)).isoformat(timespec='seconds') start = parser.parse(obj['start']) job_id = str(obj['id']) kwargs = {'obj': obj} SCHEDULER.add_job(spawn_observer, 'date', run_date=start, id='{0}'.format(job_id), kwargs=kwargs, replace_existing=True) # END BODGE # ...