progress
This commit is contained in:
parent
a0cee0b394
commit
89d4226ea6
3 changed files with 10 additions and 9 deletions
|
@ -16,23 +16,26 @@ export class ExecWeightProcessScenario extends CallbackStrategyWithIdQuery {
|
|||
return (await new IsHaveActiveProcessUseCase().call()).map(async () => {
|
||||
await WeightDBModel.findById(id).updateOne({ processStatus: "RUN" });
|
||||
return match(model.processStatus)
|
||||
.with("exec", "RUN", "none", () => this.exec(id, model, false))
|
||||
.with("exec", "RUN", "none", () => this.exec(id, model))
|
||||
.with("exec", "RUN", () => this.exec(id, model, true))
|
||||
.otherwise(() => Result.error(`model status is ${model.processStatus}`));
|
||||
});
|
||||
});
|
||||
|
||||
exec = (id: string, model: IWeightModel, preTrain: boolean) =>
|
||||
exec = (id: string, model: IWeightModel, preTrain?: boolean) =>
|
||||
match(typeof model.project === "object" && typeof model.datasetId === "object")
|
||||
.returnType<ResponseBase>()
|
||||
.with(true, async () => {
|
||||
if (typeof model.project === "object" && typeof model.datasetId === "object") {
|
||||
console.log(
|
||||
`python3 $PYTHON_EDUCATION --path ${model.project.rootDir}/${FolderStructure.datasets} --name ${model.name} --datasetName ${model.datasetId.name} --outpath ${model.project.rootDir}/${FolderStructure.weights} --type ${model.datasetId.formBuilder.output.typedataset} --epoch ${model.epoch} --pretrain ${preTrain}`
|
||||
);
|
||||
let execCommand = `python3 $PYTHON_EDUCATION --path ${model.project.rootDir}/${FolderStructure.datasets} --name ${model.name} --datasetName ${model.datasetId.name} --outpath ${model.project.rootDir}/${FolderStructure.weights} --type ${model.datasetId.formBuilder.output.typedataset} --epoch ${model.epoch}`;
|
||||
|
||||
if (preTrain) {
|
||||
execCommand += ` --pretrain`;
|
||||
}
|
||||
console.log(execCommand);
|
||||
return await new ExecProcessUseCase().call(
|
||||
`${model.project.rootDir}/`,
|
||||
`python3 $PYTHON_EDUCATION --path ${model.project.rootDir}/${FolderStructure.datasets} --name ${model.name} --datasetName ${model.datasetId.name} --outpath ${model.project.rootDir}/${FolderStructure.weights} --type ${model.datasetId.formBuilder.output.typedataset} --epoch ${model.epoch} --pretrain ${preTrain}`,
|
||||
execCommand,
|
||||
id,
|
||||
new ProcessWatcherAndDatabaseUpdateService(id as unknown as ObjectId, WeightDBModel)
|
||||
);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue