Skip to content

Commit

Permalink
adding auth to solve task call
Browse files Browse the repository at this point in the history
  • Loading branch information
jfhucka committed Nov 19, 2024
1 parent d4e9567 commit 8da7caa
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 8 additions & 0 deletions surfkit/runtime/agent/kube.py
Original file line number Diff line number Diff line change
Expand Up @@ -832,6 +832,13 @@ def run(
tags=tags if tags else [],
labels=labels if labels else {},
)

def _get_headers_with_auth(self, token) -> dict:
"""Helper to return headers with optional Authorization"""
headers = {
"Authorization": f"Bearer {token}"
}
return headers

def solve_task(
self,
Expand All @@ -848,6 +855,7 @@ def solve_task(
method="POST",
port=9090,
data=task.model_dump(),
headers=self._get_headers_with_auth(task.task.auth_token)
)
logger.debug(f"Task posted with response: {status_code}, {response_text}")

Expand Down
2 changes: 1 addition & 1 deletion surfkit/server/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ async def solve_task(
background_tasks: BackgroundTasks,
task_model: V1SolveTask,
):
logger.info(f"solving task: {task_model.model_dump()}")
logger.info(f"solving task: {task_model.model_dump()} with user {current_user.email}")
try:
# TODO: we need to find a way to do this earlier but get status back
mllm_router.check_model()
Expand Down

0 comments on commit 8da7caa

Please sign in to comment.