Skip to content

Commit

Permalink
Decreased logging to warn. more docs.
Browse files Browse the repository at this point in the history
  • Loading branch information
syzer committed Apr 8, 2015
1 parent 3ac502c commit b342559
Show file tree
Hide file tree
Showing 10 changed files with 28 additions and 17 deletions.
24 changes: 19 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,21 +50,31 @@ But using JSpark you can totally reverse this trend. Build websites that run FAS

How(Getting started with npm)
=============================
To add a distributed job cue to anny node app simply:

npm i --save js-spark

Look for **Usage with npm**.

How(Getting started)
====================
Prerequisites: install `Node.js`, then:

git clone [email protected]:syzer/JS-Spark.git && cd $_
npm install
Then run:

node index &
node client

Start on your machine and see how the clients do all calculation.
Or:

npm start
After that you may see how the clients do all calculation.
and all heavy lifting.

wait for clients to do all heavy lifting

Running with UI
---------------
Expand Down Expand Up @@ -100,8 +110,8 @@ jsSpark([20, 30, 40, 50])
})
```

Usage
=====
Usage(Examples)
===============
Client side heavy CPU computation(MapReduce)
--------------------------------------------

Expand All @@ -117,6 +127,7 @@ task = jsSpark([20, 30, 40, 50])
.run();
```


Distributed version of lodash/underscore
----------------------------------------

Expand All @@ -142,6 +153,9 @@ jsSpark(_.range(10))

Multiple retry and clients elections
------------------------------------
If you run calculations via unknown clients is better to recalculate
same tasks on different clients:


```JavaScript
jsSpark(_.range(10))
Expand Down
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ module.exports = function (config) {

// TODO move to examples
/**
//module.exports({workers:2});
module.exports({workers:2});
var task, task2, task3, doElections;
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "js-spark",
"description": "Distributed calculation / data processing system. Run computation/jobs on 1000+ cores",
"author": "syzer <[email protected]>",
"version": "0.3.1",
"version": "0.3.2",
"dependencies": {
"bluebird": "^2.3.4",
"body-parser": "^1.5.0",
Expand Down
2 changes: 1 addition & 1 deletion private/src/client/components/socket/socket.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ module.exports = function (_) {
ioClient.emit('response',
{id: receivedTask.id, resp: response}
);
console.log('Client response', response);
//console.log('Client response', response);
} catch (error) {
console.error('Error:', error.stack);
if ('SyntaxError' === error.name) {
Expand Down
2 changes: 0 additions & 2 deletions private/src/client/controller/readme.md

This file was deleted.

1 change: 0 additions & 1 deletion private/src/client/directive/readme.md

This file was deleted.

1 change: 0 additions & 1 deletion private/src/client/service/readme.md

This file was deleted.

3 changes: 2 additions & 1 deletion private/src/server/config/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ module.exports = function (ROOT_PATH, DATA_PATH, MAIN_PATH) {
file: (function () {
return DATA_PATH + '/log/error.log';
})()
}
},
level: 'warn'
}
}
};
Expand Down
2 changes: 1 addition & 1 deletion private/src/server/controller/di.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ module.exports = function diController(initialServices) {
// not sure if Function.name will be legal in next ECMA script
if (('function' === typeof services[serviceName]) &&
('addService' === services[serviceName].name)) {
console.log('function ', services[serviceName].name, serviceName);
//console.log('function ', services[serviceName].name, serviceName);
services[serviceName] = services[serviceName](this);
}
return services[serviceName];
Expand Down
6 changes: 3 additions & 3 deletions private/src/server/service/logging.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@ module.exports = function logService(config, winston, newrelic) {
'use strict';

var fileName = config.log.error.file;
console.log('error log file name', fileName);
console.log('error log file name', fileName, config.log.level);

var consoleLogConfig = {
transports: [
new (winston.transports.Console)({ level: 'info', colorize: true }),
new (winston.transports.Console)({ level: 'warn', colorize: true }),
]
};

var productionLogConfig = {
transports: [
new (winston.transports.Console)({ level: 'info', colorize: true }),
new (winston.transports.Console)({ level: 'warn', colorize: true }),
new (winston.transports.File)({ filename: fileName, level: 'error' })
]
};
Expand Down

0 comments on commit b342559

Please sign in to comment.