kopia lustrzana https://github.com/OpenDroneMap/NodeODM
Merge pull request #42 from pierotofy/cpuram
Added CPU, RAM info in /info, updated API version, docspull/43/head
commit
862a6017f0
|
@ -8,7 +8,7 @@ REST API to access OpenDroneMap
|
||||||
|
|
||||||
=== Version information
|
=== Version information
|
||||||
[%hardbreaks]
|
[%hardbreaks]
|
||||||
_Version_ : 1.1.0
|
_Version_ : 1.1.1
|
||||||
|
|
||||||
|
|
||||||
=== Contact information
|
=== Contact information
|
||||||
|
@ -64,8 +64,14 @@ Retrieves information about this node
|
||||||
[options="header", cols=".^3,.^11,.^4"]
|
[options="header", cols=".^3,.^11,.^4"]
|
||||||
|===
|
|===
|
||||||
|Name|Description|Schema
|
|Name|Description|Schema
|
||||||
|
|*availableMemory* +
|
||||||
|
_optional_|Amount of RAM available in bytes|integer
|
||||||
|
|*cpuCores* +
|
||||||
|
_optional_|Number of CPU cores (virtual)|integer
|
||||||
|*taskQueueCount* +
|
|*taskQueueCount* +
|
||||||
_required_|Number of tasks currently being processed or waiting to be processed|integer
|
_required_|Number of tasks currently being processed or waiting to be processed|integer
|
||||||
|
|*totalMemory* +
|
||||||
|
_optional_|Amount of total RAM in the system in bytes|integer
|
||||||
|*version* +
|
|*version* +
|
||||||
_required_|Current version|string
|
_required_|Current version|string
|
||||||
|===
|
|===
|
||||||
|
|
File diff suppressed because one or more lines are too long
26
index.js
26
index.js
|
@ -39,6 +39,7 @@ let Task = require('./libs/Task');
|
||||||
let odmOptions = require('./libs/odmOptions');
|
let odmOptions = require('./libs/odmOptions');
|
||||||
let Directories = require('./libs/Directories');
|
let Directories = require('./libs/Directories');
|
||||||
let unzip = require('node-unzip-2');
|
let unzip = require('node-unzip-2');
|
||||||
|
let si = require('systeminformation');
|
||||||
|
|
||||||
let auth = require('./libs/auth/factory').fromConfig(config);
|
let auth = require('./libs/auth/factory').fromConfig(config);
|
||||||
const authCheck = auth.getMiddleware();
|
const authCheck = auth.getMiddleware();
|
||||||
|
@ -630,11 +631,30 @@ app.get('/options', (req, res) => {
|
||||||
* taskQueueCount:
|
* taskQueueCount:
|
||||||
* type: integer
|
* type: integer
|
||||||
* description: Number of tasks currently being processed or waiting to be processed
|
* description: Number of tasks currently being processed or waiting to be processed
|
||||||
|
* availableMemory:
|
||||||
|
* type: integer
|
||||||
|
* description: Amount of RAM available in bytes
|
||||||
|
* totalMemory:
|
||||||
|
* type: integer
|
||||||
|
* description: Amount of total RAM in the system in bytes
|
||||||
|
* cpuCores:
|
||||||
|
* type: integer
|
||||||
|
* description: Number of CPU cores (virtual)
|
||||||
*/
|
*/
|
||||||
app.get('/info', (req, res) => {
|
app.get('/info', (req, res) => {
|
||||||
res.json({
|
async.parallel({
|
||||||
version: packageJson.version,
|
cpu: cb => si.cpu(data => cb(null, data)),
|
||||||
taskQueueCount: taskManager.getQueueCount()
|
mem: cb => si.mem(data => cb(null, data)),
|
||||||
|
}, (_, data) => {
|
||||||
|
const { cpu, mem } = data;
|
||||||
|
|
||||||
|
res.json({
|
||||||
|
version: packageJson.version,
|
||||||
|
taskQueueCount: taskManager.getQueueCount(),
|
||||||
|
totalMemory: mem.total,
|
||||||
|
availableMemory: mem.available,
|
||||||
|
cpuCores: cpu.cores
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,6 @@ let rmdir = require('rimraf');
|
||||||
let odmRunner = require('./odmRunner');
|
let odmRunner = require('./odmRunner');
|
||||||
let processRunner = require('./processRunner');
|
let processRunner = require('./processRunner');
|
||||||
let archiver = require('archiver');
|
let archiver = require('archiver');
|
||||||
let os = require('os');
|
|
||||||
let Directories = require('./Directories');
|
let Directories = require('./Directories');
|
||||||
let kill = require('tree-kill');
|
let kill = require('tree-kill');
|
||||||
|
|
||||||
|
@ -356,7 +355,6 @@ module.exports = class Task{
|
||||||
}, {});
|
}, {});
|
||||||
|
|
||||||
runnerOptions["project-path"] = fs.realpathSync(Directories.data);
|
runnerOptions["project-path"] = fs.realpathSync(Directories.data);
|
||||||
runnerOptions["pmvs-num-cores"] = os.cpus().length;
|
|
||||||
|
|
||||||
if (this.gpcFiles.length > 0){
|
if (this.gpcFiles.length > 0){
|
||||||
runnerOptions.gcp = fs.realpathSync(path.join(this.getGpcFolderPath(), this.gpcFiles[0]));
|
runnerOptions.gcp = fs.realpathSync(path.join(this.getGpcFolderPath(), this.gpcFiles[0]));
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "node-opendronemap",
|
"name": "node-opendronemap",
|
||||||
"version": "1.1.0",
|
"version": "1.1.1",
|
||||||
"description": "REST API to access OpenDroneMap",
|
"description": "REST API to access OpenDroneMap",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
@ -35,6 +35,7 @@
|
||||||
"request": "^2.81.0",
|
"request": "^2.81.0",
|
||||||
"rimraf": "^2.5.3",
|
"rimraf": "^2.5.3",
|
||||||
"swagger-jsdoc": "^1.3.1",
|
"swagger-jsdoc": "^1.3.1",
|
||||||
|
"systeminformation": "^3.42.0",
|
||||||
"tree-kill": "^1.1.0",
|
"tree-kill": "^1.1.0",
|
||||||
"winston": "^2.2.0"
|
"winston": "^2.2.0"
|
||||||
},
|
},
|
||||||
|
|
Ładowanie…
Reference in New Issue