@@ -157,7 +157,12 @@ impl PyVersion {
157
157
"3.11" => Some ( Py311 ) ,
158
158
"3.12" => Some ( Py312 ) ,
159
159
"3.13" => Some ( Py313 ) ,
160
- _ => None ,
160
+ _ => {
161
+ tracing:: warn!(
162
+ "Cannot convert string (\" {value}\" ) to PyVersion\n Expected format x.yz"
163
+ ) ;
164
+ None
165
+ }
161
166
}
162
167
}
163
168
pub fn from_string_no_dots ( value : & str ) -> Option < Self > {
@@ -168,7 +173,9 @@ impl PyVersion {
168
173
"312" => Some ( Py312 ) ,
169
174
"313" => Some ( Py313 ) ,
170
175
_ => {
171
- tracing:: warn!( "Cannot convert string (\" {value}\" ) to PyVersion" ) ;
176
+ tracing:: warn!(
177
+ "Cannot convert string (\" {value}\" ) to PyVersion\n Expected format xyz"
178
+ ) ;
172
179
None
173
180
}
174
181
}
@@ -212,7 +219,6 @@ impl PyVersion {
212
219
}
213
220
}
214
221
pub async fn install_python (
215
- job_dir : & str ,
216
222
job_id : & Uuid ,
217
223
mem_peak : & mut i32 ,
218
224
// canceled_by: &mut Option<CanceledBy>,
@@ -225,7 +231,7 @@ impl PyVersion {
225
231
append_logs (
226
232
job_id,
227
233
w_id,
228
- format ! ( "\n \n --- INSTALLING PYTHON ({}) --- \n " , version) ,
234
+ format ! ( "\n \n INSTALLING PYTHON ({})" , version) ,
229
235
db,
230
236
)
231
237
. await ;
@@ -248,7 +254,6 @@ impl PyVersion {
248
254
// let v_with_dot = self.to_string_with_dot();
249
255
let mut child_cmd = Command :: new ( UV_PATH . as_str ( ) ) ;
250
256
child_cmd
251
- . current_dir ( job_dir)
252
257
. args ( [
253
258
"python" ,
254
259
"install" ,
@@ -280,7 +285,6 @@ impl PyVersion {
280
285
. await
281
286
}
282
287
async fn get_python_inner (
283
- job_dir : & str ,
284
288
job_id : & Uuid ,
285
289
mem_peak : & mut i32 ,
286
290
// canceled_by: &mut Option<CanceledBy>,
@@ -290,13 +294,12 @@ impl PyVersion {
290
294
occupancy_metrics : & mut Option < & mut OccupancyMetrics > ,
291
295
version : & str ,
292
296
) -> error:: Result < Option < String > > {
293
- let py_path = Self :: find_python ( job_dir , version) . await ;
297
+ let py_path = Self :: find_python ( version) . await ;
294
298
295
- // Python is not installed
299
+ // Runtime is not installed
296
300
if py_path. is_err ( ) {
297
301
// Install it
298
302
if let Err ( err) = Self :: install_python (
299
- job_dir,
300
303
job_id,
301
304
mem_peak,
302
305
db,
@@ -311,7 +314,7 @@ impl PyVersion {
311
314
return Err ( err) ;
312
315
} else {
313
316
// Try to find one more time
314
- let py_path = Self :: find_python ( job_dir , version) . await ;
317
+ let py_path = Self :: find_python ( version) . await ;
315
318
316
319
if let Err ( err) = py_path {
317
320
tracing:: error!( "Cannot find python version {err}" ) ;
@@ -327,7 +330,6 @@ impl PyVersion {
327
330
}
328
331
pub async fn get_python (
329
332
& self ,
330
- job_dir : & str ,
331
333
job_id : & Uuid ,
332
334
mem_peak : & mut i32 ,
333
335
// canceled_by: &mut Option<CanceledBy>,
@@ -341,7 +343,6 @@ impl PyVersion {
341
343
// }
342
344
343
345
let res = Self :: get_python_inner (
344
- job_dir,
345
346
job_id,
346
347
mem_peak,
347
348
db,
@@ -360,12 +361,12 @@ impl PyVersion {
360
361
}
361
362
res
362
363
}
363
- async fn find_python ( job_dir : & str , version : & str ) -> error:: Result < Option < String > > {
364
+ async fn find_python ( version : & str ) -> error:: Result < Option < String > > {
364
365
// let mut logs = String::new();
365
366
// let v_with_dot = self.to_string_with_dot();
366
367
let mut child_cmd = Command :: new ( UV_PATH . as_str ( ) ) ;
367
368
let output = child_cmd
368
- . current_dir ( job_dir)
369
+ // .current_dir(job_dir)
369
370
. args ( [
370
371
"python" ,
371
372
"find" ,
@@ -880,7 +881,6 @@ pub async fn handle_python_job(
880
881
PYTHON_PATH . clone ( )
881
882
} else if let Some ( python_path) = py_version
882
883
. get_python (
883
- job_dir,
884
884
& job. id ,
885
885
mem_peak,
886
886
db,
@@ -2085,15 +2085,7 @@ pub async fn handle_python_reqs(
2085
2085
None
2086
2086
} else {
2087
2087
py_version
2088
- . get_python (
2089
- & job_dir,
2090
- job_id,
2091
- mem_peak,
2092
- db,
2093
- _worker_name,
2094
- w_id,
2095
- _occupancy_metrics,
2096
- )
2088
+ . get_python ( job_id, mem_peak, db, _worker_name, w_id, _occupancy_metrics)
2097
2089
. await ?
2098
2090
} ;
2099
2091
0 commit comments