--- /dev/null
+import { instance } from '../states';
+
+export const featureGroupAPI = {
+ getAllFeatureGroup: async () => {
+ return await instance.get('/featureGroup');
+ },
+ getFeatureGroup: async ({ params }) => {
+ return await instance.get(`/featureGroups/${params.featureGroupName}`);
+ },
+ createFeatureGroup: async ({ data }) => {
+ return await instance.post('/featureGroup', { ...data });
+ },
+ deleteFeatureGroup: async ({ data }) => {
+ return await instance.delete('/featureGroup', { ...data });
+ },
+};
--- /dev/null
+export * from './feature-group';
+export * from './pipeline';
+export * from './training-job';
--- /dev/null
+import { instance } from '../states';
+
+export const pipelineAPI = {
+ getPipelines: async () => {
+ return await instance.get('/pipelines');
+ },
+ getPipelineVersions: async ({ params }) => {
+ return await instance.get(`/pipelines/${params.pipelineName}/versions`);
+ },
+ uploadPipeline: async ({ params, data }) => {
+ return await instance.post(`/pipelines/${params.pipelineName}/upload`, { ...data });
+ },
+};
--- /dev/null
+import { instance } from '../states';
+
+export const trainingJobAPI = {
+ getTrainingJobByNameAndVersion: async ({ params }) => {
+ return await instance.get(`/trainingjobs/${params.trainingJobName}/${params.trainingJobVersion}`);
+ },
+ getTrainingJobStepsState: async ({ params }) => {
+ return await instance.get(`/trainingjobs/${params.trainingJobName}/${params.trainingJobVersion}/steps_state`);
+ },
+ getLatestTrainingJob: async () => {
+ return await instance.get('/trainingjobs/latest');
+ },
+ invokeTrainingJob: async ({ data }) => {
+ return await instance.post('/trainingjobs/retraining', { ...data });
+ },
+ deleteTrainingJob: async ({ data }) => {
+ return await instance.delete('/trainingjobs', { ...data });
+ },
+};
import CreateFeatureGroup from './create/CreateFeatureGroup';
import { BrowserRouter as Router, Routes, Route } from 'react-router-dom';
import NavbarComponent from './navbar/NavbarComponent';
-import * as CONSTANTS from './common/Constants';
import ListFeatureGroup from './status/ListFeatureGroup';
+import { debug_var } from '../../states';
-var DEBUG = CONSTANTS.debug_var === 'true';
+var DEBUG = debug_var === 'true';
var logger = function () {
if (DEBUG) {
console.log.apply(console, arguments);
+++ /dev/null
-// ==================================================================================
-
-// Copyright (c) 2022 Samsung Electronics Co., Ltd. All Rights Reserved.
-
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-
-// http://www.apache.org/licenses/LICENSE-2.0
-
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-// ==================================================================================
-
-export const UCMgr_baseUrl = 'http://' + process.env.REACT_APP_UCM_HOST + ':' + process.env.REACT_APP_UCM_PORT;
-export const notebook_url = 'http://' + process.env.REACT_APP_NOTEBOOK_HOST + ':' + process.env.REACT_APP_NOTEBOOK_PORT;
-export const ServiceMgr_baseUrl =
- 'http://' + process.env.REACT_APP_ServiceMgr_HOST + ':' + process.env.REACT_APP_ServiceMgr_PORT;
-export const debug_var = process.env.REACT_APP_DEBUG;
-// export const UCMgr_baseUrl = 'http://localhost:32002'
-// export const notebook_url = 'http://localhost:32088'
-// export const ServiceMgr_baseUrl = 'http://localhost:30180'
import React from 'react';
import Form from 'react-bootstrap/Form';
import Button from 'react-bootstrap/Button';
-import * as CONSTANTS from '../common/Constants';
import { convertDatalakeDBName } from '../common/CommonMethods';
-import axios from 'axios';
import './CreateFeatureGroupForm.css';
import { Row, Col } from 'react-bootstrap';
+import { instance, UCMgr_baseUrl } from '../../../states';
+import { featureGroupAPI } from '../../../apis';
class CreateFeatureGroup extends React.Component {
constructor(props) {
dbOrg: '',
measuredObjClass: '',
_measurement: '',
- UCMgr_baseUrl: CONSTANTS.UCMgr_baseUrl,
+ UCMgr_baseUrl: UCMgr_baseUrl,
};
this.regName = new RegExp('\\W+');
invokeAddFeatureGroup(event) {
this.logger('Add New Request is posted at ' + this.state.UCMgr_baseUrl + '/featureGroup');
let convertedDatalakeDBName = convertDatalakeDBName(this.state.dataLake);
- axios
- .post(this.state.UCMgr_baseUrl + '/featureGroup', {
- featureGroupName: this.state.featureGroupName,
- feature_list: this.state.featureNames,
- datalake_source: convertedDatalakeDBName,
- enable_Dme: this.state.dme,
- Host: this.state.host,
- Port: this.state.port,
- dmePort: this.state.dmePort,
- bucket: this.state.bucketName,
- token: this.state.token,
- source_name: this.state.sourceName,
- measured_obj_class: this.state.measuredObjClass,
- _measurement: this.state._measurement,
- dbOrg: this.state.dbOrg,
+
+ featureGroupAPI
+ .createFeatureGroup({
+ data: {
+ featureGroupName: this.state.featureGroupName,
+ feature_list: this.state.featureNames,
+ datalake_source: convertedDatalakeDBName,
+ enable_Dme: this.state.dme,
+ Host: this.state.host,
+ Port: this.state.port,
+ dmePort: this.state.dmePort,
+ bucket: this.state.bucketName,
+ token: this.state.token,
+ source_name: this.state.sourceName,
+ measured_obj_class: this.state.measuredObjClass,
+ _measurement: this.state._measurement,
+ dbOrg: this.state.dbOrg,
+ },
})
.then(res => {
this.logger('featureGroup Created', res.data);
import React from 'react';
import Form from 'react-bootstrap/Form';
import Button from 'react-bootstrap/Button';
-import axios from 'axios';
-import * as CONSTANTS from '../common/Constants';
import './CreateOrEditTrainingJobForm.css';
import {
getDatalakeNameWithoutConversion,
convertDatalakeDBName,
convertToCommaSeparatedString,
} from '../common/CommonMethods';
+import { instance, UCMgr_baseUrl } from '../../../states';
+import { pipelineAPI } from '../../../apis/pipeline';
class CreateTrainingJob extends React.Component {
constructor(props) {
plList: [],
expList: [],
featureGroupList: [],
- UCMgr_baseUrl: CONSTANTS.UCMgr_baseUrl,
+ UCMgr_baseUrl: UCMgr_baseUrl,
plVerList: [],
plVerName: '',
plVerDescription: '',
}
};
if (!this.props.isCreateTrainingJobForm) {
- axios
- .get(`${CONSTANTS.UCMgr_baseUrl}/trainingjobs/${this.props.trainingjob_name}/${this.props.version}`)
+ instance
+ .get(`/trainingjobs/${this.props.trainingjob_name}/${this.props.version}`)
.then(result => {
console.log('from result is: ', result.data.trainingjob);
this.setState(
plList: [],
expList: [],
featureGroupList: [],
- UCMgr_baseUrl: CONSTANTS.UCMgr_baseUrl,
+ UCMgr_baseUrl: UCMgr_baseUrl,
plVerList: [],
plVerName: result.data.trainingjob.pipeline_version,
plVerDescription: '',
}
fetchPipelines() {
- axios
- .get(this.state.UCMgr_baseUrl + '/pipelines')
+ pipelineAPI
+ .getPipelines()
.then(res => {
this.logger('Server reponded pl', res.data.pipeline_names);
- //setState because this is async response from axios, so re-render
this.setState(
{
plList: res.data.pipeline_names,
}
fetchPipelineVersions(pipeline_name, shouldGetLatestVersion) {
- axios
- .get(`${this.state.UCMgr_baseUrl}/pipelines/${pipeline_name}/versions`)
+ instance
+ .get(`/pipelines/${pipeline_name}/versions`)
.then(res => {
this.logger('Server reponded pipeline versions list', res.data.versions_list);
- //setState because this is async response from axios, so re-render
this.setState(
{
plVerList: res.data.versions_list,
}
fetchExperiments() {
- axios
- .get(this.state.UCMgr_baseUrl + '/experiments')
+ instance
+ .get('/experiments')
.then(res => {
this.logger('Server reponded exp', res.data.experiment_names);
- //setState because this is async response from axios, so re-render
this.setState(
{
expList: res.data.experiment_names,
}
fetchFeatureGroups() {
- axios
- .get(this.state.UCMgr_baseUrl + '/featureGroup')
+ instance
+ .get('/featureGroup')
.then(res => {
this.logger('Server reponded FG', res.data.featuregroups);
- //setState because this is async response from axios, so re-render
this.setState(
{
featureGroupList: res.data.featuregroups,
let hyperParamsDict = this.buildHyperparamsDict(this.state.hyparams);
let convertedDatalakeDBName = convertDatalakeDBName(this.state.datalakeSourceName);
this.logger('Add New Request is posted at ' + this.state.UCMgr_baseUrl + '/trainingjobs/' + this.state.ucName);
- axios
- .post(this.state.UCMgr_baseUrl + '/trainingjobs/' + this.state.ucName, {
+ instance
+ .post('/trainingjobs/' + this.state.ucName, {
trainingjob_name: this.state.ucName,
is_mme: this.state.isMme,
model_name: this.state.modelName,
let hyperParamsDict = this.buildHyperparamsDict(this.state.hyparams);
let convertedDatalakeDBName = convertDatalakeDBName(this.state.datalakeSourceName);
this.logger('Add New Request is posted at ' + this.state.UCMgr_baseUrl + '/trainingjobs/' + this.state.ucName);
- axios
- .put(this.state.UCMgr_baseUrl + '/trainingjobs/' + this.state.ucName, {
+ instance
+ .put('/trainingjobs/' + this.state.ucName, {
trainingjob_name: this.state.ucName,
is_mme: this.state.isMme,
model_name: this.state.modelName,
invokeStartTrainingForCreate(event) {
this.logger('Training called ');
- axios
- .post(this.state.UCMgr_baseUrl + '/trainingjobs/' + this.state.ucName + '/training', {
+ instance
+ .post('/trainingjobs/' + this.state.ucName + '/training', {
trainingjobs: this.state.ucName,
})
.then(res => {
invokeStartTrainingForEdit(event) {
this.logger('Training called ');
- axios
- .post(this.state.UCMgr_baseUrl + '/trainingjobs/' + this.state.ucName + '/training', {
+ instance
+ .post('/trainingjobs/' + this.state.ucName + '/training', {
trainingjobs: this.state.ucName,
})
.then(res => {
import React from 'react';
import Form from 'react-bootstrap/Form';
import Button from 'react-bootstrap/Button';
-import axios from 'axios';
-import * as CONSTANTS from '../common/Constants';
+
import OverlayTrigger from 'react-bootstrap/OverlayTrigger';
import Popover from 'react-bootstrap/Popover';
+import { notebook_url, UCMgr_baseUrl } from '../../../states';
+import { pipelineAPI } from '../../../apis/pipeline';
class UploadPipelineForm extends React.Component {
constructor(props) {
this.state = {
fileName: '',
plName: '',
- UCMgr_baseUrl: CONSTANTS.UCMgr_baseUrl,
+ UCMgr_baseUrl: UCMgr_baseUrl,
};
this.handleInputChange = this.handleInputChange.bind(this);
}
const data = new FormData();
data.append('file', this.state.fileName);
- let url = this.state.UCMgr_baseUrl + '/pipelines/' + this.state.plName + '/upload';
-
- //Option-3
- axios
- .post(url, data)
+ pipelineAPI
+ .uploadPipeline({ params: { pipelineName: this.state.plName }, data })
.then(res => {
console.log('Pipeline responsed ', res);
console.log('Status responsed ', res.status);
handleCreatePipeline = event => {
console.log('handleCreatePipeline clicked..', event);
- window.open(CONSTANTS.notebook_url + '/tree', '_blank');
+ window.open(notebook_url + '/tree', '_blank');
+ };
+
+ componentDidMount() {
+ this.handleGetPipelines();
+ this.handleGetPipelinesVersion();
+ }
+
+ handleGetPipelines = async () => {
+ try {
+ const response = await pipelineAPI.getPipelines();
+ console.log('Pipelines response', response);
+ } catch (error) {
+ console.error('Error in getting pipelines', error);
+ }
+ };
+
+ handleGetPipelinesVersion = async () => {
+ try {
+ const response = await pipelineAPI.getPipelineVersions({ params: { pipelineName: this.state.plName } });
+ console.log('Pipelines version response', response);
+ } catch (err) {
+ console.error('Error in getting pipelines version', err);
+ }
};
render() {
<div className='upload-pl-form'>
<Button variant='success' size='sm' onClick={e => this.handleCreatePipeline(e)}>
Create Training Function
- </Button>{' '}
+ </Button>
<Form onSubmit={this.handleSubmit}>
<Form.Group controlId='plName'>
<Form.Label>Training Function Name*</Form.Label>
// ==================================================================================
-import axios from 'axios';
-import * as CONSTANTS from '../common/Constants';
+import { featureGroupAPI } from '../../../apis/feature-group';
+import { trainingJobAPI } from '../../../apis/training-job';
export const invokeStartTraining = async trainingjobNames => {
console.log('Retraining called ', trainingjobNames);
try {
- let res = await axios.post(`${CONSTANTS.UCMgr_baseUrl}/trainingjobs/retraining`, {
- trainingjobs_list: trainingjobNames,
- });
+ let res = await trainingJobAPI.invokeTrainingJob({ data: { trainingjobs_list: trainingjobNames } });
console.log('Retraining response', res);
let result = 'Retraining initiated for selected trainingjob(s),Result' + '\n' + JSON.stringify(res.data);
alert(result);
export const deleteTrainingjobs = async deleteTJList => {
console.log('Delete API called ', deleteTJList);
try {
- let res = await axios.delete(CONSTANTS.UCMgr_baseUrl + '/trainingjobs', {
- data: {
- list: deleteTJList,
- },
- });
+ const res = await trainingJobAPI.deleteTrainingJob({ data: { data: { list: deleteTJList } } });
console.log('Delete API response', res);
let result = 'trainingjob deletion initiated for selected trainingjob(s),Result' + '\n' + JSON.stringify(res.data);
alert(result);
export const deleteFeatureGroups = async featureGroup_names => {
console.log('deleting feature groups', featureGroup_names);
try {
- let res = await axios.delete(`${CONSTANTS.UCMgr_baseUrl}/featureGroup`, {
- data: {
- featuregroups_list: featureGroup_names,
- },
- });
+ let res = await featureGroupAPI.deleteFeatureGroup({ data: { data: { featuregroups_list: featureGroup_names } } });
console.log('Deletion response', res);
let result = 'FeatureGroup deletion initiated for selected featureGroups ,Result' + '\n' + JSON.stringify(res.data);
alert(result);
import React, { useEffect, useState } from 'react';
import { Form } from 'react-bootstrap';
-import axios from 'axios';
-import { UCMgr_baseUrl } from '../common/Constants';
+import { UCMgr_baseUrl } from '../../../states';
+import { featureGroupAPI } from '../../../apis/feature-group';
const FeatureGroupInfo = props => {
const [featureGroupName, setFeatureGroupName] = useState('');
useEffect(() => {
try {
- axios
- .get(`${UCMgr_baseUrl}/featureGroup/${props.featureGroupName.featureGroupName}`)
+ featureGroupAPI
+ .getFeatureGroup({ params: { featureGroupName: props.featureGroupName.featureGroupName } })
.then(response => {
console.log(
`response for ${UCMgr_baseUrl}/trainingjobs/featureGroup/${props.featureGroupName.featureGroupName}`,
import BTable from 'react-bootstrap/Table';
import Button from 'react-bootstrap/Button';
import { useTable, useRowSelect } from 'react-table';
-import { UCMgr_baseUrl } from '../common/Constants';
-import axios from 'axios';
import { Checkbox } from './Checkbox';
import Popup from './Popup';
import FeatureGroupInfo from './FeatureGroupInfo';
import CreateFeatureGroup from '../create/CreateFeatureGroup';
import { deleteFeatureGroups } from './API_STATUS';
+import { UCMgr_baseUrl } from '../../../states';
+import { featureGroupAPI } from '../../../apis/feature-group';
const ListFeatureGroup = props => {
const logger = props.logger;
const fetchFeatureGroups = async () => {
logger('fetchFeatureGroup UCMgr_baseUrl', UCMgr_baseUrl);
try {
- const result = await axios.get(`${UCMgr_baseUrl}/featureGroup`);
+ const result = await featureGroupAPI.getAllFeatureGroup();
logger('fetchFeatureGroup Result', result);
logger('feature groups are --> ', result.data.featuregroups);
setFeatureGroups(result.data.featuregroups);
import BTable from 'react-bootstrap/Table';
import Button from 'react-bootstrap/Button';
import { useTable, useRowSelect } from 'react-table';
-import { UCMgr_baseUrl } from '../common/Constants';
-import axios from 'axios';
import { Checkbox } from './Checkbox';
import Popup from './Popup';
import TrainingJobInfo from './TrainingJobInfo';
import StepsState from './StepsState';
import CreateOrEditTrainingJobForm from '../form/CreateOrEditTrainingJobForm';
import CreateTrainingJob from '../create/CreateTrainingJob';
+import { UCMgr_baseUrl } from '../../../states';
+import { trainingJobAPI } from '../../../apis/training-job';
const StatusPageRows = props => {
const logger = props.logger;
const fetchTrainingJobs = async () => {
logger('fetchTrainingJobs UCMgr_baseUrl', UCMgr_baseUrl);
try {
- const result = await axios.get(`${UCMgr_baseUrl}/trainingjobs/latest`);
+ const result = await trainingJobAPI.getLatestTrainingJob();
logger('fetchTrainingJobs Result', result);
logger('Training Jobs are --> ', result.data.trainingjobs);
setTrainingJobs(result.data.trainingjobs);
// ==================================================================================
import React, { useEffect, useState } from 'react';
-import axios from 'axios';
import './StepsState.css';
-import { UCMgr_baseUrl } from '../common/Constants';
+import { UCMgr_baseUrl } from '../../../states';
+import { trainingJobAPI } from '../../../apis/training-job';
const StepsState = props => {
const [boxesState, setBoxesState] = useState([]);
const periodicTask = async () => {
let res = null;
try {
- res = await axios.get(
- `${UCMgr_baseUrl}/trainingjobs/${props.trainingjob_name_and_version.trainingjob_name}/${props.trainingjob_name_and_version.version}/steps_state`,
- );
+ res = await trainingJobAPI.getTrainingJobStepsState({
+ params: {
+ trainingJobName: props.trainingjob_name_and_version.trainingjob_name,
+ trainingJobVersion: props.trainingjob_name_and_version.version,
+ },
+ });
} catch (error) {
console.log(error);
}
import React, { useEffect, useState } from 'react';
import { Form } from 'react-bootstrap';
-import axios from 'axios';
-import { UCMgr_baseUrl } from '../common/Constants';
import { convertToCommaSeparatedString, getDatalakeNameWithoutConversion } from '../common/CommonMethods';
+import { UCMgr_baseUrl } from '../../../states';
+import { trainingJobAPI } from '../../../apis/training-job';
const TrainingJobInfo = props => {
const [trainingJobName, setTrainingJobName] = useState('');
useEffect(() => {
try {
- axios
- .get(
- `${UCMgr_baseUrl}/trainingjobs/${props.trainingjob_name_and_version.trainingjob_name}/${props.trainingjob_name_and_version.version}`,
- )
+ trainingJobAPI
+ .getTrainingJobByNameAndVersion({
+ params: {
+ trainingJobName: props.trainingjob_name_and_version.trainingjob_name,
+ trainingJobVersion: props.trainingjob_name_and_version.version,
+ },
+ })
.then(response => {
console.log(
`response for ${UCMgr_baseUrl}/trainingjobs/${props.trainingjob_name_and_version.trainingjob_name}/${props.trainingjob_name_and_version.version}`,
--- /dev/null
+export * from './server';
--- /dev/null
+import axios from 'axios';
+
+export const UCMgr_baseUrl = 'http://' + process.env.REACT_APP_UCM_HOST + ':' + process.env.REACT_APP_UCM_PORT;
+export const notebook_url = 'http://' + process.env.REACT_APP_NOTEBOOK_HOST + ':' + process.env.REACT_APP_NOTEBOOK_PORT;
+export const ServiceMgr_baseUrl =
+ 'http://' + process.env.REACT_APP_ServiceMgr_HOST + ':' + process.env.REACT_APP_ServiceMgr_PORT;
+export const debug_var = process.env.REACT_APP_DEBUG;
+// export const UCMgr_baseUrl = 'http://localhost:32002';
+// export const notebook_url = 'http://localhost:32088';
+// export const ServiceMgr_baseUrl = 'http://localhost:30180';
+
+export const BaseInstanceConfig = {
+ baseURL: UCMgr_baseUrl,
+ headers: {
+ 'Content-Type': 'application/json',
+ },
+ timeout: 3000,
+};
+
+export const instance = axios.create(BaseInstanceConfig);
--- /dev/null
+export * from './axios';