|
4 | 4 | from rest_framework.response import Response
|
5 | 5 | from .peril import PERIL_GROUPS, PERILS
|
6 | 6 | from ..schemas.custom_swagger import SERVER_INFO
|
7 |
| -# from ....model_execution_worker.utils import get_worker_version |
8 | 7 | import logging
|
9 | 8 |
|
| 9 | +from ods_tools import __version__ as ods_version |
| 10 | + |
10 | 11 |
|
11 | 12 | class PerilcodesView(views.APIView):
|
12 | 13 | """
|
@@ -39,8 +40,6 @@ class ServerInfoView(views.APIView):
|
39 | 40 |
|
40 | 41 | @swagger_auto_schema(responses={200: SERVER_INFO}, tags=['info'])
|
41 | 42 | def get(self, request):
|
42 |
| - from celery.contrib import rdb |
43 |
| - rdb.set_trace() |
44 | 43 | server_version = ""
|
45 | 44 | server_config = dict()
|
46 | 45 |
|
@@ -79,12 +78,20 @@ def get(self, request):
|
79 | 78 | server_config['ACCESS_TOKEN_LIFETIME'] = settings.SIMPLE_JWT['ACCESS_TOKEN_LIFETIME']
|
80 | 79 | server_config['REFRESH_TOKEN_LIFETIME'] = settings.SIMPLE_JWT['REFRESH_TOKEN_LIFETIME']
|
81 | 80 |
|
82 |
| - # Worker information |
83 |
| - worker_config = {} |
84 |
| - # worker_config = get_worker_version() |
| 81 | + # Components information |
| 82 | + components_config = { |
| 83 | + 'ods_version': ods_version, |
| 84 | + } |
| 85 | + |
| 86 | + try: |
| 87 | + from ods_tools.oed.oed_schema import OedSchema |
| 88 | + OedSchemaData = OedSchema.from_oed_schema_info(oed_schema_info=None) |
| 89 | + components_config['oed_version'] = OedSchemaData.schema['version'] |
| 90 | + except Exception as _: |
| 91 | + logging.exception("Failed to get OED version info") |
85 | 92 |
|
86 | 93 | return Response({
|
87 | 94 | 'version': server_version,
|
88 | 95 | 'config': server_config,
|
89 |
| - 'components': worker_config |
| 96 | + 'components': components_config, |
90 | 97 | })
|
0 commit comments