Skip to content

Commit

Permalink
Merge branch 'main' into fix/wrong-stream-conn-key
Browse files Browse the repository at this point in the history
  • Loading branch information
fregataa committed Oct 23, 2023
2 parents 95a4cff + 10662e8 commit aca2579
Show file tree
Hide file tree
Showing 11 changed files with 60 additions and 41 deletions.
1 change: 1 addition & 0 deletions changes/1631.fix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Use `ContainerRegistry.hostname` as ID to provide an unique identifier for each GraphQL node.
1 change: 1 addition & 0 deletions changes/1635.fix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Allow admins to restart other's session by setting an optional parameter `owner_access_key`.
1 change: 1 addition & 0 deletions changes/1636.fix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Unify each `project` field in GraphQL types `ContainerRegistry` to be a list of string.
1 change: 1 addition & 0 deletions changes/1644.fix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Set deprecation message to `max_vfolder_size` graphene field. Set `max_vfolder_count` and `max_quota_scope_size` graphene fields optional. Update VFolder update API to use renewed column name `max_quota_scope_size`.
11 changes: 9 additions & 2 deletions src/ai/backend/client/cli/session/lifecycle.py
Original file line number Diff line number Diff line change
Expand Up @@ -544,7 +544,14 @@ def destroy(session_names, forced, owner, stats, recursive):

def _restart_cmd(docs: str = None):
@click.argument("session_refs", metavar="SESSION_REFS", nargs=-1)
def restart(session_refs):
@click.option(
"-o",
"--owner",
"--owner-access-key",
metavar="ACCESS_KEY",
help="Specify the owner of the target session explicitly.",
)
def restart(session_refs, owner):
"""
Restart the compute session.
Expand All @@ -559,7 +566,7 @@ def restart(session_refs):
has_failure = False
for session_ref in session_refs:
try:
compute_session = session.ComputeSession(session_ref)
compute_session = session.ComputeSession(session_ref, owner)
compute_session.restart()
except BackendAPIError as e:
print_error(e)
Expand Down
11 changes: 9 additions & 2 deletions src/ai/backend/manager/api/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -1348,10 +1348,17 @@ async def get_info(request: web.Request) -> web.Response:

@server_status_required(READ_ALLOWED)
@auth_required
async def restart(request: web.Request) -> web.Response:
@check_api_params(
t.Dict(
{
t.Key("owner_access_key", default=None): t.Null | t.String,
}
)
)
async def restart(request: web.Request, params: Any) -> web.Response:
root_ctx: RootContext = request.app["_root.context"]
session_name = request.match_info["session_name"]
requester_access_key, owner_access_key = await get_access_key_scopes(request)
requester_access_key, owner_access_key = await get_access_key_scopes(request, params)
log.info("RESTART (ak:{0}/{1}, s:{2})", requester_access_key, owner_access_key, session_name)
async with root_ctx.db.begin_session() as db_sess:
session = await SessionRow.get_session(
Expand Down
8 changes: 4 additions & 4 deletions src/ai/backend/manager/api/vfolder.py
Original file line number Diff line number Diff line change
Expand Up @@ -1025,10 +1025,10 @@ async def update_quota(request: web.Request, params: Any) -> web.Response:
if len(entries) == 0:
raise VFolderNotFound(extra_data=params["id"])

# Limit vfolder size quota if it is larger than max_vfolder_size of the resource policy.
max_vfolder_size = resource_policy.get("max_vfolder_size", 0)
if max_vfolder_size > 0 and (quota <= 0 or quota > max_vfolder_size):
quota = max_vfolder_size
# Limit vfolder size quota if it is larger than max_quota_scope_size of the resource policy.
max_quota_scope_size = resource_policy.get("max_quota_scope_size", 0)
if max_quota_scope_size > 0 and (quota <= 0 or quota > max_quota_scope_size):
quota = max_quota_scope_size

async with root_ctx.storage_manager.request(
proxy_name,
Expand Down
5 changes: 3 additions & 2 deletions src/ai/backend/manager/models/etcd.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
class CreateContainerRegistryInput(graphene.InputObjectType):
url = graphene.String(required=True)
type = graphene.String(required=True)
project = graphene.String()
project = graphene.List(graphene.String)
username = graphene.String()
password = graphene.String()
ssl_verify = graphene.Boolean()
Expand All @@ -37,7 +37,7 @@ class CreateContainerRegistryInput(graphene.InputObjectType):
class ModifyContainerRegistryInput(graphene.InputObjectType):
url = graphene.String(required=True)
type = graphene.String(required=True)
project = graphene.String()
project = graphene.List(graphene.String)
username = graphene.String()
password = graphene.String()
ssl_verify = graphene.Boolean()
Expand Down Expand Up @@ -68,6 +68,7 @@ class Meta:
@classmethod
def from_row(cls, hostname: str, config: Mapping[str, str | list | None]) -> ContainerRegistry:
return cls(
id=hostname,
hostname=hostname,
config=ContainerRegistryConfig(
url=config.get(""),
Expand Down
20 changes: 10 additions & 10 deletions src/ai/backend/manager/models/resource_policy.py
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ class UserResourcePolicy(graphene.ObjectType):
name = graphene.String(required=True)
created_at = GQLDateTime(required=True)
max_vfolder_count = graphene.Int()
max_vfolder_size = BigInt() # aliased field
max_vfolder_size = BigInt(deprecation_reason="Deprecated since 23.09.1")
max_quota_scope_size = BigInt()

@classmethod
Expand Down Expand Up @@ -482,13 +482,13 @@ async def batch_load_by_user(


class CreateUserResourcePolicyInput(graphene.InputObjectType):
max_vfolder_count = graphene.Int(required=True)
max_quota_scope_size = BigInt(required=True)
max_vfolder_count = graphene.Int()
max_quota_scope_size = BigInt()


class ModifyUserResourcePolicyInput(graphene.InputObjectType):
max_vfolder_count = graphene.Int(required=True)
max_quota_scope_size = BigInt(required=True)
max_vfolder_count = graphene.Int()
max_quota_scope_size = BigInt()


class CreateUserResourcePolicy(graphene.Mutation):
Expand Down Expand Up @@ -586,7 +586,7 @@ class ProjectResourcePolicy(graphene.ObjectType):
name = graphene.String(required=True)
created_at = GQLDateTime(required=True)
max_vfolder_count = graphene.Int()
max_vfolder_size = BigInt() # aliased field
max_vfolder_size = BigInt(deprecation_reason="Deprecated since 23.09.1")
max_quota_scope_size = BigInt()

@classmethod
Expand Down Expand Up @@ -660,13 +660,13 @@ async def batch_load_by_project(


class CreateProjectResourcePolicyInput(graphene.InputObjectType):
max_vfolder_count = graphene.Int(required=True)
max_quota_scope_size = BigInt(required=True)
max_vfolder_count = graphene.Int()
max_quota_scope_size = BigInt()


class ModifyProjectResourcePolicyInput(graphene.InputObjectType):
max_vfolder_count = graphene.Int(required=True)
max_quota_scope_size = BigInt(required=True)
max_vfolder_count = graphene.Int()
max_quota_scope_size = BigInt()


class CreateProjectResourcePolicy(graphene.Mutation):
Expand Down
2 changes: 1 addition & 1 deletion tools/mypy-requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
mypy==1.5.1
mypy==1.6.1
40 changes: 20 additions & 20 deletions tools/mypy.lock
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
// "CPython==3.11.6"
// ],
// "generated_with_requirements": [
// "mypy==1.5.1"
// "mypy==1.6.1"
// ],
// "manylinux": "manylinux2014",
// "requirement_constraints": [],
Expand All @@ -31,43 +31,43 @@
"artifacts": [
{
"algorithm": "sha256",
"hash": "f757063a83970d67c444f6e01d9550a7402322af3557ce7630d3c957386fa8f5",
"url": "https://files.pythonhosted.org/packages/d7/e0/4f80f9d3a7dffb97d7ba3b2eb6b06011d311bfd645727e51b003db482d48/mypy-1.5.1-py3-none-any.whl"
"hash": "4cbe68ef919c28ea561165206a2dcb68591c50f3bcf777932323bc208d949cf1",
"url": "https://files.pythonhosted.org/packages/ae/d8/45d5dd6ebaaa7dd9e56c9530a9293e9cc4536432c162282b43f13f215a87/mypy-1.6.1-py3-none-any.whl"
},
{
"algorithm": "sha256",
"hash": "32cb59609b0534f0bd67faebb6e022fe534bdb0e2ecab4290d683d248be1b275",
"url": "https://files.pythonhosted.org/packages/04/ba/117a7497a714a8a62867e752fd8ba63eeac8e9a46bc9fc24bd85b00c2c84/mypy-1.5.1-cp311-cp311-musllinux_1_1_x86_64.whl"
"hash": "a8032e00ce71c3ceb93eeba63963b864bf635a18f6c0c12da6c13c450eedb183",
"url": "https://files.pythonhosted.org/packages/06/a7/cd6752630a447c3165e69d157a6fe843800b5eafe5a0770744a80a9dca29/mypy-1.6.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl"
},
{
"algorithm": "sha256",
"hash": "b031b9601f1060bf1281feab89697324726ba0c0bae9d7cd7ab4b690940f0b92",
"url": "https://files.pythonhosted.org/packages/33/f9/c84b68e4a754f5ce200dcf0786aa489164fa9d9dee84e375bd7d99caf637/mypy-1.5.1.tar.gz"
"hash": "4c46b51de523817a0045b150ed11b56f9fff55f12b9edd0f3ed35b15a2809de0",
"url": "https://files.pythonhosted.org/packages/40/8a/3767cc0361e849889bc8aac2e77fe2ac733ca05df0437df859ffc5f9a8f3/mypy-1.6.1-cp311-cp311-musllinux_1_1_x86_64.whl"
},
{
"algorithm": "sha256",
"hash": "51cb1323064b1099e177098cb939eab2da42fea5d818d40113957ec954fc85f4",
"url": "https://files.pythonhosted.org/packages/3b/62/e4a096ff55326bddc51f2a532cede2fa2f5d02930e1085aaa4e46bf64dd7/mypy-1.5.1-cp311-cp311-macosx_11_0_arm64.whl"
"hash": "4d01c00d09a0be62a4ca3f933e315455bde83f37f892ba4b08ce92f3cf44bcc1",
"url": "https://files.pythonhosted.org/packages/50/f8/0a8d4d8781b41b445534bc4f9210b7793bf0ab52aacfd06ebd2699663e2c/mypy-1.6.1.tar.gz"
},
{
"algorithm": "sha256",
"hash": "596fae69f2bfcb7305808c75c00f81fe2829b6236eadda536f00610ac5ec2243",
"url": "https://files.pythonhosted.org/packages/66/51/6ef9d704c9d1f2197e2b966d0e50948879b97c6057f2652a9ba28e563c08/mypy-1.5.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl"
"hash": "8c223fa57cb154c7eab5156856c231c3f5eace1e0bed9b32a24696b7ba3c3245",
"url": "https://files.pythonhosted.org/packages/96/82/0c94701afbedce5ec568df2d41a31b9422ea77c50b9c089427a62b300776/mypy-1.6.1-cp311-cp311-macosx_11_0_arm64.whl"
},
{
"algorithm": "sha256",
"hash": "6ac9c21bfe7bc9f7f1b6fae441746e6a106e48fc9de530dea29e8cd37a2c0cc4",
"url": "https://files.pythonhosted.org/packages/f5/e9/0207b4be5f20b15a2a8fc5507941cbf18887c026d21486ad62dd65054dc1/mypy-1.5.1-cp311-cp311-macosx_10_9_x86_64.whl"
"hash": "81af8adaa5e3099469e7623436881eff6b3b06db5ef75e6f5b6d4871263547e5",
"url": "https://files.pythonhosted.org/packages/fd/75/c0a8eee2cc2851b77434e357959e522c9f6d35f8bc637ba42033d25e305f/mypy-1.6.1-cp311-cp311-macosx_10_9_x86_64.whl"
},
{
"algorithm": "sha256",
"hash": "021326f464fd3da2f37d9727bd2fdce249fce38f91a48badf5f9331f4c7d3e74",
"url": "https://media.githubusercontent.com/media/lablup/backend.ai-oven/main/pypi/projects/mypy/mypy-1.5.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl"
"hash": "358af7583228694d746bd86ada7ad0fb2b97bd8303f79db47d6406fbff32690a",
"url": "https://media.githubusercontent.com/media/lablup/backend.ai-oven/main/pypi/projects/mypy/mypy-1.6.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl"
},
{
"algorithm": "sha256",
"hash": "c6f83a0a38d0fa68c593997bb62d7c0cc0b5ded5e74a4885b625fb20cf339b07",
"url": "https://media.githubusercontent.com/media/lablup/backend.ai-oven/main/pypi/projects/mypy/mypy-1.5.1-cp311-cp311-musllinux_1_1_aarch64.whl"
"hash": "b7ee8ad51efbe5ffda8afbe7bd95022b03ee6db5554127bc31daf2b3244824ac",
"url": "https://media.githubusercontent.com/media/lablup/backend.ai-oven/main/pypi/projects/mypy/mypy-1.6.1-cp311-cp311-musllinux_1_1_aarch64.whl"
}
],
"project_name": "mypy",
Expand All @@ -80,7 +80,7 @@
"typing-extensions>=4.1.0"
],
"requires_python": ">=3.8",
"version": "1.5.1"
"version": "1.6.1"
},
{
"artifacts": [
Expand Down Expand Up @@ -123,11 +123,11 @@
}
],
"path_mappings": {},
"pex_version": "2.1.137",
"pex_version": "2.1.148",
"pip_version": "23.1.2",
"prefer_older_binary": false,
"requirements": [
"mypy==1.5.1"
"mypy==1.6.1"
],
"requires_python": [
"==3.11.6"
Expand Down

0 comments on commit aca2579

Please sign in to comment.