Comparing version 0.3.19 to 0.3.20
@@ -294,5 +294,6 @@ #!/usr/bin/env node | ||
var portnum = config.portbase + modelid; | ||
if (modelid.length > 2) portnum = modelid; //Enable full use of the Port on another range than the port base | ||
const callurl = config.callprotocol + "://" + config.hostname + ":" + portnum + "/" + config.callmethod.replace("/", ""); | ||
const callurlmeta = config.callprotocol + "://" + config.hostname + ":" + config.metaportnum + "/" + portnum + ".json"; | ||
const callurl = `${config.callprotocol}://${config.hostname}:${portnum}/${config.callmethod.replace("/", "")}`; | ||
const callurlmeta = `${config.callprotocol}://${config.hostname}:${config.metaportnum}/${portnum}.json`; | ||
@@ -376,2 +377,3 @@ | ||
var metaretry=3; | ||
@@ -421,3 +423,3 @@ function doTheWork(cFile, config, portnum, callurl, callurlmeta, targetOutput, x1 = -1, x2 = -1, x3 = -1, autosuffix = false) { | ||
}; | ||
console.log("Calling : " + config.hostname + ":" + portnum); | ||
console.log("Calling : " + callurl); | ||
@@ -476,20 +478,32 @@ axios.post(callurl, data, options) | ||
.catch(function (errMeta) { | ||
console.log("There was error with meta server (your file might save right anyway"); | ||
console.log("---------------------------------------------------"); | ||
console.log(errMeta.message); | ||
console.log("---------------------------------------------------"); | ||
if (metaretry> 0) | ||
{ | ||
//Launch the docker container | ||
startmeta(); | ||
metaretry = metaretry -1; | ||
console.log("\t Retrying to launch this function to do the work with the Meta hopefully started"); | ||
doTheWork(cFile, config, portnum, callurl, callurlmeta, targetOutput, x1 , x2 , x3 , autosuffix ); | ||
console.log("---------------------------------------------------"); | ||
console.log("---------TRYING TO SAVE WITHOUT META SERVER DATA----------"); | ||
console.log("---------------------------------------------------"); | ||
console.log("---------Make this faster by DISABLE astusemetasvr=false in .env ------"); | ||
console.log("---------Or start the server ------"); | ||
console.log("--"); | ||
console.log("---------------------------------------------------"); | ||
} | ||
else { | ||
saveStylizedResult(stylizedImage, data, targetOutput, config); | ||
process.exit(3); | ||
}); | ||
//@a then save result | ||
console.log("There was error with meta server (your file might save right anyway"); | ||
console.log("---------------------------------------------------"); | ||
console.log(errMeta.message); | ||
console.log("---------------------------------------------------"); | ||
console.log("---------------------------------------------------"); | ||
console.log("---------TRYING TO SAVE WITHOUT META SERVER DATA----------"); | ||
console.log("---------------------------------------------------"); | ||
console.log("---------Make this faster by DISABLE astusemetasvr=false in .env ------"); | ||
console.log("---------Or start the server ------"); | ||
console.log("--"); | ||
console.log("---------------------------------------------------"); | ||
saveStylizedResult(stylizedImage, data, targetOutput, config); | ||
process.exit(3); | ||
} | ||
}); | ||
//@a then save result | ||
// saveStylizedResult(stylizedImage, targetOutput, config); | ||
@@ -552,1 +566,20 @@ } | ||
function startmeta(){ | ||
const { exec } = require("child_process"); | ||
exec("docker start ast_meta_server", (error, stdout, stderr) => { | ||
if (error) { | ||
console.log(`error: ${error.message}`); | ||
return; | ||
} | ||
if (stderr) { | ||
console.log(`stderr: ${stderr}`); | ||
return; | ||
} | ||
console.log(`stdout: ${stdout}`); | ||
}); | ||
} |
{ | ||
"name": "gia-ast", | ||
"version": "0.3.19", | ||
"version": "0.3.20", | ||
"description": "A CLI Wrapping AST Web API calls to servers", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
116010
30
3225
18