Skip to content

Commit

Permalink
fix: refactor session launching
Browse files Browse the repository at this point in the history
  • Loading branch information
amolenaar committed Nov 13, 2023
1 parent f8104b6 commit cf3a25e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
9 changes: 7 additions & 2 deletions backend/capellacollab/sessions/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,6 @@ def request_persistent_session(
),
db: orm.Session = fastapi.Depends(database.get_db),
operator: k8s.KubernetesOperator = fastapi.Depends(operators.get_operator),
username: str = fastapi.Depends(auth_injectables.get_username),
):
log.info("Starting persistent session for user %s", user.name)

Expand All @@ -294,6 +293,12 @@ def request_persistent_session(

raise_if_conflicting_persistent_sessions(tool, user)

response = start_persistent_session(user, tool, version, operator, db)

return response


def start_persistent_session(user, tool, version, operator, db):
environment: dict[str, str] = {}
volumes: list[operators_models.Volume] = []
warnings: list[core_models.Message] = []
Expand All @@ -304,7 +309,7 @@ def request_persistent_session(
user=user,
tool_version=version,
tool=tool,
username=username,
username=user.name,
operator=operator,
)
environment |= hook_env
Expand Down
1 change: 0 additions & 1 deletion backend/tests/sessions/test_session_hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,6 @@ def test_session_creation_hook_is_called(
user,
db,
mockoperator,
"testuser",
)

assert session_hook.configuration_hook_counter == 1
Expand Down

0 comments on commit cf3a25e

Please sign in to comment.