Skip to content

Commit

Permalink
fix: broken codes
Browse files Browse the repository at this point in the history
  • Loading branch information
jopemachine committed Aug 3, 2024
1 parent a17aa33 commit ef854c2
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions src/ai/backend/manager/api/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -1076,15 +1076,18 @@ async def convert_session_to_image(
registry_project = project.container_registry["project"]

async with root_ctx.db.begin_readonly() as db_session:
query = sa.select(ContainerRegistryRow).where(
ContainerRegistryRow.registry_name == registry_hostname
)
query = sa.select([
ContainerRegistryRow.username,
ContainerRegistryRow.password,
ContainerRegistryRow.project,
ContainerRegistryRow.url,
]).where(ContainerRegistryRow.registry_name == registry_hostname)

registry_conf = (await db_session.execute(query)).scalar()
registry_conf = (await db_session.execute(query)).fetchall()[0]

if not registry_conf:
raise InvalidAPIParameters(f"Registry {registry_hostname} not found")
if registry_project not in registry_conf.get("project", ""):
if registry_project not in registry_conf.project:
raise InvalidAPIParameters(f"Project {registry_project} not found")

base_image_ref = session.main_kernel.image_ref
Expand Down Expand Up @@ -1198,9 +1201,9 @@ async def _commit_and_upload(reporter: ProgressReporter) -> None:
# push image to registry from local agent
image_registry = ImageRegistry(
name=registry_hostname,
url=str(registry_conf[""]),
username=registry_conf.get("username"),
password=registry_conf.get("password"),
url=str(registry_conf.url),
username=registry_conf.username,
password=registry_conf.password,
)
resp = await root_ctx.registry.push_image(
session.main_kernel.agent,
Expand Down

0 comments on commit ef854c2

Please sign in to comment.