progress
This commit is contained in:
parent
89d4226ea6
commit
4585d079f6
19 changed files with 149 additions and 30 deletions
|
@ -124,3 +124,4 @@ export class App extends TypedEvent<ServerStatus> {
|
|||
return rootDir + "public/";
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -5,12 +5,12 @@ import {
|
|||
import { pipelineRealTimeService } from "../../features/_realtime/realtime_presentation";
|
||||
import { App } from "../controllers/app";
|
||||
import { CreateFolderUseCase } from "../usecases/create_folder_usecase";
|
||||
import { SearchDataBaseModelUseCase } from "../usecases/search_database_model_usecase";
|
||||
import { SearchOneDataBaseModelUseCase } from "../usecases/search_database_model_usecase";
|
||||
|
||||
export class SetLastActivePipelineToRealTimeServiceScenario {
|
||||
call = async (): Promise<void> => {
|
||||
return (
|
||||
await new SearchDataBaseModelUseCase<IProjectInstanceModel>(ProjectInstanceDbModel).call({
|
||||
await new SearchOneDataBaseModelUseCase<IProjectInstanceModel>(ProjectInstanceDbModel).call({
|
||||
isActive: true,
|
||||
})
|
||||
).fold(
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { Result } from "../helpers/result";
|
||||
|
||||
export class SearchDataBaseModelUseCase<T> {
|
||||
export class SearchOneDataBaseModelUseCase<T> {
|
||||
model: any;
|
||||
|
||||
constructor(model: any) {
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
import { Result } from "../helpers/result";
|
||||
|
||||
export class SearchManyDataBaseModelUseCase<T> {
|
||||
model: any;
|
||||
|
||||
constructor(model: any) {
|
||||
this.model = model;
|
||||
}
|
||||
|
||||
call = async (findFilter: Partial<T>, error: string = "not found database"): Promise<Result<string, T>> => {
|
||||
const result = await this.model.find(findFilter);
|
||||
if (result === null) {
|
||||
return Result.error(error);
|
||||
} else {
|
||||
return Result.ok(result);
|
||||
}
|
||||
};
|
||||
}
|
|
@ -4,7 +4,7 @@ import { Result } from "../../../core/helpers/result";
|
|||
import { TypedEvent } from "../../../core/helpers/typed_event";
|
||||
import { EXEC_EVENT, ExecError, SpawnError } from "../../../core/models/exec_error_model";
|
||||
import { ExecutorResult } from "../../../core/models/executor_result";
|
||||
import { SearchDataBaseModelUseCase } from "../../../core/usecases/search_database_model_usecase";
|
||||
import { SearchOneDataBaseModelUseCase } from "../../../core/usecases/search_database_model_usecase";
|
||||
import { IProjectModel, ProjectDBModel } from "../../_projects/models/project_database_model";
|
||||
import { DatasetDBModel } from "../models/dataset_database_model";
|
||||
import { DatasetValidationModel, ProcessStatus } from "../models/dataset_validation_model";
|
||||
|
@ -53,7 +53,7 @@ export class CreateDataSetScenario extends CallbackStrategyWithValidationModel<D
|
|||
validationModel: DatasetValidationModel;
|
||||
call = async (model: DatasetValidationModel): ResponseBase => {
|
||||
return (
|
||||
await new SearchDataBaseModelUseCase<IProjectModel>(ProjectDBModel).call({ isActive: true }, "no active projects")
|
||||
await new SearchOneDataBaseModelUseCase<IProjectModel>(ProjectDBModel).call({ isActive: true }, "no active projects")
|
||||
).map(async (project) => {
|
||||
model.processStatus = ProcessStatus.NEW;
|
||||
model.local_path = project.rootDir;
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
import { CallbackStrategyWithEmpty, ResponseBase } from "../../../core/controllers/http_controller";
|
||||
import { Result } from "../../../core/helpers/result";
|
||||
import { SearchDataBaseModelUseCase } from "../../../core/usecases/search_database_model_usecase";
|
||||
import { SearchOneDataBaseModelUseCase } from "../../../core/usecases/search_database_model_usecase";
|
||||
import { IProjectModel, ProjectDBModel } from "../../_projects/models/project_database_model";
|
||||
import { DatasetDBModel } from "../models/dataset_database_model";
|
||||
|
||||
export class GetDatasetActiveProjectScenario extends CallbackStrategyWithEmpty {
|
||||
call = async (): ResponseBase => {
|
||||
return (
|
||||
await new SearchDataBaseModelUseCase<IProjectModel>(ProjectDBModel).call({ isActive: true }, "no active projects")
|
||||
await new SearchOneDataBaseModelUseCase<IProjectModel>(ProjectDBModel).call({ isActive: true }, "no active projects")
|
||||
).map(async (project) => {
|
||||
return Result.ok(await DatasetDBModel.find({ project: project._id }));
|
||||
});
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
import { CallbackStrategyWithEmpty, ResponseBase } from "../../../core/controllers/http_controller";
|
||||
import { Result } from "../../../core/helpers/result";
|
||||
import { SearchDataBaseModelUseCase } from "../../../core/usecases/search_database_model_usecase";
|
||||
import { SearchOneDataBaseModelUseCase } from "../../../core/usecases/search_database_model_usecase";
|
||||
import { IProjectModel, ProjectDBModel } from "../../_projects/models/project_database_model";
|
||||
|
||||
export class GetActiveProjectScenario extends CallbackStrategyWithEmpty {
|
||||
async call(): ResponseBase {
|
||||
async call(): Promise<Result<any, { id: string }>> {
|
||||
return (
|
||||
await new SearchDataBaseModelUseCase<IProjectModel>(ProjectDBModel).call({ isActive: true }, "no active projects")
|
||||
await new SearchOneDataBaseModelUseCase<IProjectModel>(ProjectDBModel).call({ isActive: true }, "no active projects")
|
||||
).map((model) => Result.ok({ id: model._id }));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ export class ExecWeightProcessScenario extends CallbackStrategyWithIdQuery {
|
|||
await WeightDBModel.findById(id).updateOne({ processStatus: "RUN" });
|
||||
return match(model.processStatus)
|
||||
.with("exec", "RUN", "none", () => this.exec(id, model))
|
||||
.with("exec", "RUN", () => this.exec(id, model, true))
|
||||
.with('before_training' , () => this.exec(id, model, true))
|
||||
.otherwise(() => Result.error(`model status is ${model.processStatus}`));
|
||||
});
|
||||
});
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
import { ResponseBase } from "../../../core/controllers/http_controller";
|
||||
import { SearchManyDataBaseModelUseCase } from "../../../core/usecases/search_many_database_model_usecase";
|
||||
import { GetActiveProjectScenario } from "../../projects/domain/get_active_project_scenario";
|
||||
import { IWeightModel, WeightDBModel } from "../models/weights_validation_model";
|
||||
|
||||
export class GetAllWeightsActiveProjectScenarios {
|
||||
call = async (): ResponseBase =>
|
||||
(await new GetActiveProjectScenario().call()).map(
|
||||
async (model) => await new SearchManyDataBaseModelUseCase<IWeightModel>(WeightDBModel).call({ project: model.id })
|
||||
);
|
||||
}
|
|
@ -20,6 +20,7 @@ export const WeightSchema = new Schema({
|
|||
},
|
||||
numberOfTrainedEpochs: {
|
||||
type: Number,
|
||||
default:0,
|
||||
},
|
||||
neuralNetworkName: {
|
||||
type: String,
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import { CrudController } from "../../core/controllers/crud_controller";
|
||||
import { ExecWeightProcessScenario } from "./domain/exec_weights_process_scenario";
|
||||
import { GetAllWeightsActiveProjectScenarios } from "./domain/get_all_weights_active_project_scenarios";
|
||||
import { WeightValidationModel } from "./models/weights_database_model";
|
||||
import { WeightDBModel } from "./models/weights_validation_model";
|
||||
|
||||
|
@ -10,6 +11,7 @@ export class WeightsPresentation extends CrudController<WeightValidationModel, t
|
|||
validationModel: WeightValidationModel,
|
||||
databaseModel: WeightDBModel,
|
||||
});
|
||||
super.get(new GetAllWeightsActiveProjectScenarios().call);
|
||||
this.subRoutes.push({
|
||||
method: "GET",
|
||||
subUrl: "exec",
|
||||
|
|
|
@ -11,4 +11,3 @@ const socketSubscribers = [new SocketSubscriber(executorProgramService, "realtim
|
|||
|
||||
new App(httpRoutes, socketSubscribers).listen();
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue