pinokiod 3.2.207 → 3.2.208
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/kernel/api/index.js +14 -0
- package/kernel/bin/conda.js +1 -0
- package/kernel/index.js +56 -3
- package/kernel/shell.js +16 -11
- package/package.json +1 -1
- package/server/index.js +5 -1
package/kernel/api/index.js
CHANGED
|
@@ -551,6 +551,7 @@ class Api {
|
|
|
551
551
|
memory.next = null
|
|
552
552
|
}
|
|
553
553
|
|
|
554
|
+
|
|
554
555
|
this.state = memory
|
|
555
556
|
this.executing = request
|
|
556
557
|
// get fully resolved env
|
|
@@ -558,6 +559,10 @@ class Api {
|
|
|
558
559
|
// set template
|
|
559
560
|
this.kernel.template.update({ envs: env, env })
|
|
560
561
|
|
|
562
|
+
this.kernel.memory.rpc[request.path] = rawrpc
|
|
563
|
+
this.kernel.memory.args[request.path] = args
|
|
564
|
+
this.kernel.memory.input[request.path] = input
|
|
565
|
+
|
|
561
566
|
// render until `{{ }}` pattern does not exist
|
|
562
567
|
// 1. render once
|
|
563
568
|
let rpc = rawrpc
|
|
@@ -623,6 +628,12 @@ class Api {
|
|
|
623
628
|
|
|
624
629
|
rpc.args = args
|
|
625
630
|
|
|
631
|
+
this.kernel.memory.rpc[request.path].current = rpc.current
|
|
632
|
+
this.kernel.memory.rpc[request.path].total = rpc.total
|
|
633
|
+
|
|
634
|
+
// this.kernel.memory.rpc[request.path] = rpc
|
|
635
|
+
// this.kernel.memory.args[request.path] = args
|
|
636
|
+
|
|
626
637
|
if (rpc.hasOwnProperty("next")) {
|
|
627
638
|
console.log("next already exists, don't touch", rpc.next)
|
|
628
639
|
if (typeof rpc.next === "string") {
|
|
@@ -675,6 +686,9 @@ class Api {
|
|
|
675
686
|
} else {
|
|
676
687
|
// no next rpc to execute. Finish
|
|
677
688
|
this.kernel.memory.local[request.path] = {}
|
|
689
|
+
this.kernel.memory.rpc[request.path] = null
|
|
690
|
+
this.kernel.memory.input[request.path] = null
|
|
691
|
+
this.kernel.memory.args[request.path] = null
|
|
678
692
|
this.ondata({
|
|
679
693
|
id: request.path,
|
|
680
694
|
type: "event",
|
package/kernel/bin/conda.js
CHANGED
package/kernel/index.js
CHANGED
|
@@ -227,19 +227,69 @@ class Kernel {
|
|
|
227
227
|
let info = this.sysinfo
|
|
228
228
|
await this.update_sysinfo()
|
|
229
229
|
let i = {
|
|
230
|
+
version: this.version,
|
|
230
231
|
platform: this.platform,
|
|
231
232
|
arch: this.arch,
|
|
232
|
-
running: this.api.running,
|
|
233
233
|
home: this.homedir,
|
|
234
|
+
scripts: [],
|
|
235
|
+
shells: this.shell.shells.map(({ cols, rows, id, group, path, index, cmd, done }) => {
|
|
236
|
+
return { cols, rows, id, group, path, index, cmd, done }
|
|
237
|
+
}),
|
|
238
|
+
proxies: [],
|
|
234
239
|
vars: this.vars,
|
|
235
240
|
memory: this.memory,
|
|
236
241
|
procs: this.procs,
|
|
237
242
|
gpu: this.gpu,
|
|
238
243
|
gpus: this.gpus,
|
|
239
|
-
version: this.version,
|
|
240
244
|
...info
|
|
241
245
|
}
|
|
242
246
|
|
|
247
|
+
// user-friendly running
|
|
248
|
+
/*
|
|
249
|
+
running :- {
|
|
250
|
+
<relative_path>: {
|
|
251
|
+
step: <current_step>,
|
|
252
|
+
path: <full_path>,
|
|
253
|
+
app: <app_name>,
|
|
254
|
+
args: <args>,
|
|
255
|
+
local: {
|
|
256
|
+
<key>: <val>
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
*/
|
|
261
|
+
let running = this.api.running
|
|
262
|
+
for(let full_path in running) {
|
|
263
|
+
let relative_path = path.relative(this.api.userdir, full_path)
|
|
264
|
+
let app = relative_path.split(path.sep)[0]
|
|
265
|
+
let app_path = path.resolve(this.api.userdir, app)
|
|
266
|
+
let script_path = path.relative(app_path, full_path)
|
|
267
|
+
let args = i.memory.args[full_path]
|
|
268
|
+
let rpc = i.memory.rpc[full_path]
|
|
269
|
+
let input = i.memory.input[full_path]
|
|
270
|
+
let local = i.memory.local[full_path]
|
|
271
|
+
i.scripts.push({
|
|
272
|
+
path: relative_path, app, script_path, step: rpc, input, args, local, full_path,
|
|
273
|
+
})
|
|
274
|
+
}
|
|
275
|
+
for(let full_path in this.api.proxies) {
|
|
276
|
+
let relative_path = path.relative(this.api.userdir, full_path)
|
|
277
|
+
let app = relative_path.split(path.sep)[0]
|
|
278
|
+
let app_path = path.resolve(this.api.userdir, app)
|
|
279
|
+
let script_path = path.relative(app_path, full_path)
|
|
280
|
+
let proxies = this.api.proxies[full_path]
|
|
281
|
+
for(let proxy of proxies) {
|
|
282
|
+
i.proxies.push({
|
|
283
|
+
path: relative_path,
|
|
284
|
+
app,
|
|
285
|
+
script_path,
|
|
286
|
+
full_path,
|
|
287
|
+
...proxy
|
|
288
|
+
})
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
this.api.proxies,
|
|
292
|
+
|
|
243
293
|
this.i = i
|
|
244
294
|
}
|
|
245
295
|
|
|
@@ -323,7 +373,10 @@ class Kernel {
|
|
|
323
373
|
global: {},
|
|
324
374
|
key: (host) => {
|
|
325
375
|
return this.keys[host]
|
|
326
|
-
}
|
|
376
|
+
},
|
|
377
|
+
rpc: {},
|
|
378
|
+
input: {},
|
|
379
|
+
args: {},
|
|
327
380
|
}
|
|
328
381
|
this.procs = {}
|
|
329
382
|
this.template = new Template()
|
package/kernel/shell.js
CHANGED
|
@@ -537,7 +537,12 @@ class Shell {
|
|
|
537
537
|
|
|
538
538
|
// 2. conda_activation
|
|
539
539
|
|
|
540
|
-
|
|
540
|
+
let timeout
|
|
541
|
+
if (this.platform === "win32") {
|
|
542
|
+
timeout = 'C:\\Windows\\System32\\timeout /t 1 > nul'
|
|
543
|
+
} else {
|
|
544
|
+
timeout = 'sleep 1'
|
|
545
|
+
}
|
|
541
546
|
|
|
542
547
|
let conda_activation = []
|
|
543
548
|
if (conda_activate) {
|
|
@@ -560,9 +565,9 @@ class Shell {
|
|
|
560
565
|
`conda deactivate`,
|
|
561
566
|
`conda deactivate`,
|
|
562
567
|
`conda deactivate`,
|
|
563
|
-
|
|
568
|
+
timeout,
|
|
564
569
|
`conda activate ${env_path}`,
|
|
565
|
-
|
|
570
|
+
timeout,
|
|
566
571
|
]
|
|
567
572
|
} else {
|
|
568
573
|
conda_activation = [
|
|
@@ -571,9 +576,9 @@ class Shell {
|
|
|
571
576
|
`conda deactivate`,
|
|
572
577
|
`conda deactivate`,
|
|
573
578
|
`conda deactivate`,
|
|
574
|
-
|
|
579
|
+
timeout,
|
|
575
580
|
`conda activate ${env_path}`,
|
|
576
|
-
|
|
581
|
+
timeout,
|
|
577
582
|
]
|
|
578
583
|
}
|
|
579
584
|
} else if (conda_name) {
|
|
@@ -583,9 +588,9 @@ class Shell {
|
|
|
583
588
|
`conda deactivate`,
|
|
584
589
|
`conda deactivate`,
|
|
585
590
|
`conda deactivate`,
|
|
586
|
-
|
|
591
|
+
timeout,
|
|
587
592
|
`conda activate ${conda_name}`,
|
|
588
|
-
|
|
593
|
+
timeout,
|
|
589
594
|
]
|
|
590
595
|
} else {
|
|
591
596
|
let envs_path = this.kernel.bin.path("miniconda/envs")
|
|
@@ -597,9 +602,9 @@ class Shell {
|
|
|
597
602
|
`conda deactivate`,
|
|
598
603
|
`conda deactivate`,
|
|
599
604
|
`conda deactivate`,
|
|
600
|
-
|
|
605
|
+
timeout,
|
|
601
606
|
`conda activate ${conda_name}`,
|
|
602
|
-
|
|
607
|
+
timeout,
|
|
603
608
|
]
|
|
604
609
|
} else {
|
|
605
610
|
conda_activation = [
|
|
@@ -608,9 +613,9 @@ class Shell {
|
|
|
608
613
|
`conda deactivate`,
|
|
609
614
|
`conda deactivate`,
|
|
610
615
|
`conda deactivate`,
|
|
611
|
-
|
|
616
|
+
timeout,
|
|
612
617
|
`conda activate ${conda_name}`,
|
|
613
|
-
|
|
618
|
+
timeout,
|
|
614
619
|
]
|
|
615
620
|
}
|
|
616
621
|
}
|
package/package.json
CHANGED
package/server/index.js
CHANGED
|
@@ -3080,7 +3080,11 @@ class Server {
|
|
|
3080
3080
|
console.time("getInfo")
|
|
3081
3081
|
await this.kernel.getInfo()
|
|
3082
3082
|
console.timeEnd("getInfo")
|
|
3083
|
-
|
|
3083
|
+
let info = Object.assign({}, this.kernel.i)
|
|
3084
|
+
delete info.vars
|
|
3085
|
+
delete info.shell_env
|
|
3086
|
+
delete info.memory
|
|
3087
|
+
res.json(info)
|
|
3084
3088
|
}))
|
|
3085
3089
|
this.app.get("/pinokio/port", ex(async (req, res) => {
|
|
3086
3090
|
let port = await this.kernel.port()
|