Skip to content

Commit

Permalink
Merge pull request #128 from camicroscope/develop
Browse files Browse the repository at this point in the history
For 3.9.8
  • Loading branch information
birm authored Oct 21, 2021
2 parents 63b3aab + e60751f commit f435f6f
Show file tree
Hide file tree
Showing 3 changed files with 121 additions and 4,722 deletions.
33 changes: 25 additions & 8 deletions caracal.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,15 @@ const proxyHandler = require('./handlers/proxyHandler.js');
const permissionHandler = require('./handlers/permssionHandler.js');
const dataHandlers = require('./handlers/dataHandlers.js');
const sanitizeBody = require('./handlers/sanitizeHandler.js');
const DataSet = require('./handlers/datasetHandler.js');
const Model = require('./handlers/modelTrainer.js');
const DataTransformationHandler = require('./handlers/dataTransformationHandler.js');
// TODO validation of data

// TODO -- make optional
const DISABLE_TF = true; // DUE TO PRODUCTION STABILITY ISSUES WITH TFJS

if (!DISABLE_TF) {
const DataSet = require('./handlers/datasetHandler.js');
const Model = require('./handlers/modelTrainer.js');
}

const {connector} = require("./service/database/connector");

Expand Down Expand Up @@ -79,10 +84,6 @@ var HANDLERS = {
"permissionHandler": permissionHandler,
"editHandler": auth.editHandler,
"proxyHandler": proxyHandler,
"getDataset": DataSet.getDataset,
"trainModel": Model.trainModel,
"deleteDataset": DataSet.deleteData,
"sendTrainedModel": Model.sendTrainedModel,
"iipHandler": function() {
return iipHandler;
},
Expand Down Expand Up @@ -115,6 +116,23 @@ var HANDLERS = {
},
};

if (!DISABLE_TF) {
HANDLERS["getDataset"] = DataSet.getDataset;
HANDLERS["trainModel"] = Model.trainModel;
HANDLERS["deleteDataset"] = DataSet.deleteData;
HANDLERS["sendTrainedModel"] = Model.sendTrainedModel;
} else {
function disabledRoute() {
return function(req, res) {
res.status(500).send('{"err":"This TF route is disabled"}');
};
}
HANDLERS["getDataset"] = disabledRoute;
HANDLERS["trainModel"] = disabledRoute;
HANDLERS["deleteDataset"] = disabledRoute;
HANDLERS["sendTrainedModel"] = disabledRoute;
}

// register configurable services
// TODO verify all
for (let i in routeConfig) {
Expand Down Expand Up @@ -211,4 +229,3 @@ connector.init().then(() => {
});

module.exports = app; // for tests

Loading

0 comments on commit f435f6f

Please sign in to comment.