@pixlcore/xyrun 1.0.1 → 1.0.2

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.
Files changed (2) hide show
  1. package/main.js +11 -11
  2. package/package.json +1 -1
package/main.js CHANGED
@@ -16,6 +16,8 @@ const pkg = require('./package.json');
16
16
  const noop = function() {};
17
17
  const async = Tools.async;
18
18
 
19
+ process.title = "xyRun";
20
+
19
21
  const app = {
20
22
 
21
23
  activeJobs: {},
@@ -436,9 +438,6 @@ const app = {
436
438
 
437
439
  if (!file.path) return; // sanity
438
440
 
439
- // prepend job cwd if path is not absolute
440
- if (!Path.isAbsolute(file.path)) file.path = Path.join(job.cwd, file.path);
441
-
442
441
  if (file.filename) {
443
442
  // if user specified a custom filename, then do not perform a glob
444
443
  to_upload.push(file);
@@ -463,7 +462,7 @@ const app = {
463
462
  // upload all job files (from user) if applicable
464
463
  var self = this;
465
464
  var final_files = [];
466
- var server_id = job.server;
465
+
467
466
  if (!job.files || !job.files.length || !Tools.isaArray(job.files)) return callback();
468
467
 
469
468
  async.eachSeries( job.files,
@@ -503,7 +502,7 @@ const app = {
503
502
  filename: filename,
504
503
  path: json.key,
505
504
  size: json.size,
506
- server: server_id,
505
+ server: job.server,
507
506
  job: job.id
508
507
  });
509
508
 
@@ -567,8 +566,8 @@ const app = {
567
566
  return;
568
567
  }
569
568
 
570
- // update job data
571
- console.log( JSON.stringify({ xy: 1, procs: job.procs, conns: job.conns, cpu: job.cpu, mem: job.mem }) );
569
+ // update job data with stats in tow
570
+ console.log( JSON.stringify({ xy: 1, rpid: process.pid, procs: job.procs, conns: job.conns, cpu: job.cpu, mem: job.mem }) );
572
571
 
573
572
  self.jobTickInProgress = false;
574
573
  }
@@ -579,20 +578,21 @@ const app = {
579
578
  measureJobResources(job, pids) {
580
579
  // scan process list for all processes that are descendents of job pid
581
580
  delete job.procs;
581
+ var root_pid = process.pid;
582
582
 
583
- if (pids[ job.pid ]) {
583
+ if (pids[ root_pid ]) {
584
584
  // add all procs into job
585
585
  job.procs = {};
586
- job.procs[ job.pid ] = pids[ job.pid ];
586
+ job.procs[ root_pid ] = pids[ root_pid ];
587
587
 
588
- var info = pids[ job.pid ];
588
+ var info = pids[ root_pid ];
589
589
  var cpu = info.cpu;
590
590
  var mem = info.memRss;
591
591
 
592
592
  // also consider children of the child (up to 100 generations deep)
593
593
  var levels = 0;
594
594
  var family = {};
595
- family[ job.pid ] = 1;
595
+ family[ root_pid ] = 1;
596
596
 
597
597
  while (Tools.numKeys(family) && (++levels <= 100)) {
598
598
  for (var fpid in family) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pixlcore/xyrun",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "description": "Remote job runner script for xyOps.",
5
5
  "author": "Joseph Huckaby <jhuckaby@pixlcore.com>",
6
6
  "homepage": "https://github.com/pixlcore/xyrun",