Commit 2291a063 authored by Alexandra's avatar Alexandra

forgot some details

parent 00cbbbde
var run = require('./run_scripts_sync').run;
const fs = require('fs');
var stream = fs.createWriteStream("./results/import_content.csv", {flags:'a'});
fs.truncateSync("./results/import_content.csv");
stream.write("items,time\n");
var to_run = [];
fs.readdir("./files/CONTENT/", function(err, items){
if (err) {
return console.log('Unable to scan directory: ' + err);
}
items.forEach(function (file) {
if (file.includes("zip")) to_run.push({scriptPath : './unit_tests/import_content.js', args : ['-f' ,"./files/CONTENT/"+file], amount : parseInt(file.substring(25, file.length-4))});
});
run(to_run, "./results/import_content.csv", function (err) {if (err) throw err;});
});
......@@ -20,6 +20,7 @@ module.exports = {
var invoked = false,
to_run = args.shift();
console.log(to_run.args[1]);
process = childProcess.fork(to_run.scriptPath, to_run.args);
process.on('message', function (mes){
......
......@@ -9,9 +9,8 @@ fs.readdir("./files/SITEMAP/", function(err, items){
if (err) {
return console.log('Unable to scan directory: ' + err);
}
items.forEach(function (file) {
to_run.push({scriptPath : './unit_tests/add_sitemap.js', args : ['-f' ,"./files/SITEMAP/"+file], amount : parseInt(file.substring(25, file.length-4))});
items.forEach(function (file) {
to_run.push({scriptPath : './unit_tests/add_sitemap.js', args : ['-f' ,"./files/SITEMAP/"+file], amount : parseInt(file.substring(25, file.length-4))});
});
run(to_run, "./results/sitemap.csv", function (err) {if (err) throw err;});
});
......@@ -34,6 +34,7 @@ function init_server (){
os_utils.cpuUsage(function(v){
var ramUsed = v - ramBefore;
process.send(ramUsed + "," + memUsed);
process.send("DONE");
});
});
browser.close();
......
......@@ -19,6 +19,7 @@ function init_server (){
if (msg.includes("Done")){
var now = Date.now();
process.send((now-start)/1000);
process.send("DONE");
ws.close();
browser.close();
} else {
......
......@@ -18,6 +18,7 @@ function init_server (){
var total = Date.now() - start;
//console.log("Time spent : " + total/1000 + "s");
process.send(total/1000);
process.send("DONE");
// NEED TO SEND SIZE
} else {
console.log("Error : " + msg);
......
......@@ -22,7 +22,8 @@ function init_server (){
var total = Date.now() - start;
//console.log("Time spent : " + total/1000 + "s");
process.send(total/1000);
// NEED TO SEND SIZE
process.send("DONE");
// NEED TO SEND SIZE
} else {
console.log("Error : " + msg);
browser.close();
......
......@@ -27,6 +27,7 @@ function init_server (){
} else if (msg === "JSON"){
plain = Date.now() - plain_start;
process.send(zip/1000 + "," +plain/1000);
process.send("DONE");
ws.close();
browser.close();
} else {
......
......@@ -27,6 +27,7 @@ function init_server (){
} else if (msg === "JSON"){
plain = Date.now() - plain_start;
process.send(zip/1000 + "," +plain/1000);
process.send("DONE");
ws.close();
browser.close();
} else {
......
......@@ -25,6 +25,7 @@ function init_server (){
if (msg.includes("Done")){
var time_spent = Date.now() - start;
process.send(time_spent/1000);
process.send("DONE");
// console.log(msg + " in " + time_spent/1000 + "s");
browser.close();
ws.close();
......
var run = require('./run_scripts_sync').run;
const fs = require('fs');
var stream = fs.createWriteStream("./results/import_content.csv", {flags:'a'});
fs.truncateSync("./results/import_content.csv");
stream.write("items,time\n");
var to_run = [{scriptPath : './import_content.js', args : ['-f' ,"./test_files/CONTENT/content100000.zip"], amount : 100000},
{scriptPath : './import_content.js', args : ['-f' ,"./test_files/CONTENT/content10000.zip"], amount : 10000},
{scriptPath : './import_content.js', args : ['-f' ,"./test_files/CONTENT/content1000.zip"], amount : 1000},
{scriptPath : './import_content.js', args : ['-f' ,"./test_files/CONTENT/content100.zip"], amount : 100}];
run(to_run, "./results/import_content.csv", function (err) {if (err) throw err;});
......@@ -22,6 +22,7 @@ function init_server (){
if (msg.includes("Done : ")){
var time_spent = Date.now() - start;
process.send(time_spent/1000);
process.send("DONE");
browser.close();
} else {
console.log("Error : " + msg);
......
......@@ -46,6 +46,7 @@ function init_server (){
os_utils.cpuUsage(function(v){
var ramUsed = v - ramBefore;
process.send(ramUsed + "," + memUsed+ "," + adding_total + "," + saving_total);
process.send("DONE");
});
});
browser.close();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment