Commit 12e3e025 authored by Alexandra Rogova's avatar Alexandra Rogova

clean up

parent 9475c85f
var childProcess = require('child_process');
var run = require('./run_scripts_sync').run;
const fs = require('fs');
var stream = fs.createWriteStream("./results/add_csv_attachments.csv", {flags:'a'});
function writeResult(items, info){
stream.write(items + "," + info + "\n");
}
function runScriptSync(list, callback) {
if (list.length === 0) return;
var invoked = false,
to_run = list.pop();
process = childProcess.fork(to_run.scriptPath, to_run.args);
process.on('message', function (mes){
console.log(to_run.amount + " : " + mes)
writeResult(to_run.amount, mes);
runScriptSync(list, callback);
});
process.on('error', function (err) {
if (invoked) return;
invoked = true;
callback(err);
});
process.on('exit', function (code) {
if (invoked) return;
invoked = true;
var err = code === 0 ? null : new Error('exit code ' + code);
callback(err);
});
setTimeout(() => {
stream.write(items + ",Timeout error" + "\n");
process.kill();
return;
}, 7200000); //2 hours
}
fs.truncateSync("./results/add_csv_attachments.csv");
stream.write("items,ramUsed,memUsed\n");
......@@ -44,4 +11,4 @@ var to_run = [{scriptPath : './add_csv.js', args : ['-f' ,"./test_files/CSV/100k
{scriptPath : './add_csv.js', args : ['-f' ,"./test_files/CSV/1000.csv", "-s", "attachment"], amount : 1000},
{scriptPath : './add_csv.js', args : ['-f' ,"./test_files/CSV/100.csv", "-s", "attachment"], amount : 100}];
runScriptSync(to_run, function (err) {if (err) throw err;});
run(to_run, "./results/add_csv_attachment.csv", function (err) {if (err) throw err;});
var childProcess = require('child_process');
var run = require('./run_scripts_sync').run;
const fs = require('fs');
var stream = fs.createWriteStream("./results/add_csv_metadata.csv", {flags:'a'});
function writeResult(items, info){
stream.write(items + "," + info + "\n");
}
function runScriptSync(list, callback) {
if (list.length === 0) return;
var invoked = false,
to_run = list.pop();
process = childProcess.fork(to_run.scriptPath, to_run.args);
process.on('message', function (mes){
console.log(to_run.amount + " : " + mes)
writeResult(to_run.amount, mes);
runScriptSync(list, callback);
});
process.on('error', function (err) {
if (invoked) return;
invoked = true;
callback(err);
});
process.on('exit', function (code) {
if (invoked) return;
invoked = true;
var err = code === 0 ? null : new Error('exit code ' + code);
callback(err);
});
setTimeout(() => {
stream.write(items + ",Timeout error" + "\n");
process.kill();
return;
}, 7200000); //2 hours
}
fs.truncateSync("./results/add_csv_metadata.csv");
stream.write("items,ramUsed,memUsed\n");
......@@ -44,4 +11,4 @@ var to_run = [{scriptPath : './add_csv.js', args : ['-f' ,"./test_files/CSV/100k
{scriptPath : './add_csv.js', args : ['-f' ,"./test_files/CSV/1000.csv", "-s", "metadata"], amount : 1000},
{scriptPath : './add_csv.js', args : ['-f' ,"./test_files/CSV/100.csv", "-s", "metadata"], amount : 100}];
runScriptSync(to_run, function (err) {if (err) throw err;});
run(to_run, "./results/add_csv_metadata.csv", function (err) {if (err) throw err;});
var childProcess = require('child_process');
var run = require('./run_scripts_sync').run;
const fs = require('fs');
var stream = fs.createWriteStream("./results/add_random_csv_metadata.csv", {flags:'a'});
function writeResult(items, info){
stream.write(items + "," + info + "\n");
}
function runScriptSync(list, callback) {
if (list.length === 0) return;
var invoked = false,
to_run = list.pop();
process = childProcess.fork(to_run.scriptPath, to_run.args);
process.on('message', function (mes){
console.log(to_run.amount + " : " + mes)
writeResult(to_run.amount, mes);
runScriptSync(list, callback);
});
process.on('error', function (err) {
if (invoked) return;
invoked = true;
callback(err);
});
process.on('exit', function (code) {
if (invoked) return;
invoked = true;
var err = code === 0 ? null : new Error('exit code ' + code);
callback(err);
});
setTimeout(() => {
stream.write(items + ",Timeout error" + "\n");
process.kill();
return;
}, 7200000); //2 hours
}
fs.truncateSync("./results/add_random_csv_metadata.csv");
stream.write("items,ramUsed,memUsed\n");
var to_run = [{scriptPath : './add_random_csv.js', args : ["-p", 100000, "-s", "metadata"], amount : 100000},
{scriptPath : './add_random_csv.js', args : ["-p", 50000, "-s", "metadata"], amount : 50000},
{scriptPath : './add_random_csv.js', args : ["-p", 10000, "-s", "metadata"], amount : 10000},
{scriptPath : './add_random_csv.js', args : ["-p", 5000, "-s", "metadata"], amount : 5000},
{scriptPath : './add_random_csv.js', args : ["-p", 1000, "-s", "metadata"], amount : 1000},
{scriptPath : './add_random_csv.js', args : ["-p", 100, "-s", "metadata"], amount : 100}];
var to_run = [];
for(var i = 1000000; i > 0; i-=1000){
to_run.push({scriptPath : './add_random_csv.js', args : ["-p", i, "-s", "metadata"], amount : i});
}
runScriptSync(to_run, function (err) {if (err) throw err;});
run(to_run, "./results/add_random_csv_metadata.csv", function (err) {if (err) throw err;});
var childProcess = require('child_process');
var run = require('./run_scripts_sync').run;
const fs = require('fs');
var stream = fs.createWriteStream("./results/content_csv_size.csv", {flags:'a'});
function writeResult(items, info){
stream.write(items + "," + info + "\n");
}
function runScriptSync(list, callback) {
if (list.length === 0) return;
var invoked = false,
to_run = list.pop();
process = childProcess.fork(to_run.scriptPath, to_run.args);
process.on('message', function (mes){
console.log(to_run.amount + " : " + mes)
writeResult(to_run.amount, mes);
runScriptSync(list, callback);
});
process.on('error', function (err) {
if (invoked) return;
invoked = true;
callback(err);
});
process.on('exit', function (code) {
if (invoked) return;
invoked = true;
var err = code === 0 ? null : new Error('exit code ' + code);
callback(err);
});
setTimeout(() => {
stream.write(items + ",Timeout error" + "\n");
process.kill();
return;
}, 7200000); //2 hours
}
fs.truncateSync("./results/content_csv_size.csv");
stream.write("items,uncompressed,compressed\n");
......@@ -44,4 +11,4 @@ var to_run = [{scriptPath : './download_content.js', args : ['-f' ,"./test_files
{scriptPath : './download_content.js', args : ['-f' ,"./test_files/CSV/1000.csv"], amount : 1000},
{scriptPath : './download_content.js', args : ['-f' ,"./test_files/CSV/100.csv"], amount : 100}];
runScriptSync(to_run, function (err) {if (err) throw err;});
run(to_run, "./results/content_csv_size.csv", function (err) {if (err) throw err;});
var childProcess = require('child_process');
var run = require('./run_scripts_sync').run;
const fs = require('fs');
var stream = fs.createWriteStream("./results/content_random_size.csv", {flags:'a'});
function writeResult(items, info){
stream.write(items + "," + info + "\n");
}
function runScriptSync(list, callback) {
if (list.length === 0) return;
var invoked = false,
to_run = list.pop();
process = childProcess.fork(to_run.scriptPath, to_run.args);
process.on('message', function (mes){
console.log(to_run.amount + " : " + mes)
writeResult(to_run.amount, mes);
runScriptSync(list, callback);
});
process.on('error', function (err) {
if (invoked) return;
invoked = true;
callback(err);
});
process.on('exit', function (code) {
if (invoked) return;
invoked = true;
var err = code === 0 ? null : new Error('exit code ' + code);
callback(err);
});
setTimeout(() => {
stream.write(items + ",Timeout error" + "\n");
process.kill();
return;
}, 7200000); //2 hours
}
fs.truncateSync("./results/content_random_size.csv");
stream.write("items,uncompressed,compressed\n");
var to_run = [{scriptPath : './download_content_random.js', args : ['-p' ,"100000"], amount : 100000},
{scriptPath : './download_content_random.js', args : ['-p' ,"50000"], amount : 50000},
{scriptPath : './download_content_random.js', args : ['-p' ,"10000"], amount : 10000},
{scriptPath : './download_content_random.js', args : ['-p' ,"5000"], amount : 5000},
{scriptPath : './download_content_random.js', args : ['-p' ,"1000"], amount : 1000},
{scriptPath : './download_content_random.js', args : ['-p' ,"100"], amount : 100}];
var to_run = [];
for(var i = 1000000; i > 0; i-=1000){
to_run.push({scriptPath : './download_content_random.js', args : ["-p", i], amount : i});
}
runScriptSync(to_run, function (err) {if (err) throw err;});
run(to_run, "./results/content_random_size.csv", function (err) {if (err) throw err;});
var childProcess = require('child_process');
var run = require('./run_scripts_sync').run;
const fs = require('fs');
var stream = fs.createWriteStream("./results/index_csv_size.csv", {flags:'a'});
function writeResult(items, info){
stream.write(items + "," + info + "\n");
}
function runScriptSync(list, callback) {
if (list.length === 0) return;
var invoked = false,
to_run = list.pop();
process = childProcess.fork(to_run.scriptPath, to_run.args);
process.on('message', function (mes){
console.log(to_run.amount + " : " + mes)
writeResult(to_run.amount, mes);
runScriptSync(list, callback);
});
process.on('error', function (err) {
if (invoked) return;
invoked = true;
callback(err);
});
process.on('exit', function (code) {
if (invoked) return;
invoked = true;
var err = code === 0 ? null : new Error('exit code ' + code);
callback(err);
});
setTimeout(() => {
stream.write(items + ",Timeout error" + "\n");
process.kill();
return;
}, 7200000); //2 hours
}
fs.truncateSync("./results/index_csv_size.csv");
stream.write("items,uncompressed,compressed\n");
......@@ -44,4 +11,4 @@ var to_run = [{scriptPath : './download_index.js', args : ['-f' ,"./test_files/C
{scriptPath : './download_index.js', args : ['-f' ,"./test_files/CSV/1000.csv"], amount : 1000},
{scriptPath : './download_index.js', args : ['-f' ,"./test_files/CSV/100.csv"], amount : 100}];
runScriptSync(to_run, function (err) {if (err) throw err;});
run(to_run, "./results/index_csv_size.csv", function (err) {if (err) throw err;});
var childProcess = require('child_process');
var run = require('./run_scripts_sync').run;
const fs = require('fs');
var stream = fs.createWriteStream("./results/index_random_size.csv", {flags:'a'});
function writeResult(items, info){
stream.write(items + "," + info + "\n");
}
function runScriptSync(list, callback) {
if (list.length === 0) return;
var invoked = false,
to_run = list.pop();
process = childProcess.fork(to_run.scriptPath, to_run.args);
process.on('message', function (mes){
console.log(to_run.amount + " : " + mes)
writeResult(to_run.amount, mes);
runScriptSync(list, callback);
});
process.on('error', function (err) {
if (invoked) return;
invoked = true;
callback(err);
});
process.on('exit', function (code) {
if (invoked) return;
invoked = true;
var err = code === 0 ? null : new Error('exit code ' + code);
callback(err);
});
setTimeout(() => {
stream.write(items + ",Timeout error" + "\n");
process.kill();
return;
}, 7200000); //2 hours
}
fs.truncateSync("./results/index_random_size.csv");
stream.write("items,uncompressed,compressed\n");
var to_run = [{scriptPath : './download_index_random.js', args : ['-p' ,"100000"], amount : 100000},
{scriptPath : './download_index_random.js', args : ['-p' ,"50000"], amount : 50000},
{scriptPath : './download_index_random.js', args : ['-p' ,"10000"], amount : 10000},
{scriptPath : './download_index_random.js', args : ['-p' ,"5000"], amount : 5000},
{scriptPath : './download_index_random.js', args : ['-p' ,"1000"], amount : 1000},
{scriptPath : './download_index_random.js', args : ['-p' ,"100"], amount : 100}];
var to_run = [];
for(var i = 1000000; i > 0; i-=1000){
to_run.push({scriptPath : './download_index_random.js', args : ["-p", i], amount : i});
}
runScriptSync(to_run, function (err) {if (err) throw err;});
run(to_run, "./results/index_random_size.csv", function (err) {if (err) throw err;});
var childProcess = require('child_process');
var run = require('./run_scripts_sync').run;
const fs = require('fs');
var stream = fs.createWriteStream("./results/export_content.csv", {flags:'a'});
function writeResult(items, info){
stream.write(items + "," + info + "\n");
}
function runScriptSync(list, callback) {
if (list.length === 0) return;
var invoked = false,
to_run = list.pop();
process = childProcess.fork(to_run.scriptPath, to_run.args);
process.on('message', function (mes){
console.log(to_run.amount + " : " + mes)
writeResult(to_run.amount, mes);
runScriptSync(list, callback);
});
process.on('error', function (err) {
if (invoked) return;
invoked = true;
callback(err);
});
process.on('exit', function (code) {
if (invoked) return;
invoked = true;
var err = code === 0 ? null : new Error('exit code ' + code);
callback(err);
});
setTimeout(() => {
stream.write(items + ",Timeout error" + "\n");
process.kill();
return;
}, 7200000); //2 hours
}
fs.truncateSync("./results/export_content.csv");
stream.write("items,zip,json\n");
......@@ -42,4 +9,4 @@ var to_run = [{scriptPath : './export_content.js', args : ['-f' ,"./test_files/C
{scriptPath : './export_content.js', args : ['-f' ,"./test_files/CONTENT/content1000.zip"], amount : 1000},
{scriptPath : './export_content.js', args : ['-f' ,"./test_files/CONTENT/content100.zip"], amount : 100}];
runScriptSync(to_run, function (err) {if (err) throw err;});
run(to_run, "./results/export_content.csv", function (err) {if (err) throw err;});
var childProcess = require('child_process');
const fs = require('fs');
var stream = fs.createWriteStream("./results/export_index.csv", {flags:'a'});
function writeResult(items, info){
stream.write(items + "," + info + "\n");
}
function runScriptSync(list, callback) {
if (list.length === 0) return;
var invoked = false,
to_run = list.pop();
process = childProcess.fork(to_run.scriptPath, to_run.args);
process.on('message', function (mes){
console.log(to_run.amount + " : " + mes)
writeResult(to_run.amount, mes);
runScriptSync(list, callback);
});
process.on('error', function (err) {
if (invoked) return;
invoked = true;
callback(err);
});
process.on('exit', function (code) {
if (invoked) return;
invoked = true;
var err = code === 0 ? null : new Error('exit code ' + code);
callback(err);
});
setTimeout(() => {
stream.write(items + ",Timeout error" + "\n");
process.kill();
return;
}, 7200000); //2 hours
}
fs.truncateSync("./results/export_index.csv");
stream.write("items,zip,json\n");
......@@ -44,4 +10,4 @@ var to_run = [{scriptPath : './export_index.js', args : ['-f' ,"./test_files/IND
{scriptPath : './export_index.js', args : ['-f' ,"./test_files/INDEX/index1000.json"], amount : 1000},
{scriptPath : './export_index.js', args : ['-f' ,"./test_files/INDEX/index100.json"], amount : 100}];
runScriptSync(to_run, function (err) {if (err) throw err;});
run(to_run, "./results/export_index.csv", function (err) {if (err) throw err;});
var childProcess = require('child_process');
var run = require('./run_scripts_sync').run;
const fs = require('fs');
var stream = fs.createWriteStream("./results/import_content.csv", {flags:'a'});
function writeResult(items, time){
stream.write(items + "," + time + "\n");
}
function runScriptSync(list, callback) {
if (list.length === 0) return;
var invoked = false,
to_run = list.pop();
process = childProcess.fork(to_run.scriptPath, to_run.args);
process.on('message', function (mes){
console.log(to_run.amount + " : " + mes)
writeResult(to_run.amount, mes);
runScriptSync(list, callback);
});
process.on('error', function (err) {
if (invoked) return;
invoked = true;
callback(err);
});
process.on('exit', function (code) {
if (invoked) return;
invoked = true;
var err = code === 0 ? null : new Error('exit code ' + code);
callback(err);
});
setTimeout(() => {
stream.write(items + ",Timeout error" + "\n");
process.kill();
return;
}, 7200000); //2 hours
}
fs.truncateSync("./results/import_content.csv");
stream.write("items,time\n");
......@@ -42,4 +9,4 @@ var to_run = [{scriptPath : './import_content.js', args : ['-f' ,"./test_files/C
{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}];
runScriptSync(to_run, function (err) {if (err) throw err;});
run(to_run, "./results/import_content.csv", function (err) {if (err) throw err;});
var childProcess = require('child_process');
var run = require('./run_scripts_sync').run;
const fs = require('fs');
var stream = fs.createWriteStream("./results/import_content_bulk.csv", {flags:'a'});
function writeResult(items, time){
stream.write(items + "," + time + "\n");
}
function runScriptSync(list, callback) {
if (list.length === 0) return;
var invoked = false,
to_run = list.pop();
process = childProcess.fork(to_run.scriptPath, to_run.args);
process.on('message', function (mes){
console.log(to_run.amount + " : " + mes)
writeResult(to_run.amount, mes);
runScriptSync(list, callback);
});
process.on('error', function (err) {
if (invoked) return;
invoked = true;
callback(err);
});
process.on('exit', function (code) {
if (invoked) return;
invoked = true;
var err = code === 0 ? null : new Error('exit code ' + code);
callback(err);
});
setTimeout(() => {
stream.write(items + ",Timeout error" + "\n");
process.kill();
return;
}, 7200000); //2 hours
}
fs.truncateSync("./results/import_content_bulk.csv");
stream.write("items,time\n");
......@@ -42,4 +9,4 @@ var to_run = [{scriptPath : './import_content.js', args : ['-f' ,"./test_files/C
{scriptPath : './import_content.js', args : ['-f' ,"./test_files/CONTENT/content1000.zip", '-b'], amount : 1000},
{scriptPath : './import_content.js', args : ['-f' ,"./test_files/CONTENT/content100.zip", '-b'], amount : 100}];
runScriptSync(to_run, function (err) {if (err) throw err;});
run(to_run, "./results/import_content_bulk.csv", function (err) {if (err) throw err;});
var childProcess = require('child_process');
var run = require('./run_scripts_sync').run;
const fs = require('fs');
var stream = fs.createWriteStream("./results/import_content_uncompressed.csv", {flags:'a'});
function writeResult(items, time){
stream.write(items + "," + time + "\n");
}
function runScriptSync(list, callback) {
if (list.length === 0) return;
var invoked = false,
to_run = list.pop();
process = childProcess.fork(to_run.scriptPath, to_run.args);
process.on('message', function (mes){
console.log(to_run.amount + " : " + mes)
writeResult(to_run.amount, mes);
runScriptSync(list, callback);
});
process.on('error', function (err) {
if (invoked) return;
invoked = true;
callback(err);
});
process.on('exit', function (code) {
if (invoked) return;
invoked = true;
var err = code === 0 ? null : new Error('exit code ' + code);
callback(err);
});
setTimeout(() => {
stream.write(items + ",Timeout error" + "\n");
process.kill();
return;
}, 7200000); //2 hours
}
fs.truncateSync("./results/import_content_uncompressed.csv");
stream.write("items,time\n");
......@@ -42,4 +9,4 @@ var to_run = [{scriptPath : './import_content.js', args : ['-f' ,"./test_files/C
{scriptPath : './import_content.js', args : ['-f' ,"./test_files/CONTENT/content1000.json", '-u'], amount : 1000},
{scriptPath : './import_content.js', args : ['-f' ,"./test_files/CONTENT/content100.json", '-u'], amount : 100}];
runScriptSync(to_run, function (err) {if (err) throw err;});
run(to_run, "./results/import_content_uncompressed.csv", function (err) {if (err) throw err;});
var childProcess = require('child_process');
var run = require('./run_scripts_sync').run;
const fs = require('fs');
var stream = fs.createWriteStream("./results/import_index.csv", {flags:'a'});
function writeResult(items, time){
stream.write(items + "," + time + "\n");
}
function runScriptSync(list, callback) {
if (list.length === 0) return;
var invoked = false,
to_run = list.pop();
process = childProcess.fork(to_run.scriptPath, to_run.args);
process.on('message', function (mes){
console.log(to_run.amount + " : " + mes)
writeResult(to_run.amount, mes);
runScriptSync(list, callback);
});
process.on('error', function (err) {
if (invoked) return;
invoked = true;
callback(err);
});
process.on('exit', function (code) {
if (invoked) return;
invoked = true;
var err = code === 0 ? null : new Error('exit code ' + code);
callback(err);
});
setTimeout(() => {
stream.write(items + ",Timeout error" + "\n");
process.kill();
return;
}, 7200000); //2 hours
}
fs.truncateSync("./results/import_index.csv");
stream.write("items,time\n");
......@@ -44,4 +11,4 @@ var to_run = [{scriptPath : './import_index.js', args : ['-f' ,"./test_files/IND
{scriptPath : './import_index.js', args : ['-f' ,"./test_files/INDEX/index1000.zip"], amount : 1000},
{scriptPath : './import_index.js', args : ['-f' ,"./test_files/INDEX/index100.zip"], amount : 100}];
runScriptSync(to_run, function (err) {if (err) throw err;});
run(to_run, "./results/import_index.csv", function (err) {if (err) throw err;});
var childProcess = require('child_process');
var run = require('./run_scripts_sync').run;
const fs = require('fs');
var stream = fs.createWriteStream("./results/import_index_uncompressed.csv", {flags:'a'});
function writeResult(items, time){
stream.write(items + "," + time + "\n");
}
function runScriptSync(list, callback) {
if (list.length === 0) return;
var invoked = false,
to_run = list.pop();
process = childProcess.fork(to_run.scriptPath, to_run.args);
process.on('message', function (mes){
console.log(to_run.amount + " : " + mes)
writeResult(to_run.amount, mes);
runScriptSync(list, callback);
});
process.on('error', function (err) {
if (invoked) return;
invoked = true;
callback(err);
});
process.on('exit', function (code) {
if (invoked) return;
invoked = true;
var err = code === 0 ? null : new Error('exit code ' + code);
callback(err);
});
setTimeout(() => {
stream.write(items + ",Timeout error" + "\n");
process.kill();
return;
}, 7200000); //2 hours
}
fs.truncateSync("./results/import_index_uncompressed.csv");
stream.write("items,time\n");
......@@ -44,4 +11,4 @@ var to_run = [{scriptPath : './import_index.js', args : ['-f' ,"./test_files/IND
{scriptPath : './import_index.js', args : ['-f' ,"./test_files/INDEX/index1000.json", '-u'], amount : 1000},
{scriptPath : './import_index.js', args : ['-f' ,"./test_files/INDEX/index100.json", '-u'], amount : 100}];
runScriptSync(to_run, function (err) {if (err) throw err;});
run(to_run, "./results/import_index_uncompressed.csv", function (err) {if (err) throw err;});
var childProcess = require('child_process');
var run = require('./run_scripts_sync').run;
const fs = require('fs');
var stream = fs.createWriteStream("./results/rss.csv", {flags:'a'});
// function runScript(scriptPath, args, callback) {
// var invoked = false,
// process = childProcess.fork(scriptPath, args);
// process.on('message', function (mes){
// console.log("Message from child : " + mes);
// });
// process.on('error', function (err) {
// if (invoked) return;
// invoked = true;
// callback(err);
// });
// process.on('exit', function (code) {
// if (invoked) return;
// invoked = true;
// var err = code === 0 ? null : new Error('exit code ' + code);
// callback(err);
// });
// }
function writeResult(items, time){
stream.write(items + "," + time + "\n");
}
function runScriptSync(list, callback) {
if (list.length === 0) return;
var invoked = false,
to_run = list.pop();
process = childProcess.fork(to_run.scriptPath, to_run.args);
process.on('message', function (mes){
console.log(to_run.amount + " : " + mes)
writeResult(to_run.amount, mes);
runScriptSync(list, callback);
});
process.on('error', function (err) {
if (invoked) return;
invoked = true;
callback(err);
});
process.on('exit', function (code) {
if (invoked) return;
invoked = true;
var err = code === 0 ? null : new Error('exit code ' + code);
callback(err);
});
setTimeout(() => {
stream.write(items + ",Timeout error" + "\n");
process.kill();
return;
}, 7200000); //2 hours
}
fs.truncateSync("./results/rss.csv");
stream.write("items,time \n");
......@@ -63,4 +11,4 @@ var to_run = [{scriptPath : './add_rss.js', args : ['-f' ,"./test_files/RSS/rss_
{scriptPath : './add_rss.js', args : ['-f' ,"./test_files/RSS/rss_1000.xml"], amount : 1000},
{scriptPath : './add_rss.js', args : ['-f' ,"./test_files/RSS/rss_100.xml"], amount : 100}];
runScriptSync(to_run, function (err) {if (err) throw err;});
run(to_run, "./results/rss.csv", function (err) {if (err) throw err;});
var childProcess = require('child_process');
var run = require('./run_scripts_sync').run;
const fs = require('fs');
var stream = fs.createWriteStream("./results/sitemap.csv", {flags:'a'});
function writeResult(items, time){
stream.write(items + "," + time + "\n");
}
function runScriptSync(list, callback) {
if (list.length === 0) return;
var invoked = false,
to_run = list.pop();
process = childProcess.fork(to_run.scriptPath, to_run.args);
process.on('message', function (mes){
console.log(to_run.amount + " : " + mes)
writeResult(to_run.amount, mes);
runScriptSync(list, callback);
});
process.on('error', function (err) {
if (invoked) return;
invoked = true;
callback(err);
});
process.on('exit', function (code) {
if (invoked) return;
invoked = true;
var err = code === 0 ? null : new Error('exit code ' + code);
callback(err);
});
setTimeout(() => {
stream.write(items + ",Timeout error" + "\n");
process.kill();
return;
}, 7200000); //2 hours
}
fs.truncateSync("./results/sitemap.csv");
stream.write("items,time\n");
......@@ -43,4 +10,4 @@ var to_run = [{scriptPath : './add_sitemap.js', args : ['-f' ,"./test_files/SITE
{scriptPath : './add_sitemap.js', args : ['-f' ,"./test_files/SITEMAP/sitemap1000.xml"], amount : 1000},
{scriptPath : './add_sitemap.js', args : ['-f' ,"./test_files/SITEMAP/sitemap100.xml"], amount : 100}];
runScriptSync(to_run, function (err) {if (err) throw err;});
run(to_run, "./results/sitemap.csv", function (err) {if (err) throw err;});
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