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
|
||||
[%hardbreaks]
|
||||
_Version_ : 1.1.0
|
||||
_Version_ : 1.1.1
|
||||
|
||||
|
||||
=== Contact information
|
||||
|
@ -64,8 +64,14 @@ Retrieves information about this node
|
|||
[options="header", cols=".^3,.^11,.^4"]
|
||||
|===
|
||||
|Name|Description|Schema
|
||||
|*availableMemory* +
|
||||
_optional_|Amount of RAM available in bytes|integer
|
||||
|*cpuCores* +
|
||||
_optional_|Number of CPU cores (virtual)|integer
|
||||
|*taskQueueCount* +
|
||||
_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* +
|
||||
_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 Directories = require('./libs/Directories');
|
||||
let unzip = require('node-unzip-2');
|
||||
let si = require('systeminformation');
|
||||
|
||||
let auth = require('./libs/auth/factory').fromConfig(config);
|
||||
const authCheck = auth.getMiddleware();
|
||||
|
@ -630,11 +631,30 @@ app.get('/options', (req, res) => {
|
|||
* taskQueueCount:
|
||||
* type: integer
|
||||
* 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) => {
|
||||
res.json({
|
||||
version: packageJson.version,
|
||||
taskQueueCount: taskManager.getQueueCount()
|
||||
async.parallel({
|
||||
cpu: cb => si.cpu(data => cb(null, data)),
|
||||
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 processRunner = require('./processRunner');
|
||||
let archiver = require('archiver');
|
||||
let os = require('os');
|
||||
let Directories = require('./Directories');
|
||||
let kill = require('tree-kill');
|
||||
|
||||
|
@ -356,7 +355,6 @@ module.exports = class Task{
|
|||
}, {});
|
||||
|
||||
runnerOptions["project-path"] = fs.realpathSync(Directories.data);
|
||||
runnerOptions["pmvs-num-cores"] = os.cpus().length;
|
||||
|
||||
if (this.gpcFiles.length > 0){
|
||||
runnerOptions.gcp = fs.realpathSync(path.join(this.getGpcFolderPath(), this.gpcFiles[0]));
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "node-opendronemap",
|
||||
"version": "1.1.0",
|
||||
"version": "1.1.1",
|
||||
"description": "REST API to access OpenDroneMap",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
|
@ -35,6 +35,7 @@
|
|||
"request": "^2.81.0",
|
||||
"rimraf": "^2.5.3",
|
||||
"swagger-jsdoc": "^1.3.1",
|
||||
"systeminformation": "^3.42.0",
|
||||
"tree-kill": "^1.1.0",
|
||||
"winston": "^2.2.0"
|
||||
},
|
||||
|
|
Ładowanie…
Reference in New Issue