pinokiod 3.2.206 → 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.
@@ -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",
@@ -61,14 +61,15 @@ class Conda {
61
61
  //
62
62
  if (this.kernel.homedir) {
63
63
  // let exists = await this.kernel.exists("condarc")
64
+ console.log("condarc init")
64
65
  // if (!exists) {
65
66
  await fs.promises.writeFile(this.kernel.path('condarc'), `channels:
66
67
  - conda-forge
67
68
  - defaults
68
69
  create_default_packages:
69
70
  - python=3.10
70
- remote_connect_timeout_secs: 20
71
- remote_read_timeout_secs: 300
71
+ remote_connect_timeout_secs: 20.0
72
+ remote_read_timeout_secs: 300.0
72
73
  remote_max_retries: 6
73
74
  repodata_threads: 4
74
75
  fetch_threads: 5
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
- const timeout = "C:\\Windows\\System32\\timeout"
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
- (this.platform === 'win32' ? `${timeout} /t 1 > nul` : 'sleep 1'),
568
+ timeout,
564
569
  `conda activate ${env_path}`,
565
- (this.platform === 'win32' ? `${timeout} /t 1 > nul` : 'sleep 1'),
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
- (this.platform === 'win32' ? `${timeout} /t 1 > nul` : 'sleep 1'),
579
+ timeout,
575
580
  `conda activate ${env_path}`,
576
- (this.platform === 'win32' ? `${timeout} /t 1 > nul` : 'sleep 1'),
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
- (this.platform === 'win32' ? `${timeout} /t 1 > nul` : 'sleep 1'),
591
+ timeout,
587
592
  `conda activate ${conda_name}`,
588
- (this.platform === 'win32' ? `${timeout} /t 1 > nul` : 'sleep 1'),
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
- (this.platform === 'win32' ? `${timeout} /t 1 > nul` : 'sleep 1'),
605
+ timeout,
601
606
  `conda activate ${conda_name}`,
602
- (this.platform === 'win32' ? `${timeout} /t 1 > nul` : 'sleep 1'),
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
- (this.platform === 'win32' ? `${timeout} /t 1 > nul` : 'sleep 1'),
616
+ timeout,
612
617
  `conda activate ${conda_name}`,
613
- (this.platform === 'win32' ? `${timeout} /t 1 > nul` : 'sleep 1'),
618
+ timeout,
614
619
  ]
615
620
  }
616
621
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pinokiod",
3
- "version": "3.2.206",
3
+ "version": "3.2.208",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
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
- res.json(this.kernel.i || {})
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()