@@ -100,14 +100,14 @@ class MachineCapability(BaseModel):
100100
101101
102102@lru_cache
103- def get_machine_properties () -> MachineProperties :
103+ async def get_machine_properties () -> MachineProperties :
104104 """Fetch machine properties such as architecture, CPU vendor, ...
105105 These should not change while the supervisor is running.
106106
107107 In the future, some properties may have to be fetched from within a VM.
108108 """
109109
110- cpu_info = get_cpu_info ()
110+ cpu_info = await get_cpu_info ()
111111 return MachineProperties (
112112 cpu = CpuProperties (
113113 architecture = cpu_info ["architecture" ],
@@ -117,9 +117,9 @@ def get_machine_properties() -> MachineProperties:
117117
118118
119119@lru_cache
120- def get_machine_capability () -> MachineCapability :
121- cpu_info = get_cpu_info ()
122- mem_info = get_memory_info ()
120+ async def get_machine_capability () -> MachineCapability :
121+ cpu_info = await get_cpu_info ()
122+ mem_info = await get_memory_info ()
123123
124124 return MachineCapability (
125125 cpu = ExtendedCpuProperties (
@@ -161,15 +161,15 @@ async def about_system_usage(_: web.Request):
161161 start_timestamp = period_start ,
162162 duration_seconds = 60 ,
163163 ),
164- properties = get_machine_properties (),
164+ properties = await get_machine_properties (),
165165 )
166166 return web .json_response (text = usage .json (exclude_none = True ), headers = {"Access-Control-Allow-Origin:" : "*" })
167167
168168
169169async def about_capability (_ : web .Request ):
170170 """Public endpoint to expose information about the CRN capability."""
171171
172- capability : MachineCapability = get_machine_capability ()
172+ capability : MachineCapability = await get_machine_capability ()
173173 return web .json_response (text = capability .json (exclude_none = False ), headers = {"Access-Control-Allow-Origin:" : "*" })
174174
175175
0 commit comments