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 () => {
|
return (await new IsHaveActiveProcessUseCase().call()).map(async () => {
|
||||||
await WeightDBModel.findById(id).updateOne({ processStatus: "RUN" });
|
await WeightDBModel.findById(id).updateOne({ processStatus: "RUN" });
|
||||||
return match(model.processStatus)
|
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))
|
.with("exec", "RUN", () => this.exec(id, model, true))
|
||||||
.otherwise(() => Result.error(`model status is ${model.processStatus}`));
|
.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")
|
match(typeof model.project === "object" && typeof model.datasetId === "object")
|
||||||
.returnType<ResponseBase>()
|
.returnType<ResponseBase>()
|
||||||
.with(true, async () => {
|
.with(true, async () => {
|
||||||
if (typeof model.project === "object" && typeof model.datasetId === "object") {
|
if (typeof model.project === "object" && typeof model.datasetId === "object") {
|
||||||
console.log(
|
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}`;
|
||||||
`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}`
|
|
||||||
);
|
if (preTrain) {
|
||||||
|
execCommand += ` --pretrain`;
|
||||||
|
}
|
||||||
|
console.log(execCommand);
|
||||||
return await new ExecProcessUseCase().call(
|
return await new ExecProcessUseCase().call(
|
||||||
`${model.project.rootDir}/`,
|
`${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,
|
id,
|
||||||
new ProcessWatcherAndDatabaseUpdateService(id as unknown as ObjectId, WeightDBModel)
|
new ProcessWatcherAndDatabaseUpdateService(id as unknown as ObjectId, WeightDBModel)
|
||||||
);
|
);
|
||||||
|
|
|
@ -8,8 +8,6 @@ args = parser.parse_args()
|
||||||
|
|
||||||
def copy_and_move_folder(src, dst):
|
def copy_and_move_folder(src, dst):
|
||||||
try:
|
try:
|
||||||
if os.path.exists(src) is False:
|
|
||||||
shutil.rmtree(src)
|
|
||||||
shutil.copytree(src, dst)
|
shutil.copytree(src, dst)
|
||||||
print(f"Folder {src} successfully copied")
|
print(f"Folder {src} successfully copied")
|
||||||
except shutil.Error as e:
|
except shutil.Error as e:
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"assets": [
|
"assets": [
|
||||||
{ "name": "bear_holder", "mesh": "./mesh/fork.stl", "image": "./images/bear_holder_220425.png" },
|
{ "name": "fork", "mesh": "./mesh/fork.stl", "image": "./images/bear_holder_220425.png" },
|
||||||
{ "name": "bear_holder1", "mesh": "./mesh/fork.stl", "image": "./images/bear_holder_220425.png" }
|
{ "name": "bear_holder1", "mesh": "./mesh/fork.stl", "image": "./images/bear_holder_220425.png" }
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue