@@ -32,6 +32,20 @@ import {
32
32
} from "./pool-params" ;
33
33
import { getAbsolutePathFromHome } from "@cocalc/jupyter/util/fs" ;
34
34
35
+ // any kernel name whose lowercase representation contains one of these strings
36
+ // will never use the pool. See https://github.com/sagemathinc/cocalc/issues/7041
37
+ const BLACKLIST = [ "julia" ] ;
38
+
39
+ function isBlacklisted ( kernel : string ) {
40
+ const s = kernel . toLowerCase ( ) ;
41
+ for ( const n of BLACKLIST ) {
42
+ if ( s . includes ( n ) ) {
43
+ return true ;
44
+ }
45
+ }
46
+ return false ;
47
+ }
48
+
35
49
export type { LaunchJupyterOpts , SpawnedKernel } ;
36
50
37
51
const log = getLogger ( "jupyter:pool" ) ;
@@ -71,10 +85,14 @@ export default async function launchJupyterKernel(
71
85
name : string , // name of the kernel
72
86
opts : LaunchJupyterOpts ,
73
87
size_arg ?: number , // min number of these in the pool
74
- timeout_s_arg ?: number
88
+ timeout_s_arg ?: number ,
75
89
) : Promise < SpawnedKernel > {
76
90
const size : number = size_arg ?? getSize ( ) ;
77
91
const timeout_s : number = timeout_s_arg ?? getTimeoutS ( ) ;
92
+ if ( isBlacklisted ( name ) ) {
93
+ log . debug ( `not using kernel pool for ${ name } because it is blacklisted` ) ;
94
+ return await launchJupyterKernelNoPool ( name , opts ) ;
95
+ }
78
96
let language ;
79
97
try {
80
98
language = await getLanguage ( name ) ;
@@ -99,8 +117,8 @@ export default async function launchJupyterKernel(
99
117
createSetenvCommand (
100
118
language ,
101
119
"COCALC_JUPYTER_FILENAME" ,
102
- opts . env . COCALC_JUPYTER_FILENAME
103
- )
120
+ opts . env . COCALC_JUPYTER_FILENAME ,
121
+ ) ,
104
122
) ;
105
123
} catch ( error ) {
106
124
log . error ( "Failed to get setenv command -- not using pool" , error ) ;
@@ -138,6 +156,15 @@ export default async function launchJupyterKernel(
138
156
// pool could end up a little too big.
139
157
const replenishPool = reuseInFlight (
140
158
async ( key : string , size_arg ?: number , timeout_s_arg ?: number ) => {
159
+ const { name, opts } = JSON . parse ( key ) ;
160
+ if ( isBlacklisted ( name ) ) {
161
+ log . debug (
162
+ "replenishPool" ,
163
+ key ,
164
+ ` -- skipping since ${ name } is blacklisted` ,
165
+ ) ;
166
+ return ;
167
+ }
141
168
const size : number = size_arg ?? getSize ( ) ;
142
169
const timeout_s : number = timeout_s_arg ?? getTimeoutS ( ) ;
143
170
log . debug ( "replenishPool" , key , { size, timeout_s } ) ;
@@ -149,7 +176,6 @@ const replenishPool = reuseInFlight(
149
176
while ( pool . length < size ) {
150
177
log . debug ( "replenishPool - creating a kernel" , key ) ;
151
178
writeConfig ( key ) ;
152
- const { name, opts } = JSON . parse ( key ) ;
153
179
await delay ( getLaunchDelayMS ( ) ) ;
154
180
const kernel = await launchJupyterKernelNoPool ( name , opts ) ;
155
181
pool . push ( kernel ) ;
@@ -162,7 +188,7 @@ const replenishPool = reuseInFlight(
162
188
} ,
163
189
{
164
190
createKey : ( args ) => args [ 0 ] ,
165
- }
191
+ } ,
166
192
) ;
167
193
168
194
/*
@@ -251,7 +277,7 @@ export async function killKernel(kernel: SpawnedKernel) {
251
277
} catch ( error ) {
252
278
log . error (
253
279
`Failed to delete Jupyter kernel connection file ${ kernel . connectionFile } ` ,
254
- error
280
+ error ,
255
281
) ;
256
282
}
257
283
}
0 commit comments