MCPcopy
hub / github.com/SwanHubX/SwanLab / list_groups

Function list_groups

swanlab/cli/api/self_hosted.py:170–191  ·  view source on GitHub ↗

List all workspaces in the self-hosted instance.

(page_num: int, page_size: int, fetch_all: bool, search: Optional[str], save_name: str, api: Api)

Source from the content-addressed store, hash-verified

168)
169@with_custom_host
170def list_groups(page_num: int, page_size: int, fetch_all: bool, search: Optional[str], save_name: str, api: Api):
171 """List all workspaces in the self-hosted instance."""
172 sh = api.self_hosted()
173 try:
174 workspaces = list(
175 sh.get_groups(
176 page=page_num,
177 size=page_size,
178 all=fetch_all,
179 search=search,
180 )
181 )
182 except ValueError as e:
183 payload = format_output(ApiResponseType(ok=False, errmsg=str(e)))
184 else:
185 if sh._errors:
186 payload = format_output(ApiResponseType(ok=False, errmsg="; ".join(sh._errors)))
187 else:
188 resp = ApiResponseType(ok=True, data={"list": workspaces})
189 payload = format_output(resp)
190 if save_name is not None:
191 save_output(orjson.dumps(payload, option=orjson.OPT_INDENT_2), name=save_name)

Callers

nothing calls this directly

Calls 6

format_outputFunction · 0.90
ApiResponseTypeClass · 0.90
save_outputFunction · 0.90
self_hostedMethod · 0.80
get_groupsMethod · 0.80
joinMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…