progress
This commit is contained in:
parent
cad230eee9
commit
e163f0698b
1 changed files with 7 additions and 3 deletions
|
@ -6,20 +6,24 @@ import { MongoIdValidation } from "../../../core/validations/mongo_id_validation
|
|||
import { ProcessWatcherAndDatabaseUpdateService } from "../../datasets/domain/create_dataset_scenario";
|
||||
import { CalculationInstanceDBModel, ICalculationInstance } from "../models/calculations_instance_database_model";
|
||||
import { Result } from "../../../core/helpers/result";
|
||||
import { CreateFileUseCase } from "../../../core/usecases/create_file_usecase";
|
||||
|
||||
export class ExecCalculationInstanceProcessScenario extends CallbackStrategyWithIdQuery {
|
||||
idValidationExpression = new MongoIdValidation();
|
||||
call = async (id: string): ResponseBase =>
|
||||
(await new ReadByIdDataBaseModelUseCase<ICalculationInstance>(CalculationInstanceDBModel).call(id)).map(
|
||||
async (model) => {
|
||||
const fileOutPath = model.instancePath.pathNormalize() + "/form.json";
|
||||
return (await new IsHaveActiveProcessUseCase().call()).map(async () => {
|
||||
const execCommand = `${model.script} --form '${JSON.stringify(
|
||||
model.formBuilder
|
||||
)}' --path ${model.instancePath.pathNormalize()}`;
|
||||
const execCommand = `${model.script} --path ${model.instancePath.pathNormalize()} --form ${fileOutPath}`;
|
||||
console.log(execCommand);
|
||||
|
||||
await new CreateFileUseCase().call(fileOutPath, Buffer.from(JSON.stringify(model.formBuilder)));
|
||||
await CalculationInstanceDBModel.findById(id).updateOne({
|
||||
processStatus: "RUN",
|
||||
lastProcessExecCommand: execCommand,
|
||||
});
|
||||
|
||||
new ExecProcessUseCase().call(
|
||||
// @ts-expect-error
|
||||
`${model.project.rootDir}/`,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue