<commit_before>
var _ = require('underscore');
var argv = require('minimist')(process.argv.slice(2));
var path = require('path');
var fs = require('fs');


var submit = argv["submit"];
var jobid = argv["j"];
var force = argv["f"];

var status = argv["status"];

var kill = argv["kill"];

var jobdelete = argv["delete"];

var help = function(){
    console.error("help: To execute the program you must specify the job id. ")
    console.error(process.argv[0] + " " + process.argv[1] + " -j <jobid>");
    console.error("To configure the couchdb, check conf.*.json");
    console.error("Options:");
    console.error("--submit 	Submit the job.");
    console.error("-f  			force job submission");
    console.error("--status  	get job status");
    console.error("--kill  		kill job");
    console.error("--delete  	delete job");
}

if(!jobid || !submit && !status && !kill && !jobdelete){
    help();
    process.exit(1);
}

const getConfigFile = function (base_directory) {
  try {
    // Try to load the user's personal configuration file
    return require(path.join(base_directory, 'conf.my.json'));
  } catch (e) {
    // Else, read the default configuration file
    return require(path.join(base_directory, 'conf.json'));
  }
};

var confpath = __dirname;
if(module.parent && module.parent.filename){
    confpath = path.dirname(module.parent.filename);
}

var conf = getConfigFile(confpath);

try{
    var tokenfile = path.join(confpath, ".token");
    _.extend(conf, JSON.parse(fs.readFileSync(tokenfile)));
}catch(e){    
    console.error(e);
    process.exit(1);
}

var executionmethods = require(path.join(__dirname, 'executionserver.methods'))(conf);
var clusterengine = require(path.join(__dirname, conf.engine))(conf);

if(jobdelete){
	try{
		require(path.join(__dirname, "jobdelete"))(jobid, conf);
		process.exit();
	}catch(e){
        console.error(e);
        process.exit(1);
    }
}

executionmethods.getDocument(jobid)
.then(function(doc){ 

	if(submit){
		return require(path.join(__dirname, "jobsubmit"))(doc, force, conf);
	}else if(status){
		return require(path.join(__dirname, "jobstatus"))(doc, conf);
	}else if(kill){<commit_msg>STYLE: Print the job id when is deleted<commit_after>
var _ = require('underscore');
var argv = require('minimist')(process.argv.slice(2));
var path = require('path');
var fs = require('fs');


var submit = argv["submit"];
var jobid = argv["j"];
var force = argv["f"];

var status = argv["status"];

var kill = argv["kill"];

var jobdelete = argv["delete"];

var help = function(){
    console.error("help: To execute the program you must specify the job id. ")
    console.error(process.argv[0] + " " + process.argv[1] + " -j <jobid>");
    console.error("To configure the couchdb, check conf.*.json");
    console.error("Options:");
    console.error("--submit 	Submit the job.");
    console.error("-f  			force job submission");
    console.error("--status  	get job status");
    console.error("--kill  		kill job");
    console.error("--delete  	delete job");
}

if(!jobid || !submit && !status && !kill && !jobdelete){
    help();
    process.exit(1);
}

const getConfigFile = function (base_directory) {
  try {
    // Try to load the user's personal configuration file
    return require(path.join(base_directory, 'conf.my.json'));
  } catch (e) {
    // Else, read the default configuration file
    return require(path.join(base_directory, 'conf.json'));
  }
};

var confpath = __dirname;
if(module.parent && module.parent.filename){
    confpath = path.dirname(module.parent.filename);
}

var conf = getConfigFile(confpath);

try{
    var tokenfile = path.join(confpath, ".token");
    _.extend(conf, JSON.parse(fs.readFileSync(tokenfile)));
}catch(e){    
    console.error(e);
    process.exit(1);
}

var executionmethods = require(path.join(__dirname, 'executionserver.methods'))(conf);
var clusterengine = require(path.join(__dirname, conf.engine))(conf);

if(jobdelete){
	try{
		require(path.join(__dirname, "jobdelete"))(jobid, conf);
        console.log("Deleted: ", jobid);
		process.exit();
	}catch(e){
        console.error(e);
        process.exit(1);
    }
}

executionmethods.getDocument(jobid)
.then(function(doc){ 

	if(submit){
		return require(path.join(__dirname, "jobsubmit"))(doc, force, conf);
	}else if(status){
		return require(path.join(__dirname, "jobstatus"))(doc, conf);
	}else if(kill){
{'fraction_non_alphanumeric': 0.1749144811858609, 'fraction_numerical': 0.0027366020524515395, 'mean_word_length': 4.135831381733021, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1667912', 'n_tokens_mistral': 1437, 'n_tokens_neox': 1418, 'n_words': 328}