From f7a5a27155532d1d1d8cb0bf3a3853958f88c373 Mon Sep 17 00:00:00 2001 From: Unitech Date: Wed, 3 Dec 2014 11:46:12 +0100 Subject: [PATCH 1/4] report notification via CLI --- examples/axm/keymetrics-load.js | 2 +- examples/axm/keymetrics-test.js | 12 ++++++------ lib/CLI.js | 8 +++++++- 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/examples/axm/keymetrics-load.js b/examples/axm/keymetrics-load.js index 223b6b08..ee7cc44c 100644 --- a/examples/axm/keymetrics-load.js +++ b/examples/axm/keymetrics-load.js @@ -1,6 +1,6 @@ -var pm2 = require('..'); +var pm2 = require('../..'); pm2.connect(function() { pm2.delete('all', function() { diff --git a/examples/axm/keymetrics-test.js b/examples/axm/keymetrics-test.js index 1a365ffe..1167cab4 100644 --- a/examples/axm/keymetrics-test.js +++ b/examples/axm/keymetrics-test.js @@ -5,13 +5,13 @@ pm2.connect(function() { pm2.delete('all', function() { pm2.start('examples/axm/pm2_probe.js', function() { pm2.start('examples/axm/pm2_agent_probe.js', function() { - pm2.start('examples/axm/event.js', function() { - pm2.start('examples/axm/http_app.js', {instances:4},function() { + pm2.start('examples/axm/event.js', {force:true}, function() { + pm2.start('examples/axm/http_app.js', {force:true, instances:4},function() { pm2.start('examples/axm/probes.js',function() { - pm2.start('examples/axm/custom_action.js', function() { - pm2.start('examples/axm/custom_action_with_params.js', {name : 'custom'} , function() { - pm2.start('examples/axm/http_transaction.js', {name:'trace'}, function() { - pm2.start('examples/axm/throw.js', {name:'auto-throw', execMode : 'cluster_mode'}, function() { + pm2.start('examples/axm/custom_action.js', {force:true}, function() { + pm2.start('examples/axm/custom_action_with_params.js', {force:true, name : 'custom'} , function() { + pm2.start('examples/axm/http_transaction.js', {name:'trace', force:true}, function() { + pm2.start('examples/axm/throw.js', {name:'auto-throw', execMode : 'cluster_mode', force:true}, function() { pm2.disconnect(function() { process.exit(1); }); }); }); diff --git a/lib/CLI.js b/lib/CLI.js index a3a5639e..2907408e 100644 --- a/lib/CLI.js +++ b/lib/CLI.js @@ -902,7 +902,13 @@ CLI._operate = function(action_name, process_name, envs, cb) { return next(new Error('Process not found')); } - Satan.notifyGod('restart', id); + if (action_name == 'restartProcessId') { + Satan.notifyGod('restart', id); + } else if (action_name == 'deleteProcessId') { + Satan.notifyGod('delete', id); + } else if (action_name == 'stopProcessId') { + Satan.notifyGod('stop', id); + } printOut(cst.PREFIX_MSG + action_name + ' process id %d', id); return next(); From 759f08935db9d7fb43c27f078144122e357d9e2f Mon Sep 17 00:00:00 2001 From: Unitech Date: Wed, 3 Dec 2014 14:51:34 +0100 Subject: [PATCH 2/4] add back survey --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 5a4f539e..94c34b7c 100644 --- a/README.md +++ b/README.md @@ -112,7 +112,7 @@ $ pm2 save We're going to release a very nice product, a dashboard to monitor every part of your Node.js applications. Here are some links: -- [Register to Keymetrics I/O](https://keymetrics.io/) +- [Pitch + Survey](https://docs.google.com/forms/d/1FuCjIhrGg-ItxInq2nLreoe9GS-gZWJNkNWE0JJajw8/viewform) People who fill the survey will be eligible for free license Thanks in advance and we hope that you like PM2! From 24333f434ebdbac0f099464231b404fbd45f4158 Mon Sep 17 00:00:00 2001 From: Unitech Date: Wed, 3 Dec 2014 14:58:29 +0100 Subject: [PATCH 3/4] homogeneize getDate --- lib/God/ClusterMode.js | 7 +++---- lib/Utility.js | 10 ++++++++++ 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/lib/God/ClusterMode.js b/lib/God/ClusterMode.js index 5449caf4..22f19cb9 100644 --- a/lib/God/ClusterMode.js +++ b/lib/God/ClusterMode.js @@ -10,8 +10,7 @@ var cluster = require('cluster'); var fs = require('fs'); var cst = require('../../constants.js'); var util = require('util'); -var Common = require('../Common'); - +var Utility = require('../Utility.js'); var pkg = require('../../package.json'); /** @@ -62,9 +61,9 @@ module.exports = function ClusterMode(God) { *********************************/ if (msg.data && msg.type) { return God.bus.emit(msg.type ? msg.type : 'process:msg', { - at : Math.round(Date.now() / 1000), + at : Utility.getDate(), data : msg.data, - process : Common.formatCLU(clu) + process : Utility.formatCLU(clu) }); } else { diff --git a/lib/Utility.js b/lib/Utility.js index be7a84e3..9fd8b613 100644 --- a/lib/Utility.js +++ b/lib/Utility.js @@ -9,6 +9,16 @@ var Utility = module.exports = { getDate : function() { return Math.round(Date.now() / 1000); }, + formatCLU : function(process) { + if (!process.pm2_env) { + return process; + } + + var obj = Common.serialize(process.pm2_env); + delete obj.env; + + return obj; + }, serialize : function(data) { return JSON.parse(Stringify(data)); }, From 643d77582f8e2f72e71fbd18b98a0b17d77955af Mon Sep 17 00:00:00 2001 From: Unitech Date: Wed, 3 Dec 2014 15:49:19 +0100 Subject: [PATCH 4/4] change Date format to extended EPOCH time --- lib/Utility.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/Utility.js b/lib/Utility.js index 9fd8b613..c9a23eaa 100644 --- a/lib/Utility.js +++ b/lib/Utility.js @@ -7,14 +7,14 @@ var async = require('async'); var Utility = module.exports = { getDate : function() { - return Math.round(Date.now() / 1000); + return Date.now(); }, formatCLU : function(process) { if (!process.pm2_env) { return process; } - var obj = Common.serialize(process.pm2_env); + var obj = Utility.serialize(process.pm2_env); delete obj.env; return obj;