Open TAlonglong opened 5 years ago
I got this again. Now a bit different traceback:
[DEBUG: 2022-03-26 17:04:04 : pyorbital.tlefile] Reading TLE from /data/pytroll/tle/tle_db/tle-latest-pytroll.txt
[DEBUG: 2022-03-26 17:04:04 : trollsched.satpass] Failed in PyOrbital: "Found no TLE entry for 'METOP-B'"
[DEBUG: 2022-03-26 17:04:04 : pyorbital.tlefile] Reading TLE from /data/pytroll/tle/tle_db/tle-latest-pytroll.txt
Exception in thread Thread-2:
Traceback (most recent call last):
File "/software/miniconda/envs/pytroll/lib/python3.9/site-packages/trollsched/satpass.py", line 180, in __init__
self.orb = orbital.Orbital(satellite, line1=tle1, line2=tle2)
File "/software/miniconda/envs/pytroll/lib/python3.9/site-packages/pyorbital/orbital.py", line 156, in __init__
self.tle = tlefile.read(satellite, tle_file=tle_file,
File "/software/miniconda/envs/pytroll/lib/python3.9/site-packages/pyorbital/tlefile.py", line 113, in read
return Tle(platform, tle_file=tle_file, line1=line1, line2=line2)
File "/software/miniconda/envs/pytroll/lib/python3.9/site-packages/pyorbital/tlefile.py", line 159, in __init__
self._read_tle()
File "/software/miniconda/envs/pytroll/lib/python3.9/site-packages/pyorbital/tlefile.py", line 200, in _read_tle
raise KeyError("Found no TLE entry for '%s'" % self._platform)
KeyError: "Found no TLE entry for 'METOP-B'"
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/software/miniconda/envs/pytroll/lib/python3.9/threading.py", line 973, in _bootstrap_inner
self.run()
File "/software/miniconda/envs/pytroll/lib/python3.9/site-packages/pytroll_collectors/triggers/_posttroll.py", line 68, in run
self.process(msg)
File "/software/miniconda/envs/pytroll/lib/python3.9/site-packages/pytroll_collectors/triggers/_base.py", line 186, in add_file
self._process_pathname(pathname)
File "/software/miniconda/envs/pytroll/lib/python3.9/site-packages/pytroll_collectors/triggers/_base.py", line 182, in _process_pathname
Trigger._process_metadata(self, mda)
File "/software/miniconda/envs/pytroll/lib/python3.9/site-packages/pytroll_collectors/triggers/_base.py", line 85, in _process_metadata
res = collector(metadata.copy())
File "/software/miniconda/envs/pytroll/lib/python3.9/site-packages/pytroll_collectors/region_collector.py", line 69, in __call__
return self.collect(granule_metadata)
File "/software/miniconda/envs/pytroll/lib/python3.9/site-packages/pytroll_collectors/region_collector.py", line 105, in collect
if _granule_covers_region(granule_metadata, self.region):
File "/software/miniconda/envs/pytroll/lib/python3.9/site-packages/pytroll_collectors/region_collector.py", line 306, in _granule_covers_region
granule_pass = Pass(_get_platform_name(granule_metadata),
File "/software/miniconda/envs/pytroll/lib/python3.9/site-packages/trollsched/satpass.py", line 183, in __init__
self.orb = orbital.Orbital(
File "/software/miniconda/envs/pytroll/lib/python3.9/site-packages/pyorbital/orbital.py", line 156, in __init__
self.tle = tlefile.read(satellite, tle_file=tle_file,
File "/software/miniconda/envs/pytroll/lib/python3.9/site-packages/pyorbital/tlefile.py", line 113, in read
return Tle(platform, tle_file=tle_file, line1=line1, line2=line2)
File "/software/miniconda/envs/pytroll/lib/python3.9/site-packages/pyorbital/tlefile.py", line 159, in __init__
self._read_tle()
File "/software/miniconda/envs/pytroll/lib/python3.9/site-packages/pyorbital/tlefile.py", line 200, in _read_tle
raise KeyError("Found no TLE entry for '%s'" % self._platform)
KeyError: "Found no TLE entry for 'METOP-B'"
So here is where this can be caught:
The problem is that this gatherer thread stops, but the rest is working. So its not restarted by eg supervisor. I think this is similar to what is commented in #79
Is it possible to have a try catch for IndexError around the process
line? In my case I think this error happened due to a race condition in my processing setup. The TLE file was just updated at the same time as the collector tried to read it and then could not find the Metop-B TLE.
This can be problematic if the user does not provide the requested TLE if the exception is just passed. But it will partly solve my problem. I will loose the segment handled, but I think this is better than the gathering for this area is stopping.
If tle for some reason is missing the actual gatherer thread is crashing like this:
A possible try/excet with restart might avoid this. Or at least restart the tread.