Buckets:
AnonymousSpottedToad/candidate_bucket / codebase /python /Voltane-EU_djfapi /djfapi /utils /health_check.py
| from fastapi import Response | |
| from ..schemas import Health | |
| def get_health(response: Response) -> Health: | |
| from health_check.mixins import CheckMixin | |
| check = CheckMixin() | |
| plugins = check.plugins if type(check.plugins) == list else check.plugins.values() | |
| failures = any([not plugin.status for plugin in plugins if plugin.critical_service]) | |
| warnings = any([not plugin.status for plugin in plugins if not plugin.critical_service]) | |
| health = Health.parse_obj({ | |
| 'status': 'FAILURE' if failures else ('WARNING' if warnings else 'OK'), | |
| 'checks': [ | |
| { | |
| 'name': plugin.__class__.__name__, | |
| 'status': 'OK' if not plugin.errors else ('WARNING' if not plugin.critical_service else 'FAILURE'), | |
| 'errors': [{ | |
| 'type': error.message_type, | |
| 'message': error.message, | |
| } for error in plugin.errors], | |
| } for plugin in plugins | |
| ] | |
| }) | |
| response.status_code = 500 if health.status == 'FAILURE' else 200 | |
| return health | |
Xet Storage Details
- Size:
- 1.08 kB
- Xet hash:
- db931101d42b0f4fbf4d6885cff68f7027821d13dc5a8a9cebdf524100410f73
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.