| import { runWorker } from "@/Core/WebWorkers/RunWorker"; |
| import { QueueParent } from "@/Queue/QueueParent"; |
| import { IJobInfo } from "@/Queue/QueueTypes"; |
| import { IFpocketParams } from "./FPocketWebTypes"; |
| import { FileInfo } from "@/FileSystem/FileInfo"; |
|
|
| |
| |
| |
| export class FPocketWebQueue extends QueueParent { |
| |
| |
| |
| |
| |
| |
| |
| public runJobBatch( |
| inputBatch: IJobInfo[], |
| procs: number |
| ): Promise<IJobInfo[]> { |
| const inputs = inputBatch.map((jobInfo) => jobInfo.input); |
| |
| const inputs2 = inputs.map((i) => { |
| const pdbFile = i.pdbFile as FileInfo; |
| return { |
| pdbName: pdbFile.name, |
| pdbContents: pdbFile.contents, |
| userArgs: i.fpocketParams as IFpocketParams |
| }; |
| }); |
|
|
| return runWorker( |
| new Worker(new URL("./FPocketWeb.worker", import.meta.url)), |
| inputs2, |
| true |
| ) |
| .then((outputBatch) => { |
| |
| for (let i = 0; i < inputBatch.length; i++) { |
| inputBatch[i].output = outputBatch[i]; |
| } |
| return inputBatch; |
| }) |
| .catch((err) => { |
| throw err; |
| }); |
| } |
| } |
|
|