From c5b4d99f7459db8a04a41884e80b32c14ef470ae Mon Sep 17 00:00:00 2001 From: kawing-ho Date: Wed, 9 Jan 2019 13:14:22 +1100 Subject: [PATCH 01/30] mapped spawn() --- src/util/child.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/util/child.js b/src/util/child.js index e83b819745..6018eec6bd 100644 --- a/src/util/child.js +++ b/src/util/child.js @@ -58,6 +58,7 @@ type ProcessFn = ( done: () => void, ) => void; +/* [STEMN]: Trace for subprocesses ie. script files */ export function spawn( program: string, args: Array, From 8f075338eac4a2264c9bce6ab5496cbf99b4b59a Mon Sep 17 00:00:00 2001 From: kawing-ho Date: Wed, 9 Jan 2019 13:20:56 +1100 Subject: [PATCH 02/30] mapped execCommand() --- src/util/execute-lifecycle-script.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/util/execute-lifecycle-script.js b/src/util/execute-lifecycle-script.js index aae9a2d09d..195b1a0a6d 100644 --- a/src/util/execute-lifecycle-script.js +++ b/src/util/execute-lifecycle-script.js @@ -357,6 +357,11 @@ export async function execCommand({ }): Promise { const {reporter} = config; try { + /* [STEMN]: Trace execCommand start execution time */ + + + + reporter.command(cmd); await executeLifecycleScript({stage, config, cwd, cmd, isInteractive, customShell}); return Promise.resolve(); @@ -370,5 +375,6 @@ export async function execCommand({ } else { throw err; } + /* [STEMN]: Trace execCommand finish exeuction time */ } } From f78ee09e34045e183c923cf94395806a8d094f4f Mon Sep 17 00:00:00 2001 From: kawing-ho Date: Wed, 9 Jan 2019 13:36:08 +1100 Subject: [PATCH 03/30] mapped index.js => main() --- src/cli/index.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/cli/index.js b/src/cli/index.js index a4b307d57a..0608dff8bf 100644 --- a/src/cli/index.js +++ b/src/cli/index.js @@ -41,6 +41,7 @@ function findProjectRoot(base: string): string { return base; } +/* [STEMN]: main function here (multiple threads executed) */ export async function main({ startArgs, args, @@ -244,7 +245,9 @@ export async function main({ const config = new Config(reporter); const outputWrapperEnabled = boolifyWithDefault(process.env.YARN_WRAP_OUTPUT, true); - const shouldWrapOutput = outputWrapperEnabled && !commander.json && command.hasWrapper(commander, commander.args); + const shouldWrapOutpu = outputWrapperEnabled && !commander.json && command.hasWrapper(commander, commander.args); + + if (shouldWrapOutput) { reporter.header(commandName, {name: 'yarn', version}); @@ -283,6 +286,10 @@ export async function main({ if (shouldWrapOutput) { reporter.footer(false); } + + /* [STEMN]: Possible hook here for exitCode conditional code */ + + return exitCode; }); }; @@ -478,6 +485,8 @@ export async function main({ if (errorReportLoc) { reporter.info(reporter.lang('bugReport', errorReportLoc)); } + + /* [STEMN]: Warn in logs about unexpected error -> inconsistencies */ } function writeErrorReport(log): ?string { From 112816917e8233b3289adc0effb34e90a8c93175 Mon Sep 17 00:00:00 2001 From: kawing-ho Date: Wed, 9 Jan 2019 13:41:36 +1100 Subject: [PATCH 04/30] mapped header()/footer() --- src/reporters/console/console-reporter.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/reporters/console/console-reporter.js b/src/reporters/console/console-reporter.js index 0fe162788c..775dc0cf89 100644 --- a/src/reporters/console/console-reporter.js +++ b/src/reporters/console/console-reporter.js @@ -159,10 +159,12 @@ export default class ConsoleReporter extends BaseReporter { } } + /* [STEMN]: header reporter. Hook to clean logs */ header(command: string, pkg: Package) { this.log(this.format.bold(`${pkg.name} ${command} v${pkg.version}`)); } +/* [STEMN]: footer reporter. Hook to do log post-processing */ footer(showPeakMemory?: boolean) { this.stopProgress(); From cba4da999b025c03b8f955d16c7afd53e05b5ab5 Mon Sep 17 00:00:00 2001 From: kawing-ho Date: Wed, 9 Jan 2019 14:55:07 +1100 Subject: [PATCH 05/30] added new logging file and imported in relevant files --- src/cli/index.js | 4 ++++ src/cli/logging.js | 18 ++++++++++++++++++ src/reporters/console/console-reporter.js | 3 +++ src/util/child.js | 3 +++ src/util/execute-lifecycle-script.js | 3 +++ 5 files changed, 31 insertions(+) create mode 100644 src/cli/logging.js diff --git a/src/cli/index.js b/src/cli/index.js index 0608dff8bf..c789fb9c41 100644 --- a/src/cli/index.js +++ b/src/cli/index.js @@ -25,6 +25,9 @@ import {version} from '../util/yarn-version.js'; import handleSignals from '../util/signal-handler.js'; import {boolify, boolifyWithDefault} from '../util/conversion.js'; +// STEMN import +import {benchmark, debugging} from './logging.js'; + function findProjectRoot(base: string): string { let prev = null; let dir = base; @@ -487,6 +490,7 @@ export async function main({ } /* [STEMN]: Warn in logs about unexpected error -> inconsistencies */ + debug(">>>>>>>> WARNING: LOGS MAY BE INCONSISTENT DUE TO ERROR <<<<<<<<\n"); } function writeErrorReport(log): ?string { diff --git a/src/cli/logging.js b/src/cli/logging.js new file mode 100644 index 0000000000..cbf2247219 --- /dev/null +++ b/src/cli/logging.js @@ -0,0 +1,18 @@ +import * as fs from '../../src/util/fs.js'; + +// outputs a string to the main CSV file +export function benchmark(str: string) { + let log_location = "/stemn/yarn/yarn.csv" + fs.appendFileSync(log_location, str, function(err){if (err) throw err;}); +} + +// outputs a string to the debugging log file +export function debug(str: string) { + let log_location = "/stemn/yarn/debug.log" + fs.appendFileSync(log_location, str, function(err){if (err) throw err;}); +} + +/* + Other writes performed: + -> header: truncate files +*/ diff --git a/src/reporters/console/console-reporter.js b/src/reporters/console/console-reporter.js index 775dc0cf89..fe82f635ca 100644 --- a/src/reporters/console/console-reporter.js +++ b/src/reporters/console/console-reporter.js @@ -22,6 +22,9 @@ import {sortTrees, recurseTree, getFormattedOutput} from './helpers/tree-helper. import inquirer from 'inquirer'; import Table from 'cli-table3'; +// STEMN import +import {benchmark, debug} from '../../cli/logging.js'; + const {inspect} = require('util'); const readline = require('readline'); const chalk = require('chalk'); diff --git a/src/util/child.js b/src/util/child.js index 6018eec6bd..6869d45e1e 100644 --- a/src/util/child.js +++ b/src/util/child.js @@ -6,6 +6,9 @@ import BlockingQueue from './blocking-queue.js'; import {ProcessSpawnError, ProcessTermError} from '../errors.js'; import {promisify} from './promise.js'; +// STEMN import +import {benchmark, debug} from '../cli/logging.js'; + const child = require('child_process'); export const queue = new BlockingQueue('child', constants.CHILD_CONCURRENCY); diff --git a/src/util/execute-lifecycle-script.js b/src/util/execute-lifecycle-script.js index 195b1a0a6d..4abfd7a307 100644 --- a/src/util/execute-lifecycle-script.js +++ b/src/util/execute-lifecycle-script.js @@ -11,6 +11,9 @@ import {registries} from '../resolvers/index.js'; import {fixCmdWinSlashes} from './fix-cmd-win-slashes.js'; import {getBinFolder as getGlobalBinFolder, run as globalRun} from '../cli/commands/global.js'; +// STEMN import +import {benchmark, debug} from '../cli/logging.js'; + const path = require('path'); export type LifecycleReturn = Promise<{ From 49b086783335ce6c83244b7d9adf9c861a19976e Mon Sep 17 00:00:00 2001 From: kawing-ho Date: Wed, 9 Jan 2019 05:07:34 +0000 Subject: [PATCH 06/30] missing t --- src/cli/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cli/index.js b/src/cli/index.js index c789fb9c41..9b6a66b2c7 100644 --- a/src/cli/index.js +++ b/src/cli/index.js @@ -248,7 +248,7 @@ export async function main({ const config = new Config(reporter); const outputWrapperEnabled = boolifyWithDefault(process.env.YARN_WRAP_OUTPUT, true); - const shouldWrapOutpu = outputWrapperEnabled && !commander.json && command.hasWrapper(commander, commander.args); + const shouldWrapOutput = outputWrapperEnabled && !commander.json && command.hasWrapper(commander, commander.args); From 1d514a1060c6d4d2061c50e718dae9da0f13a6e3 Mon Sep 17 00:00:00 2001 From: kawing-ho Date: Thu, 10 Jan 2019 13:51:59 +1100 Subject: [PATCH 07/30] intermeddiate push --- src/cli/logging.js | 6 ++-- src/reporters/console/console-reporter.js | 16 +++++++++ src/util/child.js | 41 +++++++++++++++++++++++ src/util/execute-lifecycle-script.js | 38 +++++++++++++++++++-- 4 files changed, 97 insertions(+), 4 deletions(-) diff --git a/src/cli/logging.js b/src/cli/logging.js index cbf2247219..83709b1ae2 100644 --- a/src/cli/logging.js +++ b/src/cli/logging.js @@ -1,4 +1,4 @@ -import * as fs from '../../src/util/fs.js'; +const fs = require('fs'); // outputs a string to the main CSV file export function benchmark(str: string) { @@ -14,5 +14,7 @@ export function debug(str: string) { /* Other writes performed: - -> header: truncate files + -> src/reporters/console/console-rpeorter.js + -> Header (truncating log file) + -> Footer (post-process log(s)) */ diff --git a/src/reporters/console/console-reporter.js b/src/reporters/console/console-reporter.js index fe82f635ca..11797e7515 100644 --- a/src/reporters/console/console-reporter.js +++ b/src/reporters/console/console-reporter.js @@ -24,6 +24,7 @@ import Table from 'cli-table3'; // STEMN import import {benchmark, debug} from '../../cli/logging.js'; +const fs = require('fs'); const {inspect} = require('util'); const readline = require('readline'); @@ -165,6 +166,21 @@ export default class ConsoleReporter extends BaseReporter { /* [STEMN]: header reporter. Hook to clean logs */ header(command: string, pkg: Package) { this.log(this.format.bold(`${pkg.name} ${command} v${pkg.version}`)); + +/* + require("fs").writeFile('', '', function(){}) + require("fs").writeFile('/tmp/logfile', '', function(){}) + + // we perform our own reporting + this._logCategory('STEMN', 'magenta', "Cleaning logs of previous run..."); + this._logCategory('STEMN', 'magenta', "Truncating and preparing log file..."); + + var csv_header = "PID,Command,Timestamp,Duration,PWD\n"; + require("fs").writeFileSync("/tmp/logfile", csv_header, function (err) { + if (err) throw err; + }); +*/ + } /* [STEMN]: footer reporter. Hook to do log post-processing */ diff --git a/src/util/child.js b/src/util/child.js index 6869d45e1e..ef44b55264 100644 --- a/src/util/child.js +++ b/src/util/child.js @@ -76,6 +76,23 @@ export function spawn( const proc = child.spawn(program, args, opts); spawnedProcesses[key] = proc; + let first_timestamp = (new Date() / 1000); + let trace = ""; + + // if we ever decide to do parent-child relationships + // trace += `${process.ppid } spawned ${process.pid} spawned ${proc.pid}` + + trace += `[${proc.pid}]\t`; + trace += `[${program}]\t`; + trace += `[${key}]\n`; + trace += args; + trace += "\n"; + + // only log it if the subprocess has ".sh" + if(program.indexOf(".sh") > -1) { + debug(trace); + } + let processingDone = false; let processClosed = false; let err = null; @@ -99,6 +116,30 @@ export function spawn( function finish() { delete spawnedProcesses[key]; + + + /* [STEMN]: Trace script when finishing execution */ + let final_timestamp = ((new Date() / 1000) - first_timestamp).toFixed(3); + let trace = ""; + trace += `[${proc.pid}] `; + trace += `${program} `; + trace += `(Finished: ${final_timestamp}s). \n`; + + // only log it if the subprocess has ".sh" + if(program.indexOf(".sh") > -1) { + debug(trace); + + // Add the finished process to the stack for printing + let csv_line = ""; + csv_line += `${proc.pid},`; + csv_line += `\"${program}\",` + csv_line += `${first_timestamp},` + csv_line += `${final_timestamp},` + csv_line += `\"${key}\"\n`; + + benchmark(csv_line); + } + if (err) { reject(err); } else { diff --git a/src/util/execute-lifecycle-script.js b/src/util/execute-lifecycle-script.js index 4abfd7a307..38127dbbee 100644 --- a/src/util/execute-lifecycle-script.js +++ b/src/util/execute-lifecycle-script.js @@ -360,10 +360,18 @@ export async function execCommand({ }): Promise { const {reporter} = config; try { - /* [STEMN]: Trace execCommand start execution time */ + /* [STEMN]: Trace execCommand start execution time */ + let first_timestamp = (new Date() / 1000).toFixed(3); + let trace = ""; + trace += `[${process.pid}] `; + trace += `|BEGIN|\t\t`; + trace += `${first_timestamp}\t`; + trace += `[${stage}]\t\t\t`; + trace += `[${cwd}]\n`; + debug(trace); reporter.command(cmd); await executeLifecycleScript({stage, config, cwd, cmd, isInteractive, customShell}); @@ -378,6 +386,32 @@ export async function execCommand({ } else { throw err; } - /* [STEMN]: Trace execCommand finish exeuction time */ } +} finally { + + /* [STEMN]: Trace execCommand finish exeuction time */ + + //var trace = `[${process.ppid}]->[${process.pid}][${process.uptime()}] >END<` + + let final_timestamp = ((new Date() / 1000) - first_timestamp).toFixed(3); + let trace = ""; + trace += `[${process.pid}]`; + trace += `[${process.uptime()}] `; + trace += `>END<\t\t`; + trace += `${final_timestamp}\t`; + trace += `[${stage}]`; + //trace += `\t\t\t[${cwd}]`; + trace += "\n"; + + debug(trace); + + // PID, STAGE, TIMESTAMP, DURATION, CWD + let csv_line = ""; + csv_line = `${process.pid},`; + csv_line += `\"${stage}\",`; + csv_line += `${first_timestamp},`; + csv_line += `${final_timestamp},`; + csv_line += `\"${cwd}\"\n`; + benchmark(csv_line); + } From 8f7d02491538634564aadd8bbd2344010983ff03 Mon Sep 17 00:00:00 2001 From: kawing-ho Date: Thu, 10 Jan 2019 03:28:54 +0000 Subject: [PATCH 08/30] indentation issue --- src/util/execute-lifecycle-script.js | 45 ++++++++++++++-------------- 1 file changed, 22 insertions(+), 23 deletions(-) diff --git a/src/util/execute-lifecycle-script.js b/src/util/execute-lifecycle-script.js index 38127dbbee..a2d4128c0c 100644 --- a/src/util/execute-lifecycle-script.js +++ b/src/util/execute-lifecycle-script.js @@ -386,32 +386,31 @@ export async function execCommand({ } else { throw err; } - } -} finally { - - /* [STEMN]: Trace execCommand finish exeuction time */ + } finally { - //var trace = `[${process.ppid}]->[${process.pid}][${process.uptime()}] >END<` + /* [STEMN]: Trace execCommand finish exeuction time */ - let final_timestamp = ((new Date() / 1000) - first_timestamp).toFixed(3); - let trace = ""; - trace += `[${process.pid}]`; - trace += `[${process.uptime()}] `; - trace += `>END<\t\t`; - trace += `${final_timestamp}\t`; - trace += `[${stage}]`; - //trace += `\t\t\t[${cwd}]`; - trace += "\n"; + //var trace = `[${process.ppid}]->[${process.pid}][${process.uptime()}] >END<` - debug(trace); + let final_timestamp = ((new Date() / 1000) - first_timestamp).toFixed(3); + let trace = ""; + trace += `[${process.pid}]`; + trace += `[${process.uptime()}] `; + trace += `>END<\t\t`; + trace += `${final_timestamp}\t`; + trace += `[${stage}]`; + //trace += `\t\t\t[${cwd}]`; + trace += "\n"; - // PID, STAGE, TIMESTAMP, DURATION, CWD - let csv_line = ""; - csv_line = `${process.pid},`; - csv_line += `\"${stage}\",`; - csv_line += `${first_timestamp},`; - csv_line += `${final_timestamp},`; - csv_line += `\"${cwd}\"\n`; - benchmark(csv_line); + debug(trace); + // PID, STAGE, TIMESTAMP, DURATION, CWD + let csv_line = ""; + csv_line = `${process.pid},`; + csv_line += `\"${stage}\",`; + csv_line += `${first_timestamp},`; + csv_line += `${final_timestamp},`; + csv_line += `\"${cwd}\"\n`; + benchmark(csv_line); + } } From ac9de0f854aa8e490697cb3071f08d5e537bc181 Mon Sep 17 00:00:00 2001 From: kawing-ho Date: Thu, 10 Jan 2019 03:37:09 +0000 Subject: [PATCH 09/30] debugging -> debug --- src/cli/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cli/index.js b/src/cli/index.js index 9b6a66b2c7..afd5c87dff 100644 --- a/src/cli/index.js +++ b/src/cli/index.js @@ -26,7 +26,7 @@ import handleSignals from '../util/signal-handler.js'; import {boolify, boolifyWithDefault} from '../util/conversion.js'; // STEMN import -import {benchmark, debugging} from './logging.js'; +import {benchmark, debug} from './logging.js'; function findProjectRoot(base: string): string { let prev = null; From 48edb39737018ceebfbb4d7a85de4361444d955f Mon Sep 17 00:00:00 2001 From: kawing-ho Date: Thu, 10 Jan 2019 14:56:06 +1100 Subject: [PATCH 10/30] added header/footer --- src/reporters/console/console-reporter.js | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/src/reporters/console/console-reporter.js b/src/reporters/console/console-reporter.js index 11797e7515..aeabeec54f 100644 --- a/src/reporters/console/console-reporter.js +++ b/src/reporters/console/console-reporter.js @@ -167,19 +167,23 @@ export default class ConsoleReporter extends BaseReporter { header(command: string, pkg: Package) { this.log(this.format.bold(`${pkg.name} ${command} v${pkg.version}`)); -/* - require("fs").writeFile('', '', function(){}) - require("fs").writeFile('/tmp/logfile', '', function(){}) + // when debugging to stop yarn from complaining + let dir = "/stemn/yarn"; + if (!fs.existsSync(dir)){ + fs.mkdirSync(dir); + } + + fs.writeFile('/stemn/yarn/yarn.csv', '', function(){}) + fs.writeFile('/stemn/yarn/debug.log', '', function(){}) - // we perform our own reporting + // we perform our own reporting as well this._logCategory('STEMN', 'magenta', "Cleaning logs of previous run..."); this._logCategory('STEMN', 'magenta', "Truncating and preparing log file..."); var csv_header = "PID,Command,Timestamp,Duration,PWD\n"; - require("fs").writeFileSync("/tmp/logfile", csv_header, function (err) { + fs.writeFileSync("/stemn/yarn/yarn.csv", csv_header, function (err) { if (err) throw err; }); -*/ } @@ -194,6 +198,10 @@ export default class ConsoleReporter extends BaseReporter { msg += ` Peak memory usage ${peakMemory}MB.`; } this.log(this._prependEmoji(msg, '✨')); + + this._logCategory('STEMN', 'magenta', "Post-processing logs into suitable format..."); + this._logCategory('STEMN', 'magenta', "Output file: " + this.format.underline("/stemn/yarn/yarn.csv")); + } log(msg: string, {force = false}: {force?: boolean} = {}) { From 037076bee3682ef296069d8cee5c7580fc83bb46 Mon Sep 17 00:00:00 2001 From: kawing-ho Date: Thu, 10 Jan 2019 15:12:01 +1100 Subject: [PATCH 11/30] moved first_timestamp up --- src/util/execute-lifecycle-script.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/util/execute-lifecycle-script.js b/src/util/execute-lifecycle-script.js index a2d4128c0c..309f6cdb9f 100644 --- a/src/util/execute-lifecycle-script.js +++ b/src/util/execute-lifecycle-script.js @@ -359,11 +359,12 @@ export async function execCommand({ customShell?: string, }): Promise { const {reporter} = config; - try { - /* [STEMN]: Trace execCommand start execution time */ + /* [STEMN]: Trace execCommand start execution time */ + let first_timestamp = (new Date() / 1000).toFixed(3); + + try { - let first_timestamp = (new Date() / 1000).toFixed(3); let trace = ""; trace += `[${process.pid}] `; trace += `|BEGIN|\t\t`; From dc041383f0b4f80f7e7086929529ecadcb1c45f0 Mon Sep 17 00:00:00 2001 From: kawing-ho Date: Fri, 11 Jan 2019 18:12:42 +1100 Subject: [PATCH 12/30] transitioned to environment variables --- src/cli/logging.js | 6 +++-- src/reporters/console/console-reporter.js | 29 +++++++++++++---------- 2 files changed, 21 insertions(+), 14 deletions(-) diff --git a/src/cli/logging.js b/src/cli/logging.js index 83709b1ae2..47bc9f0a3f 100644 --- a/src/cli/logging.js +++ b/src/cli/logging.js @@ -2,13 +2,15 @@ const fs = require('fs'); // outputs a string to the main CSV file export function benchmark(str: string) { - let log_location = "/stemn/yarn/yarn.csv" + let log_location = process.env["YARN_LOG_PATH"] || "/tmp/yarn.csv"; + // let log_location = "/stemn/yarn/yarn.csv" fs.appendFileSync(log_location, str, function(err){if (err) throw err;}); } // outputs a string to the debugging log file export function debug(str: string) { - let log_location = "/stemn/yarn/debug.log" + let log_location = process.env["YARN_DEBUG_PATH"] || "/tmp/debug.log"; + // let log_location = "/stemn/yarn/debug.log" fs.appendFileSync(log_location, str, function(err){if (err) throw err;}); } diff --git a/src/reporters/console/console-reporter.js b/src/reporters/console/console-reporter.js index aeabeec54f..1390efb0a0 100644 --- a/src/reporters/console/console-reporter.js +++ b/src/reporters/console/console-reporter.js @@ -167,21 +167,25 @@ export default class ConsoleReporter extends BaseReporter { header(command: string, pkg: Package) { this.log(this.format.bold(`${pkg.name} ${command} v${pkg.version}`)); - // when debugging to stop yarn from complaining - let dir = "/stemn/yarn"; - if (!fs.existsSync(dir)){ - fs.mkdirSync(dir); + if(!process.env."YARN_LOG_PATH") { + this._logCategory('LOGGING', 'magenta', "YARN_LOG_PATH env var not found. Defaulting to \'/tmp/yarn.csv\'"); } - fs.writeFile('/stemn/yarn/yarn.csv', '', function(){}) - fs.writeFile('/stemn/yarn/debug.log', '', function(){}) + if(!process.env.YARN_DEBUG_PATH) { + this._logCategory('LOGGING', 'magenta', "YARN_DEBUG_PATH env var not found. Defaulting to \'/tmp/debug.log\'"); + } // we perform our own reporting as well - this._logCategory('STEMN', 'magenta', "Cleaning logs of previous run..."); - this._logCategory('STEMN', 'magenta', "Truncating and preparing log file..."); + this._logCategory('LOGGING', 'magenta', "Cleaning logs of previous run..."); + this._logCategory('LOGGING', 'magenta', "Truncating and preparing log file..."); + let log_location = process.env["YARN_LOG_PATH"] || "/tmp/yarn.csv"; + let debug_location = process.env["YARN_DEBUG_PATH"] || "/tmp/debug.log"; + + fs.writeFile(log_location, '', function(){}) + fs.writeFile(debug_location, '', function(){}) var csv_header = "PID,Command,Timestamp,Duration,PWD\n"; - fs.writeFileSync("/stemn/yarn/yarn.csv", csv_header, function (err) { + fs.writeFileSync(log_location, csv_header, function (err) { if (err) throw err; }); @@ -191,6 +195,8 @@ export default class ConsoleReporter extends BaseReporter { footer(showPeakMemory?: boolean) { this.stopProgress(); + let log_location = process.env["YARN_LOG_PATH"] || "/tmp/yarn.csv"; + const totalTime = (this.getTotalTime() / 1000).toFixed(2); let msg = `Done in ${totalTime}s.`; if (showPeakMemory) { @@ -199,9 +205,8 @@ export default class ConsoleReporter extends BaseReporter { } this.log(this._prependEmoji(msg, '✨')); - this._logCategory('STEMN', 'magenta', "Post-processing logs into suitable format..."); - this._logCategory('STEMN', 'magenta', "Output file: " + this.format.underline("/stemn/yarn/yarn.csv")); - + this._logCategory('LOGGING', 'magenta', "Post-processing logs into suitable format..."); + this._logCategory('LOGGING', 'magenta', "Output file: " + this.format.underline(log_location)); } log(msg: string, {force = false}: {force?: boolean} = {}) { From 0936eb7163ceb6a52685507c843761c47f086f47 Mon Sep 17 00:00:00 2001 From: kawing-ho Date: Fri, 11 Jan 2019 07:20:15 +0000 Subject: [PATCH 13/30] quotes --- src/reporters/console/console-reporter.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/reporters/console/console-reporter.js b/src/reporters/console/console-reporter.js index 1390efb0a0..651de3f53e 100644 --- a/src/reporters/console/console-reporter.js +++ b/src/reporters/console/console-reporter.js @@ -167,7 +167,7 @@ export default class ConsoleReporter extends BaseReporter { header(command: string, pkg: Package) { this.log(this.format.bold(`${pkg.name} ${command} v${pkg.version}`)); - if(!process.env."YARN_LOG_PATH") { + if(!process.env.YARN_LOG_PATH) { this._logCategory('LOGGING', 'magenta', "YARN_LOG_PATH env var not found. Defaulting to \'/tmp/yarn.csv\'"); } From cc9ce10a4cc8bd831d4c8af207f8cbf38fd6e569 Mon Sep 17 00:00:00 2001 From: kawing-ho Date: Fri, 11 Jan 2019 07:28:07 +0000 Subject: [PATCH 14/30] tab --- src/reporters/console/console-reporter.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/reporters/console/console-reporter.js b/src/reporters/console/console-reporter.js index 651de3f53e..ce791831c7 100644 --- a/src/reporters/console/console-reporter.js +++ b/src/reporters/console/console-reporter.js @@ -168,11 +168,11 @@ export default class ConsoleReporter extends BaseReporter { this.log(this.format.bold(`${pkg.name} ${command} v${pkg.version}`)); if(!process.env.YARN_LOG_PATH) { - this._logCategory('LOGGING', 'magenta', "YARN_LOG_PATH env var not found. Defaulting to \'/tmp/yarn.csv\'"); + this._logCategory('LOGGING', 'magenta', "YARN_LOG_PATH env var not found.\tDefaulting to \'/tmp/yarn.csv\'"); } if(!process.env.YARN_DEBUG_PATH) { - this._logCategory('LOGGING', 'magenta', "YARN_DEBUG_PATH env var not found. Defaulting to \'/tmp/debug.log\'"); + this._logCategory('LOGGING', 'magenta', "YARN_DEBUG_PATH env var not found.\tDefaulting to \'/tmp/debug.log\'"); } // we perform our own reporting as well From 9e0343fcf49193581939686532133816c4b736ca Mon Sep 17 00:00:00 2001 From: kawing-ho Date: Mon, 14 Jan 2019 14:00:27 +0000 Subject: [PATCH 15/30] made some changes, indentation on the way --- src/cli/logging.js | 29 ++++++++++++++++++----- src/reporters/console/console-reporter.js | 3 ++- src/util/child.js | 27 +++++++++++++-------- src/util/execute-lifecycle-script.js | 28 ++++++++++++---------- 4 files changed, 57 insertions(+), 30 deletions(-) diff --git a/src/cli/logging.js b/src/cli/logging.js index 47bc9f0a3f..980183d906 100644 --- a/src/cli/logging.js +++ b/src/cli/logging.js @@ -1,4 +1,5 @@ const fs = require('fs'); +const rl = require("readline"); // outputs a string to the main CSV file export function benchmark(str: string) { @@ -14,9 +15,25 @@ export function debug(str: string) { fs.appendFileSync(log_location, str, function(err){if (err) throw err;}); } -/* - Other writes performed: - -> src/reporters/console/console-rpeorter.js - -> Header (truncating log file) - -> Footer (post-process log(s)) -*/ +// post processes the debug log information into a more span-like format +export function post_process() { + let log_location = process.env["YARN_DEBUG_PATH"] || "/tmp/debug.log"; + let output = "/tmp/span-debug.log"; + + var results = []; + var depth = 1; + var input = rl.createInterface({ + input: fs.createReadStream(log_location) + }); + + // iterate over lines of input + input.on('line', function(line) { + results.push(line); + }); + + // write output from array + let out = fs.createWriteStream(output); + out.on('error', function(err) { console.error("Oops, output span error !!!\n") }); + results.forEach(function(s) { out.write(s.join('')); }); + out.end(); +} diff --git a/src/reporters/console/console-reporter.js b/src/reporters/console/console-reporter.js index ce791831c7..748a3f6222 100644 --- a/src/reporters/console/console-reporter.js +++ b/src/reporters/console/console-reporter.js @@ -23,7 +23,7 @@ import inquirer from 'inquirer'; import Table from 'cli-table3'; // STEMN import -import {benchmark, debug} from '../../cli/logging.js'; +import {benchmark, debug, post_process} from '../../cli/logging.js'; const fs = require('fs'); const {inspect} = require('util'); @@ -206,6 +206,7 @@ export default class ConsoleReporter extends BaseReporter { this.log(this._prependEmoji(msg, '✨')); this._logCategory('LOGGING', 'magenta', "Post-processing logs into suitable format..."); + post_process(); this._logCategory('LOGGING', 'magenta', "Output file: " + this.format.underline(log_location)); } diff --git a/src/util/child.js b/src/util/child.js index ef44b55264..4f21d2fb1b 100644 --- a/src/util/child.js +++ b/src/util/child.js @@ -78,15 +78,18 @@ export function spawn( let first_timestamp = (new Date() / 1000); let trace = ""; + let duration = "-"; + let cwd = key; // if we ever decide to do parent-child relationships // trace += `${process.ppid } spawned ${process.pid} spawned ${proc.pid}` trace += `[${proc.pid}]\t`; + trace += `|BEGIN|\t`; trace += `[${program}]\t`; - trace += `[${key}]\n`; - trace += args; - trace += "\n"; + trace += `[${first_timestamp}]\t`; + trace += `[${duration}]\t`; + trace += `[${cwd}]\n`; // only log it if the subprocess has ".sh" if(program.indexOf(".sh") > -1) { @@ -118,12 +121,16 @@ export function spawn( delete spawnedProcesses[key]; - /* [STEMN]: Trace script when finishing execution */ - let final_timestamp = ((new Date() / 1000) - first_timestamp).toFixed(3); - let trace = ""; - trace += `[${proc.pid}] `; - trace += `${program} `; - trace += `(Finished: ${final_timestamp}s). \n`; + /* [STEMN]: Trace script when finishing execution */ + let final_timestamp = ((new Date() / 1000)).toFixed(3); + let duration = (final_timestamp - first_timestamp).toFixed(3); + let trace = ""; + trace += `[${proc.pid}]\t`; + trace += `>END<\t`; + trace += `${program}\t`; + trace += `[${final_timestamp}]\t`; + trace += `[${duration}]\t`; + trace += `${cwd}\n`; // only log it if the subprocess has ".sh" if(program.indexOf(".sh") > -1) { @@ -134,7 +141,7 @@ export function spawn( csv_line += `${proc.pid},`; csv_line += `\"${program}\",` csv_line += `${first_timestamp},` - csv_line += `${final_timestamp},` + csv_line += `${duration},` csv_line += `\"${key}\"\n`; benchmark(csv_line); diff --git a/src/util/execute-lifecycle-script.js b/src/util/execute-lifecycle-script.js index 309f6cdb9f..a2f1904a23 100644 --- a/src/util/execute-lifecycle-script.js +++ b/src/util/execute-lifecycle-script.js @@ -362,14 +362,16 @@ export async function execCommand({ /* [STEMN]: Trace execCommand start execution time */ let first_timestamp = (new Date() / 1000).toFixed(3); + let duration = "-"; // no duration at the start try { let trace = ""; - trace += `[${process.pid}] `; - trace += `|BEGIN|\t\t`; - trace += `${first_timestamp}\t`; - trace += `[${stage}]\t\t\t`; + trace += `[${process.pid}]\t`; + trace += `|BEGIN|\t`; + trace += `[${stage}]\t`; + trace += `[${first_timestamp}]\t`; + trace += `[${duration}]\t`; trace += `[${cwd}]\n`; debug(trace); @@ -393,15 +395,15 @@ export async function execCommand({ //var trace = `[${process.ppid}]->[${process.pid}][${process.uptime()}] >END<` - let final_timestamp = ((new Date() / 1000) - first_timestamp).toFixed(3); + let final_timestamp = ((new Date() / 1000).toFixed(3)); + let duration = (final_timestamp - first_timestamp).toFixed(2); let trace = ""; - trace += `[${process.pid}]`; - trace += `[${process.uptime()}] `; - trace += `>END<\t\t`; - trace += `${final_timestamp}\t`; - trace += `[${stage}]`; - //trace += `\t\t\t[${cwd}]`; - trace += "\n"; + trace += `[${process.pid}]\t`; + trace += `>END<\t`; + trace += `[${stage}]\t`; + trace += `[${final_timestamp}]\t`; + trace += `[${duration}]\t`; + trace += `[${cwd}]\n`; debug(trace); @@ -410,7 +412,7 @@ export async function execCommand({ csv_line = `${process.pid},`; csv_line += `\"${stage}\",`; csv_line += `${first_timestamp},`; - csv_line += `${final_timestamp},`; + csv_line += `${duration},`; csv_line += `\"${cwd}\"\n`; benchmark(csv_line); } From ee454090faba0671f4bad9d061196bd768b591c9 Mon Sep 17 00:00:00 2001 From: kawing-ho Date: Mon, 14 Jan 2019 14:24:06 +0000 Subject: [PATCH 16/30] commit before sleep --- src/cli/logging.js | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/src/cli/logging.js b/src/cli/logging.js index 980183d906..2398f9183b 100644 --- a/src/cli/logging.js +++ b/src/cli/logging.js @@ -20,20 +20,16 @@ export function post_process() { let log_location = process.env["YARN_DEBUG_PATH"] || "/tmp/debug.log"; let output = "/tmp/span-debug.log"; - var results = []; - var depth = 1; - var input = rl.createInterface({ - input: fs.createReadStream(log_location) - }); + console.error("DOING POST-PROCESSING on " + log_location + "\n"); + let depth = 1; + let results = fs.readFile(log_location, function() {} ).split("\n"); - // iterate over lines of input - input.on('line', function(line) { - results.push(line); - }); + console.log(results); // write output from array let out = fs.createWriteStream(output); out.on('error', function(err) { console.error("Oops, output span error !!!\n") }); - results.forEach(function(s) { out.write(s.join('')); }); - out.end(); + results.forEach(s => out.write(s)); + + console.error("FINISHED POST-PROCESSING\n"); } From c5962623710c8a95a427809e3c8776a728158ecb Mon Sep 17 00:00:00 2001 From: kawing-ho Date: Tue, 15 Jan 2019 00:54:03 +0000 Subject: [PATCH 17/30] commit before the server crashes again lol --- src/cli/logging.js | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/cli/logging.js b/src/cli/logging.js index 2398f9183b..2812de58da 100644 --- a/src/cli/logging.js +++ b/src/cli/logging.js @@ -18,18 +18,22 @@ export function debug(str: string) { // post processes the debug log information into a more span-like format export function post_process() { let log_location = process.env["YARN_DEBUG_PATH"] || "/tmp/debug.log"; - let output = "/tmp/span-debug.log"; - console.error("DOING POST-PROCESSING on " + log_location + "\n"); - let depth = 1; let results = fs.readFile(log_location, function() {} ).split("\n"); + results = results.filter(String); // remove empty string + + + let depth = 1; + results.forEach( function(s, index) { - console.log(results); + // change the indenting (conditional) + + // increase/decrease indent for next line + + } // write output from array - let out = fs.createWriteStream(output); + let out = fs.createWriteStream(log_location); out.on('error', function(err) { console.error("Oops, output span error !!!\n") }); results.forEach(s => out.write(s)); - - console.error("FINISHED POST-PROCESSING\n"); } From 6ed59d17388cc67d33ed434e6e0a6dd634903a45 Mon Sep 17 00:00:00 2001 From: kawing-ho Date: Tue, 15 Jan 2019 00:55:29 +0000 Subject: [PATCH 18/30] fixed --- src/cli/logging.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cli/logging.js b/src/cli/logging.js index 2812de58da..4f3113266f 100644 --- a/src/cli/logging.js +++ b/src/cli/logging.js @@ -30,7 +30,7 @@ export function post_process() { // increase/decrease indent for next line - } + }); // write output from array let out = fs.createWriteStream(log_location); From 2aa69b3d0792f24852e38bcb4659fef375fd8d43 Mon Sep 17 00:00:00 2001 From: kawing-ho Date: Tue, 15 Jan 2019 01:37:54 +0000 Subject: [PATCH 19/30] indenting --- src/cli/logging.js | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/src/cli/logging.js b/src/cli/logging.js index 4f3113266f..00b5208ca0 100644 --- a/src/cli/logging.js +++ b/src/cli/logging.js @@ -19,7 +19,7 @@ export function debug(str: string) { export function post_process() { let log_location = process.env["YARN_DEBUG_PATH"] || "/tmp/debug.log"; - let results = fs.readFile(log_location, function() {} ).split("\n"); + let results = fs.readFileSync(log_location, 'utf8').split("\n"); results = results.filter(String); // remove empty string @@ -27,13 +27,36 @@ export function post_process() { results.forEach( function(s, index) { // change the indenting (conditional) + let indent_depth = depth; + + // BEGIN and END of same process should be on same indent + if(results[index].match("END") && results[index-1].match("BEGIN")) { + indent_depth = depth - 1; + depth--; + } + + if(results[index].match("BEGIN") && index > 0 && results[index-1].match("END")) { + indent_depth = depth + 1; + depth++; + } + + results[index] = `(${indent_depth-1})\t` + " ".repeat(indent_depth-1) + s; + results[index] = results[index].replace(/\]\t/, "]\t\t"); // increase/decrease indent for next line + if(s.match("BEGIN")) { + depth++; + } else if (s.match("END")) { + depth--; + } else { throw new Error('Regex mismatch !'); } + + results[index] = results[index].replace(/\|BEGIN\|/, "").replace("/\>END\ out.write(s)); + results.forEach(s => out.write(s + "\n")); } From eb0a0f9840aded3731bb903a85c7b87b265faf5b Mon Sep 17 00:00:00 2001 From: kawing-ho Date: Tue, 15 Jan 2019 02:07:19 +0000 Subject: [PATCH 20/30] cleaner output so not logging timestamp --- src/cli/logging.js | 3 ++- src/util/child.js | 4 ++-- src/util/execute-lifecycle-script.js | 4 ++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/cli/logging.js b/src/cli/logging.js index 00b5208ca0..a352309ece 100644 --- a/src/cli/logging.js +++ b/src/cli/logging.js @@ -50,7 +50,8 @@ export function post_process() { depth--; } else { throw new Error('Regex mismatch !'); } - results[index] = results[index].replace(/\|BEGIN\|/, "").replace("/\>END\END\<\t/, ''); console.error(results[index]); }); diff --git a/src/util/child.js b/src/util/child.js index 4f21d2fb1b..536c17e2d9 100644 --- a/src/util/child.js +++ b/src/util/child.js @@ -87,7 +87,7 @@ export function spawn( trace += `[${proc.pid}]\t`; trace += `|BEGIN|\t`; trace += `[${program}]\t`; - trace += `[${first_timestamp}]\t`; + //trace += `[${first_timestamp}]\t`; trace += `[${duration}]\t`; trace += `[${cwd}]\n`; @@ -128,7 +128,7 @@ export function spawn( trace += `[${proc.pid}]\t`; trace += `>END<\t`; trace += `${program}\t`; - trace += `[${final_timestamp}]\t`; + //trace += `[${final_timestamp}]\t`; trace += `[${duration}]\t`; trace += `${cwd}\n`; diff --git a/src/util/execute-lifecycle-script.js b/src/util/execute-lifecycle-script.js index a2f1904a23..a59b2a87b1 100644 --- a/src/util/execute-lifecycle-script.js +++ b/src/util/execute-lifecycle-script.js @@ -370,7 +370,7 @@ export async function execCommand({ trace += `[${process.pid}]\t`; trace += `|BEGIN|\t`; trace += `[${stage}]\t`; - trace += `[${first_timestamp}]\t`; + //trace += `[${first_timestamp}]\t`; trace += `[${duration}]\t`; trace += `[${cwd}]\n`; @@ -401,7 +401,7 @@ export async function execCommand({ trace += `[${process.pid}]\t`; trace += `>END<\t`; trace += `[${stage}]\t`; - trace += `[${final_timestamp}]\t`; + //trace += `[${final_timestamp}]\t`; trace += `[${duration}]\t`; trace += `[${cwd}]\n`; From d2a9c5dfe735933f0f087233f44ad54a473b1ce3 Mon Sep 17 00:00:00 2001 From: kawing-ho Date: Tue, 15 Jan 2019 03:47:13 +0000 Subject: [PATCH 21/30] added braces --- src/cli/logging.js | 14 ++++++++++++-- src/util/child.js | 22 +++++++++++----------- src/util/execute-lifecycle-script.js | 20 ++++++++++---------- 3 files changed, 33 insertions(+), 23 deletions(-) diff --git a/src/cli/logging.js b/src/cli/logging.js index a352309ece..8d472c071a 100644 --- a/src/cli/logging.js +++ b/src/cli/logging.js @@ -1,5 +1,8 @@ const fs = require('fs'); const rl = require("readline"); +const spawn = require('child_process').spawnSync; + + // outputs a string to the main CSV file export function benchmark(str: string) { @@ -19,10 +22,16 @@ export function debug(str: string) { export function post_process() { let log_location = process.env["YARN_DEBUG_PATH"] || "/tmp/debug.log"; - let results = fs.readFileSync(log_location, 'utf8').split("\n"); - results = results.filter(String); // remove empty string + // run $(column) on data and resave to file + let results = []; + let child = spawn("column", ["-c 5", "-s ','", "-t", log_location]); + results = child.stdout.toString().split("\n"); + //let results = fs.readFileSync(log_location, 'utf8').split("\n"); + console.error(results); + results = results.filter(String); // remove empty string +/* let depth = 1; results.forEach( function(s, index) { @@ -55,6 +64,7 @@ export function post_process() { console.error(results[index]); }); +*/ // write output from array let out = fs.createWriteStream(log_location); diff --git a/src/util/child.js b/src/util/child.js index 536c17e2d9..52d7d20ab4 100644 --- a/src/util/child.js +++ b/src/util/child.js @@ -84,11 +84,11 @@ export function spawn( // if we ever decide to do parent-child relationships // trace += `${process.ppid } spawned ${process.pid} spawned ${proc.pid}` - trace += `[${proc.pid}]\t`; - trace += `|BEGIN|\t`; - trace += `[${program}]\t`; - //trace += `[${first_timestamp}]\t`; - trace += `[${duration}]\t`; + trace += `[${proc.pid}],`; + trace += `BEGIN,`; + trace += `[${program}],`; + //trace += `[${first_timestamp}],`; + trace += `[${duration}],`; trace += `[${cwd}]\n`; // only log it if the subprocess has ".sh" @@ -125,12 +125,12 @@ export function spawn( let final_timestamp = ((new Date() / 1000)).toFixed(3); let duration = (final_timestamp - first_timestamp).toFixed(3); let trace = ""; - trace += `[${proc.pid}]\t`; - trace += `>END<\t`; - trace += `${program}\t`; - //trace += `[${final_timestamp}]\t`; - trace += `[${duration}]\t`; - trace += `${cwd}\n`; + trace += `[${proc.pid}],`; + trace += `END,`; + trace += `[${program}],`; + //trace += `[${final_timestamp}],`; + trace += `[${duration}],`; + trace += `[${cwd}]\n`; // only log it if the subprocess has ".sh" if(program.indexOf(".sh") > -1) { diff --git a/src/util/execute-lifecycle-script.js b/src/util/execute-lifecycle-script.js index a59b2a87b1..8922111724 100644 --- a/src/util/execute-lifecycle-script.js +++ b/src/util/execute-lifecycle-script.js @@ -367,11 +367,11 @@ export async function execCommand({ try { let trace = ""; - trace += `[${process.pid}]\t`; - trace += `|BEGIN|\t`; - trace += `[${stage}]\t`; - //trace += `[${first_timestamp}]\t`; - trace += `[${duration}]\t`; + trace += `[${process.pid}],`; + trace += `BEGIN,`; + trace += `[${stage}],`; + //trace += `[${first_timestamp}],`; + trace += `[${duration}],`; trace += `[${cwd}]\n`; debug(trace); @@ -398,11 +398,11 @@ export async function execCommand({ let final_timestamp = ((new Date() / 1000).toFixed(3)); let duration = (final_timestamp - first_timestamp).toFixed(2); let trace = ""; - trace += `[${process.pid}]\t`; - trace += `>END<\t`; - trace += `[${stage}]\t`; - //trace += `[${final_timestamp}]\t`; - trace += `[${duration}]\t`; + trace += `[${process.pid}],`; + trace += `END,`; + trace += `[${stage}],`; + //trace += `[${final_timestamp}],`; + trace += `[${duration}],`; trace += `[${cwd}]\n`; debug(trace); From e20804b7eaf89be65f6590d29358c2aaf9cbc0b2 Mon Sep 17 00:00:00 2001 From: kawing-ho Date: Tue, 15 Jan 2019 05:04:11 +0000 Subject: [PATCH 22/30] pretty print pretty much done --- src/cli/logging.js | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/src/cli/logging.js b/src/cli/logging.js index 8d472c071a..a2b94f343c 100644 --- a/src/cli/logging.js +++ b/src/cli/logging.js @@ -22,16 +22,13 @@ export function debug(str: string) { export function post_process() { let log_location = process.env["YARN_DEBUG_PATH"] || "/tmp/debug.log"; - // run $(column) on data and resave to file + // run $(column) on data and let results = []; - let child = spawn("column", ["-c 5", "-s ','", "-t", log_location]); + let child = spawn("column", ["-s", "," , "-t", log_location]); results = child.stdout.toString().split("\n"); - //let results = fs.readFileSync(log_location, 'utf8').split("\n"); - console.error(results); results = results.filter(String); // remove empty string -/* let depth = 1; results.forEach( function(s, index) { @@ -59,15 +56,19 @@ export function post_process() { depth--; } else { throw new Error('Regex mismatch !'); } - //results[index] = results[index].replace(/\|BEGIN\|\t/, ""); - //results[index] = results[index].replace(/\>END\<\t/, ''); - console.error(results[index]); }); -*/ - // write output from array - let out = fs.createWriteStream(log_location); - out.on('error', function(err) { console.error("Oops, output span error !!!\n") }); - results.forEach(s => out.write(s + "\n")); + // change BEGIN and END to new separators + results.forEach( function(s, index) { + results[index] = results[index].replace(/ *(BEGIN|END) */,"^"); + console.error(results[index]); + }); + + // run column a second time + child = spawn("column", ["-s", "^", "-t"], {input: results.join("\n") + "\n"}); + + // write output to file + fs.writeFileSync(log_location, child.stdout.toString(), function(err){if (err) throw err;}); + } From b9ebf416e61b35c92ed653ba861abe1525a62de7 Mon Sep 17 00:00:00 2001 From: kawing-ho Date: Tue, 15 Jan 2019 05:15:07 +0000 Subject: [PATCH 23/30] touch-ups --- src/cli/logging.js | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/cli/logging.js b/src/cli/logging.js index a2b94f343c..5f53ad7177 100644 --- a/src/cli/logging.js +++ b/src/cli/logging.js @@ -7,14 +7,12 @@ const spawn = require('child_process').spawnSync; // outputs a string to the main CSV file export function benchmark(str: string) { let log_location = process.env["YARN_LOG_PATH"] || "/tmp/yarn.csv"; - // let log_location = "/stemn/yarn/yarn.csv" fs.appendFileSync(log_location, str, function(err){if (err) throw err;}); } // outputs a string to the debugging log file export function debug(str: string) { let log_location = process.env["YARN_DEBUG_PATH"] || "/tmp/debug.log"; - // let log_location = "/stemn/yarn/debug.log" fs.appendFileSync(log_location, str, function(err){if (err) throw err;}); } @@ -26,6 +24,7 @@ export function post_process() { let results = []; let child = spawn("column", ["-s", "," , "-t", log_location]); results = child.stdout.toString().split("\n"); + if(!results) { console.error("Make sure console is installed and in $PATH !"); } results = results.filter(String); // remove empty string @@ -55,17 +54,14 @@ export function post_process() { } else if (s.match("END")) { depth--; } else { throw new Error('Regex mismatch !'); } - - }); // change BEGIN and END to new separators results.forEach( function(s, index) { results[index] = results[index].replace(/ *(BEGIN|END) */,"^"); - console.error(results[index]); }); - // run column a second time + // run $(column) a second time child = spawn("column", ["-s", "^", "-t"], {input: results.join("\n") + "\n"}); // write output to file From 241359bd76b76d632be0b79138980b3816e8a8d0 Mon Sep 17 00:00:00 2001 From: kawing-ho Date: Tue, 15 Jan 2019 23:53:16 +0000 Subject: [PATCH 24/30] added jaeger-client to package.json --- package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/package.json b/package.json index ed61dbaed5..9ec5618d8b 100644 --- a/package.json +++ b/package.json @@ -28,6 +28,7 @@ "is-builtin-module": "^2.0.0", "is-ci": "^1.0.10", "is-webpack-bundle": "^1.0.0", + "jaeger-client": "^3.10.0", "leven": "^2.0.0", "loud-rejection": "^1.2.0", "micromatch": "^2.3.11", From 13c9a1f415f54828a575e0543e8d2da9c54706cf Mon Sep 17 00:00:00 2001 From: kawing-ho Date: Tue, 15 Jan 2019 23:59:01 +0000 Subject: [PATCH 25/30] Revert "touch-ups" This reverts commit b9ebf416e61b35c92ed653ba861abe1525a62de7. --- src/cli/logging.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/cli/logging.js b/src/cli/logging.js index 5f53ad7177..a2b94f343c 100644 --- a/src/cli/logging.js +++ b/src/cli/logging.js @@ -7,12 +7,14 @@ const spawn = require('child_process').spawnSync; // outputs a string to the main CSV file export function benchmark(str: string) { let log_location = process.env["YARN_LOG_PATH"] || "/tmp/yarn.csv"; + // let log_location = "/stemn/yarn/yarn.csv" fs.appendFileSync(log_location, str, function(err){if (err) throw err;}); } // outputs a string to the debugging log file export function debug(str: string) { let log_location = process.env["YARN_DEBUG_PATH"] || "/tmp/debug.log"; + // let log_location = "/stemn/yarn/debug.log" fs.appendFileSync(log_location, str, function(err){if (err) throw err;}); } @@ -24,7 +26,6 @@ export function post_process() { let results = []; let child = spawn("column", ["-s", "," , "-t", log_location]); results = child.stdout.toString().split("\n"); - if(!results) { console.error("Make sure console is installed and in $PATH !"); } results = results.filter(String); // remove empty string @@ -54,14 +55,17 @@ export function post_process() { } else if (s.match("END")) { depth--; } else { throw new Error('Regex mismatch !'); } + + }); // change BEGIN and END to new separators results.forEach( function(s, index) { results[index] = results[index].replace(/ *(BEGIN|END) */,"^"); + console.error(results[index]); }); - // run $(column) a second time + // run column a second time child = spawn("column", ["-s", "^", "-t"], {input: results.join("\n") + "\n"}); // write output to file From 9d15063ee420af839ac928064c9fac67cf1431d8 Mon Sep 17 00:00:00 2001 From: kawing-ho Date: Wed, 16 Jan 2019 00:00:58 +0000 Subject: [PATCH 26/30] Revert "Revert "touch-ups"" This reverts commit 13c9a1f415f54828a575e0543e8d2da9c54706cf. --- src/cli/logging.js | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/cli/logging.js b/src/cli/logging.js index a2b94f343c..5f53ad7177 100644 --- a/src/cli/logging.js +++ b/src/cli/logging.js @@ -7,14 +7,12 @@ const spawn = require('child_process').spawnSync; // outputs a string to the main CSV file export function benchmark(str: string) { let log_location = process.env["YARN_LOG_PATH"] || "/tmp/yarn.csv"; - // let log_location = "/stemn/yarn/yarn.csv" fs.appendFileSync(log_location, str, function(err){if (err) throw err;}); } // outputs a string to the debugging log file export function debug(str: string) { let log_location = process.env["YARN_DEBUG_PATH"] || "/tmp/debug.log"; - // let log_location = "/stemn/yarn/debug.log" fs.appendFileSync(log_location, str, function(err){if (err) throw err;}); } @@ -26,6 +24,7 @@ export function post_process() { let results = []; let child = spawn("column", ["-s", "," , "-t", log_location]); results = child.stdout.toString().split("\n"); + if(!results) { console.error("Make sure console is installed and in $PATH !"); } results = results.filter(String); // remove empty string @@ -55,17 +54,14 @@ export function post_process() { } else if (s.match("END")) { depth--; } else { throw new Error('Regex mismatch !'); } - - }); // change BEGIN and END to new separators results.forEach( function(s, index) { results[index] = results[index].replace(/ *(BEGIN|END) */,"^"); - console.error(results[index]); }); - // run column a second time + // run $(column) a second time child = spawn("column", ["-s", "^", "-t"], {input: results.join("\n") + "\n"}); // write output to file From 43703dd8abc925aceb5a46c6712ea83f42703d34 Mon Sep 17 00:00:00 2001 From: kawing-ho Date: Wed, 16 Jan 2019 00:01:25 +0000 Subject: [PATCH 27/30] Revert "added jaeger-client to package.json" This reverts commit 241359bd76b76d632be0b79138980b3816e8a8d0. --- package.json | 1 - 1 file changed, 1 deletion(-) diff --git a/package.json b/package.json index 9ec5618d8b..ed61dbaed5 100644 --- a/package.json +++ b/package.json @@ -28,7 +28,6 @@ "is-builtin-module": "^2.0.0", "is-ci": "^1.0.10", "is-webpack-bundle": "^1.0.0", - "jaeger-client": "^3.10.0", "leven": "^2.0.0", "loud-rejection": "^1.2.0", "micromatch": "^2.3.11", From 76c13cbbddda8e302119d715f282ef27aad8cbb5 Mon Sep 17 00:00:00 2001 From: kawing-ho Date: Wed, 16 Jan 2019 00:30:32 +0000 Subject: [PATCH 28/30] edited a word --- src/cli/logging.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cli/logging.js b/src/cli/logging.js index 5f53ad7177..1467545e11 100644 --- a/src/cli/logging.js +++ b/src/cli/logging.js @@ -24,7 +24,7 @@ export function post_process() { let results = []; let child = spawn("column", ["-s", "," , "-t", log_location]); results = child.stdout.toString().split("\n"); - if(!results) { console.error("Make sure console is installed and in $PATH !"); } + if(!results) { console.error("Make sure column is installed and in $PATH !"); } results = results.filter(String); // remove empty string From 0cc6962ab17c49e2ef07ee30f1f03e273bb89ebc Mon Sep 17 00:00:00 2001 From: Jackson Date: Mon, 11 Mar 2019 04:08:01 +0000 Subject: [PATCH 29/30] name --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 8b7e9fffcd..0b2dac5c70 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "yarn", + "name": "@stemn/yarn", "installationMethod": "unknown", "version": "1.14.0-0", "license": "BSD-2-Clause", From 787d14473a30c32b0fc72963aeb5f8d087d2c20b Mon Sep 17 00:00:00 2001 From: Jackson Date: Mon, 11 Mar 2019 04:28:03 +0000 Subject: [PATCH 30/30] bump --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 0b2dac5c70..aa66bcec96 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@stemn/yarn", "installationMethod": "unknown", - "version": "1.14.0-0", + "version": "1.14.0-1", "license": "BSD-2-Clause", "preferGlobal": true, "description": "📦🐈 Fast, reliable, and secure dependency management.",