forked from wso2-attic/product-ml
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
423 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
modules/jaggeryapps/ml/site/questions/ajax/CreateWorkflow.jag
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<% | ||
var log = new Log(); | ||
var carbon = require('carbon'); | ||
var uuid = require('uuid'); | ||
|
||
var prjMgntServ = carbon.server.osgiService('org.wso2.carbon.ml.project.mgt.ProjectManagementService'); | ||
|
||
var projectId = request.getParameter('projid'); | ||
var workflowName = request.getParameter('wfname'); | ||
|
||
response.contentType = 'application/json'; | ||
|
||
try { | ||
workflowId = uuid.generate(); | ||
prjMgntServ.createNewWorkflow(workflowId, workflowId, projectId, workflowName); | ||
prjMgntServ.setDefaultFeatureSettings(projectId, workflowId); | ||
|
||
response.status = 200; | ||
response.content = { wfid : workflowId }; | ||
|
||
} catch(e) { | ||
var errorMessage = 'An error has occurred while creating workflow for project id: ' + projectId + | ||
' error message: ' + e.message; | ||
|
||
log.error(errorMessage); | ||
|
||
response.status = 500; | ||
response.content = { message : errorMessage }; | ||
} | ||
|
||
%> |
28 changes: 28 additions & 0 deletions
28
modules/jaggeryapps/ml/site/questions/ajax/DeleteWorkflow.jag
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<% | ||
var log = new Log(); | ||
var carbon = require('carbon'); | ||
|
||
var prjMgntServ = carbon.server.osgiService('org.wso2.carbon.ml.project.mgt.ProjectManagementService'); | ||
var workflowId = request.getParameter('wfid'); | ||
|
||
var statusCode = 200; | ||
var statusMsg = ''; | ||
|
||
try { | ||
prjMgntServ.deleteWorkflow(workflowId); | ||
statusMsg = 'workflow : ' + workflowId + ' successfully deleted'; | ||
|
||
} catch(e) { | ||
var msg = 'An error has occurred, while deleting workflow :' + workflowId + ' error message: ' + e.message; | ||
log.error(msg); | ||
|
||
statusMsg = msg; | ||
statusCode = 500; // internal server error | ||
|
||
} finally { | ||
response.contentType = 'application/json'; | ||
response.content = {status: statusMsg}; | ||
response.status = statusCode; | ||
} | ||
|
||
%> |
34 changes: 34 additions & 0 deletions
34
modules/jaggeryapps/ml/site/questions/ajax/GetVariables.jag
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<% | ||
var log = new Log(); | ||
var carbon = require('carbon'); | ||
var uuid = require('uuid'); | ||
|
||
var datasetServ = carbon.server.osgiService('org.wso2.carbon.ml.dataset.DatasetService'); | ||
var wfid = request.getParameter('wfid'); | ||
log.info(wfid); | ||
|
||
response.contentType = 'application/json'; | ||
|
||
try { | ||
|
||
var featues = datasetServ.getFeatureNames(wfid); | ||
var allFeatues = []; | ||
for( var i=0; i<featues.size(); i++) { | ||
allFeatues.push(featues.get(i)); | ||
} | ||
log.info('len: '+ allFeatues); | ||
|
||
response.status = 200; | ||
response.content = { names : allFeatues }; | ||
|
||
} catch(e) { | ||
var errorMessage = 'An error has occurred while extracting featues for workflow id: ' + wfid + | ||
' error message: ' + e.message; | ||
|
||
log.error(errorMessage); | ||
|
||
response.status = 500; | ||
response.content = { message : errorMessage }; | ||
} | ||
|
||
%> |
Oops, something went wrong.