Skip to content

Commit

Permalink
Feature/remove rest client from celery (#731)
Browse files Browse the repository at this point in the history
* Develop (#709) (#710)

* Fix: Remove ai from project (#707)

* remove document deletion from delete_nlp_logs task

* inconsistency number and debug errors fixed

* add user_email to remove_authorizations_project

* Feature/health check blocklist (#708)

* remove document deletion from delete_nlp_logs task

* add a blocklist for not saving logs depending on the authorization user

* inconsistency number and debug errors fixed

* change the REPOSITORY_BLOCK_USER_LOGS values from users to repository authorizations

* change readme

* pass on sonarcloud

* change admins settings

* transform uuid into string

* convert uuid into string at test_blocked_user

* feat: update list_project_organization endpoint removing the celery call

* feat: update all code that called celery tasks for communicating with connect to calls directly into ConnectRESTClient

* bugfix: remove task.result after condition to user or not grpc endpoints, as it was conflicting with the rest call

* feat: cache request result in list_classifiers

* feat: delete cache when creating and removing a classifier
  • Loading branch information
helllllllder committed Jul 21, 2022
1 parent 8e42c7d commit 4a0b7f2
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions bothub/api/v2/internal/connect_rest_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ def remove_authorization(
authorization_uuid,
user_email,
)
cache_key = f"LIST_CLASSIFIER_CACHE_KEY:project_uuid:{project_uuid}:user_email:{user_email}"
cache.delete(cache_key)
request = requests.delete(
url=f"{self.base_url}/v1/organization/project/destroy_classifier/",
headers=self.headers,
Expand All @@ -80,6 +82,11 @@ def remove_authorization(
return request.json()

def create_classifier(self, **kwargs):
project_uuid = kwargs.get("project_uuid")
user_email = kwargs.get("user_email")
cache_key = f"LIST_CLASSIFIER_CACHE_KEY:project_uuid:{project_uuid}:user_email:{user_email}"
cache.delete(cache_key)

request = requests.post(
url=f"{self.base_url}/v1/organization/project/create_classifier/",
headers=self.headers,
Expand Down

0 comments on commit 4a0b7f2

Please sign in to comment.