Context
Bases: SkahaClient
Get available resources from the skaha server.
resources ¶
Get available resources from the skaha server.
Returns:
Type | Description |
---|---|
Dict[str, Any]
|
A dictionary of available resources. |
Examples:
Python Console Session
>>> from skaha.context import Context
>>> context = Context()
>>> context.resources()
{'defaultCores': 2,
'defaultCoresHeadless': 1,
'availableCores': [1, 2, 4, 8, 16],
'defaultRAM': 16,
'defaultRAMHeadless': 4,
'availableRAM': [1, 2, 4, 8, 16, 32, 64, 128, 192],
'availableGPUs': [1,2,3,...],
}
Source code in /home/runner/.cache/pypoetry/virtualenvs/handbook-G9X_rrhO-py3.10/lib/python3.10/site-packages/skaha/context.py
Python
def resources(self) -> Dict[str, Any]:
"""Get available resources from the skaha server.
Returns:
A dictionary of available resources.
Examples:
>>> from skaha.context import Context
>>> context = Context()
>>> context.resources()
{'defaultCores': 2,
'defaultCoresHeadless': 1,
'availableCores': [1, 2, 4, 8, 16],
'defaultRAM': 16,
'defaultRAMHeadless': 4,
'availableRAM': [1, 2, 4, 8, 16, 32, 64, 128, 192],
'availableGPUs': [1,2,3,...],
}
"""
response: Response = self.session.get(url=self.server) # type: ignore
response.raise_for_status()
return response.json()
set_server ¶
Sets the server path after validation.