(self,
url=None,
database_name=None,
collection_name=None,
consistency_level=None,
max_retry_attempts=None,
max_retry_wait_time=None,
*args,
**kwargs)
| 31 | """CosmosDB/SQL backend for Celery.""" |
| 32 | |
| 33 | def __init__(self, |
| 34 | url=None, |
| 35 | database_name=None, |
| 36 | collection_name=None, |
| 37 | consistency_level=None, |
| 38 | max_retry_attempts=None, |
| 39 | max_retry_wait_time=None, |
| 40 | *args, |
| 41 | **kwargs): |
| 42 | super().__init__(*args, **kwargs) |
| 43 | |
| 44 | if pydocumentdb is None: |
| 45 | raise ImproperlyConfigured( |
| 46 | "You need to install the pydocumentdb library to use the " |
| 47 | "CosmosDB backend.") |
| 48 | |
| 49 | conf = self.app.conf |
| 50 | |
| 51 | self._endpoint, self._key = self._parse_url(url) |
| 52 | |
| 53 | self._database_name = ( |
| 54 | database_name or |
| 55 | conf["cosmosdbsql_database_name"]) |
| 56 | |
| 57 | self._collection_name = ( |
| 58 | collection_name or |
| 59 | conf["cosmosdbsql_collection_name"]) |
| 60 | |
| 61 | try: |
| 62 | self._consistency_level = getattr( |
| 63 | ConsistencyLevel, |
| 64 | consistency_level or |
| 65 | conf["cosmosdbsql_consistency_level"]) |
| 66 | except AttributeError: |
| 67 | raise ImproperlyConfigured("Unknown CosmosDB consistency level") |
| 68 | |
| 69 | self._max_retry_attempts = ( |
| 70 | max_retry_attempts or |
| 71 | conf["cosmosdbsql_max_retry_attempts"]) |
| 72 | |
| 73 | self._max_retry_wait_time = ( |
| 74 | max_retry_wait_time or |
| 75 | conf["cosmosdbsql_max_retry_wait_time"]) |
| 76 | |
| 77 | @classmethod |
| 78 | def _parse_url(cls, url): |
nothing calls this directly
no test coverage detected