Context API¶
Context API allows the user to get information about the resources available to be requested for a session on the CANFAR Science Platform. This information can be used to configure the session to request the appropriate resources for your
Getting Reosources Information¶
Get context information
from skaha.context import Context
context = Context()
context.resources()
{
"cores": {
"default": 1,
"defaultRequest": 1,
"defaultLimit": 16,
"defaultHeadless": 1,
"options": [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16],
},
"memoryGB": {
"default": 2,
"defaultRequest": 4,
"defaultLimit": 192,
"defaultHeadless": 4,
"options": [1, 2, ..., 192],
},
"gpus": {
"options": [1, ..., 8],
},
}
Bases: SkahaClient
Get available resources from the skaha server.
Source code in skaha/context.py
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
|
resources()
¶
Get available resources from the skaha server.
Returns:
Type | Description |
---|---|
Dict[str, Any]
|
A dictionary of available resources. |
Examples:
>>> from skaha.context import Context
>>> context = Context()
>>> context.resources()
{'cores': {
'default': 1,
'defaultRequest': 1,
'defaultLimit': 16,
'defaultHeadless': 1,
'options': [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]
},
'memoryGB': {
'default': 2,
'defaultRequest': 4,
'defaultLimit': 192,
'defaultHeadless': 4,
'options': [1,2,4...192]
},
'gpus': {
'options': [1,2, ... 28]
}
}
Source code in skaha/context.py
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
|