Describe the bug
I have a data pipeline with a function designed to upload target lightcurves (in CSV format) to my TOM, using the TOM's APIs.
Specifically, it uses this module for the upload, which calls the TOM functions in the pipeline's tom.py module.
The issue is raised in tom.get_target_id when the server returns a 500 status code.
To Reproduce
Nothing was logged in stern when I tested this with MOP in operation, so investigating this on my test server, I re-created the query:
targetid_url = BASE_URL/api/targets/
params = {'name': 'OGLE-2024-GD-0006'} (as an example)
Internal Server Error: /api/targets/
Traceback (most recent call last):
File "/data/software/mop_venv/lib/python3.10/site-packages/django/core/handlers/exception.py", line 55, in inner
response = get_response(request)
File "/data/software/mop_venv/lib/python3.10/site-packages/django/core/handlers/base.py", line 222, in _get_response
response = self.process_exception_by_middleware(e, request)
File "/data/software/mop_venv/lib/python3.10/site-packages/django/core/handlers/base.py", line 362, in process_exception_by_middleware
response = middleware_method(request, exception)
File "/data/software/mop_venv/lib/python3.10/site-packages/tom_common/middleware.py", line 29, in process_exception
raise exception
File "/data/software/mop_venv/lib/python3.10/site-packages/django/core/handlers/base.py", line 220, in _get_response
response = response.render()
File "/data/software/mop_venv/lib/python3.10/site-packages/django/template/response.py", line 114, in render
self.content = self.rendered_content
File "/data/software/mop_venv/lib/python3.10/site-packages/rest_framework/response.py", line 74, in rendered_content
ret = renderer.render(self.data, accepted_media_type, context)
File "/data/software/mop_venv/lib/python3.10/site-packages/rest_framework/renderers.py", line 100, in render
ret = json.dumps(
File "/data/software/mop_venv/lib/python3.10/site-packages/rest_framework/utils/json.py", line 25, in dumps
return json.dumps(*args, **kwargs)
File "/usr/lib/python3.10/json/__init__.py", line 238, in dumps
**kw).encode(obj)
File "/usr/lib/python3.10/json/encoder.py", line 199, in encode
chunks = self.iterencode(o, _one_shot=True)
File "/usr/lib/python3.10/json/encoder.py", line 257, in iterencode
return _iterencode(o, 0)
ValueError: Out of range float values are not JSON compliant
Internal Server Error: /api/targets/
Traceback (most recent call last):
File "/data/software/mop_venv/lib/python3.10/site-packages/django/core/handlers/exception.py", line 55, in inner
response = get_response(request)
File "/data/software/mop_venv/lib/python3.10/site-packages/django/core/handlers/base.py", line 222, in _get_response
response = self.process_exception_by_middleware(e, request)
File "/data/software/mop_venv/lib/python3.10/site-packages/django/core/handlers/base.py", line 362, in process_exception_by_middleware
response = middleware_method(request, exception)
File "/data/software/mop_venv/lib/python3.10/site-packages/tom_common/middleware.py", line 29, in process_exception
raise exception
File "/data/software/mop_venv/lib/python3.10/site-packages/django/core/handlers/base.py", line 220, in _get_response
response = response.render()
File "/data/software/mop_venv/lib/python3.10/site-packages/django/template/response.py", line 114, in render
self.content = self.rendered_content
File "/data/software/mop_venv/lib/python3.10/site-packages/rest_framework/response.py", line 74, in rendered_content
ret = renderer.render(self.data, accepted_media_type, context)
File "/data/software/mop_venv/lib/python3.10/site-packages/rest_framework/renderers.py", line 100, in render
ret = json.dumps(
File "/data/software/mop_venv/lib/python3.10/site-packages/rest_framework/utils/json.py", line 25, in dumps
return json.dumps(*args, **kwargs)
File "/usr/lib/python3.10/json/__init__.py", line 238, in dumps
**kw).encode(obj)
File "/usr/lib/python3.10/json/encoder.py", line 199, in encode
chunks = self.iterencode(o, _one_shot=True)
File "/usr/lib/python3.10/json/encoder.py", line 257, in iterencode
return _iterencode(o, 0)
ValueError: Out of range float values are not JSON compliant
Expected behavior
This module of the pipeline has been uploading lightcurve data for some time, and hasn't changed recently, so it seems likely this is related to implementing the custom target model.
Describe the bug I have a data pipeline with a function designed to upload target lightcurves (in CSV format) to my TOM, using the TOM's APIs. Specifically, it uses this module for the upload, which calls the TOM functions in the pipeline's tom.py module.
The issue is raised in tom.get_target_id when the server returns a 500 status code.
To Reproduce
Nothing was logged in stern when I tested this with MOP in operation, so investigating this on my test server, I re-created the query:
targetid_url = BASE_URL/api/targets/ params = {'name': 'OGLE-2024-GD-0006'} (as an example)
The trackback from my test server is as follows:
Expected behavior This module of the pipeline has been uploading lightcurve data for some time, and hasn't changed recently, so it seems likely this is related to implementing the custom target model.