decentralized-internet
Version:
An NPM library of programs to create decentralized web and distributed computing projects
1 lines • 1.71 kB
JavaScript
var clusterpost=require("clusterpost-lib"),path=require("path"),Promise=require("bluebird"),argv=require("minimist")(process.argv.slice(2));const _=require("underscore"),os=require("os");var agentoptions={rejectUnauthorized:!1};clusterpost.setAgentOptions(agentoptions);const help=function(){console.error("Help: Submit tasks to the server. Parses a command line, uploads the data and runs the task."),console.error("\nOptional parameters:"),console.error("--parse_cli 'command as you would run it locally in your computer. It will only print the job'"),console.error("--parse_cli_submit 'Parses cli and submits the task'"),console.error("--executionserver 'name of computing grid, uses the first one by default'")};(argv.h||argv.help)&&(console.error("Help: Submit tasks to the server. Parses a command line, uploads the data and runs the task."),console.error("\nOptional parameters:"),console.error("--parse_cli 'command as you would run it locally in your computer. It will only print the job'"),console.error("--parse_cli_submit 'Parses cli and submits the task'"),console.error("--executionserver 'name of computing grid, uses the first one by default'"),process.exit(1));var config_codename="clusterpost";argv.config_codename&&(config_codename=argv.config_codename),clusterpost.start(path.join(os.homedir(),"."+config_codename+".json")).then(function(){if(argv.parse_cli){var e=process.argv.slice(process.argv.indexOf("--parse_cli")+1);return clusterpost.parseCLI(e)}if(argv.parse_cli_submit){e=process.argv.slice(process.argv.indexOf("--parse_cli_submit")+1);return clusterpost.parseCLIAndSubmit(e,argv.executionserver)}}).then(function(e){console.log(JSON.stringify(e,null,4))}).catch(console.error);