@@ -93,6 +93,8 @@ def __init__(self, dir, wallet, netuid):
9393 self .started = asyncio .Event ()
9494
9595 async def __aenter__ (self ):
96+ env = os .environ .copy ()
97+ env ["BT_LOGGING_INFO" ] = "1"
9698 self .process = await asyncio .create_subprocess_exec (
9799 sys .executable ,
98100 f"{ self .dir } /miner.py" ,
@@ -108,15 +110,19 @@ async def __aenter__(self):
108110 self .wallet .name ,
109111 "--wallet.hotkey" ,
110112 "default" ,
111- env = {
112- "BT_LOGGING_INFO" : "1" ,
113- },
113+ env = env ,
114114 stdout = asyncio .subprocess .PIPE ,
115+ stderr = asyncio .subprocess .PIPE ,
115116 )
116117
117118 self .__reader_task = asyncio .create_task (self ._reader ())
118119
119- await asyncio .wait_for (self .started .wait (), 30 )
120+ try :
121+ await asyncio .wait_for (self .started .wait (), 30 )
122+ except asyncio .TimeoutError :
123+ self .process .kill ()
124+ await self .process .wait ()
125+ raise RuntimeError ("Miner failed to start within timeout" )
120126
121127 return self
122128
@@ -142,6 +148,8 @@ def __init__(self, dir, wallet, netuid):
142148 self .set_weights = asyncio .Event ()
143149
144150 async def __aenter__ (self ):
151+ env = os .environ .copy ()
152+ env ["BT_LOGGING_INFO" ] = "1"
145153 self .process = await asyncio .create_subprocess_exec (
146154 sys .executable ,
147155 f"{ self .dir } /validator.py" ,
@@ -157,15 +165,19 @@ async def __aenter__(self):
157165 self .wallet .name ,
158166 "--wallet.hotkey" ,
159167 "default" ,
160- env = {
161- "BT_LOGGING_INFO" : "1" ,
162- },
168+ env = env ,
163169 stdout = asyncio .subprocess .PIPE ,
170+ stderr = asyncio .subprocess .PIPE ,
164171 )
165172
166173 self .__reader_task = asyncio .create_task (self ._reader ())
167174
168- await asyncio .wait_for (self .started .wait (), 60 )
175+ try :
176+ await asyncio .wait_for (self .started .wait (), 30 )
177+ except asyncio .TimeoutError :
178+ self .process .kill ()
179+ await self .process .wait ()
180+ raise RuntimeError ("Validator failed to start within timeout" )
169181
170182 return self
171183
0 commit comments