MCPcopy
hub / github.com/gpustack/gpustack / update

Method update

gpustack/server/services.py:109–124  ·  view source on GitHub ↗
(self, user: User, source: Union[dict, SQLModel, None] = None)

Source from the content-addressed store, hash-verified

107 return result
108
109 async def update(self, user: User, source: Union[dict, SQLModel, None] = None):
110 old_name = user.name
111 result = await user.update(self.session, source, auto_commit=False)
112 # Refresh denormalized ``user_name`` snapshots on usage rows so
113 # dashboards reflect the new name. Bundled in the same
114 # transaction as the user-row write so a rollback rolls back
115 # both. See :func:`propagate_user_rename` for scope notes.
116 if user.name != old_name:
117 await propagate_user_rename(self.session, user.id, user.name)
118 await self.session.commit()
119 await delete_cache_by_key(self.get_by_id, user.id)
120 await delete_cache_by_key(self.get_user_accessible_model_names, user.id)
121 await delete_cache_by_key(self.get_by_username, user.name)
122 if old_name != user.name:
123 await delete_cache_by_key(self.get_by_username, old_name)
124 return result
125
126 async def delete(self, user: User):
127 apikeys = await APIKeyService(self.session).get_by_user_id(user.id)

Callers 15

fake_subscribeFunction · 0.45
_muFunction · 0.45
__init__Method · 0.45
_ueFunction · 0.45
__init__Method · 0.45
create_jwt_tokenMethod · 0.45
_evaluateMethod · 0.45
_schedule_oneMethod · 0.45
__init__Method · 0.45
update_clusterFunction · 0.45

Calls 3

propagate_user_renameFunction · 0.90
delete_cache_by_keyFunction · 0.90
commitMethod · 0.80

Tested by 5

fake_subscribeFunction · 0.36
_muFunction · 0.36
__init__Method · 0.36
_ueFunction · 0.36
__init__Method · 0.36