Skip to content
This repository was archived by the owner on Sep 22, 2023. It is now read-only.

Commit 2442022

Browse files
committed
Add API for dissociating scaling groups from a group
1 parent f7bb503 commit 2442022

File tree

2 files changed

+26
-1
lines changed

2 files changed

+26
-1
lines changed

src/ai/backend/client/group.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ async def create(cls, domain_name: str, name: str, description: str = '',
9494
You need an admin privilege for this operation.
9595
'''
9696
if fields is None:
97-
fields = ('domain_name', 'name',)
97+
fields = ('id', 'domain_name', 'name',)
9898
query = textwrap.dedent('''\
9999
mutation($name: String!, $input: GroupInput!) {
100100
create_group(name: $name, props: $input) {

src/ai/backend/client/scaling_group.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -330,3 +330,28 @@ async def dissociate_group(cls, scaling_group: str, group_id: str):
330330
async with rqst.fetch() as resp:
331331
data = await resp.json()
332332
return data['disassociate_scaling_group_with_user_group']
333+
334+
@api_function
335+
@classmethod
336+
async def dissociate_all_group(cls, group_id: str):
337+
'''
338+
Dissociate all scaling_groups from group.
339+
340+
:param group_id: The ID of a group.
341+
'''
342+
query = textwrap.dedent('''\
343+
mutation($domain: String!) {
344+
disassociate_all_scaling_groups_with_group(group_id: $group_id) {
345+
ok msg
346+
}
347+
}
348+
''')
349+
variables = {'group_id': group_id}
350+
rqst = Request(cls.session, 'POST', '/admin/graphql')
351+
rqst.set_json({
352+
'query': query,
353+
'variables': variables,
354+
})
355+
async with rqst.fetch() as resp:
356+
data = await resp.json()
357+
return data['disassociate_all_scaling_groups_with_group']

0 commit comments

Comments
 (0)