Skip to content

Commit

Permalink
fix: task_profiling imports
Browse files Browse the repository at this point in the history
Signed-off-by: Guilhem Barthes <[email protected]>
  • Loading branch information
guilhem-barthes committed Aug 4, 2023
1 parent 7c2f8a5 commit e2aab68
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions backend/substrapp/tasks/tasks_task_profiling.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
import datetime
from typing import Any

from django.conf import settings
from rest_framework import status

from backend.celery import app
from substrapp.clients import organization as organization_client
from substrapp.exceptions import OrganizationHttpError
from substrapp.models.compute_task_profiling import ComputeTaskSteps
from substrapp.utils import retry
from substrapp.utils.url import TASK_PROFILING_BASE_URL
from substrapp.utils.url import get_task_profiling_detail_url
from substrapp.utils.url import get_task_profiling_steps_base_url
from substrapp.utils.url import get_task_profiling_steps_detail_url
from substrapp.utils import retry


@retry()
def _send_profiling_event(*, channel_name: str, url_create: str, url_update: str, data: dict[str, Any]) -> bytes:
Expand Down Expand Up @@ -37,11 +41,10 @@ def create_task_profiling(channel_name: str, compute_task_key: str) -> bytes:
acks_late=True,
reject_on_worker_lost=True,
)
def _create_task_profiling_step(
def create_task_profiling_step(
channel_name: str, compute_task_key: str, field: ComputeTaskSteps, duration: datetime.timedelta
) -> bytes:
url_create = get_task_profiling_steps_base_url(compute_task_key)
url_update = get_task_profiling_steps_detail_url(compute_task_key, field.value)
data = {"step": field.value, "duration": duration}
url_update = get_task_profiling_steps_detail_url(compute_task_key, field)
data = {"step": field, "duration": duration}
return _send_profiling_event(channel_name=channel_name, url_create=url_create, url_update=url_update, data=data)

0 comments on commit e2aab68

Please sign in to comment.