Skip to content

Commit

Permalink
No more FS access in workers
Browse files Browse the repository at this point in the history
  • Loading branch information
pverscha committed Oct 5, 2020
1 parent 94185e9 commit 1ccc6c5
Show file tree
Hide file tree
Showing 46 changed files with 548 additions and 782 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ jobs:
- uses: actions/setup-node@v1
- name: Install dependencies
run: npm install
- name: Patch dependencies
run: npx patch-package
- name: Build application for ${{ matrix.os }}
run: npm run electron:publish
env:
Expand Down
34 changes: 17 additions & 17 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 2 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "unipept-desktop",
"version": "0.3.1",
"version": "0.4.0",
"private": true,
"author": "Unipept Team (Ghent University)",
"description": "A desktop equivalent of unipept.ugent.be. This app aims at high-throughput analysis of metaproteomics samples.",
Expand Down Expand Up @@ -43,11 +43,9 @@
"follow-redirects": "^1.11.0",
"jquery": "^3.4.1",
"node-abi": "^2.18.0",
"patch-package": "^6.2.2",
"regenerator-runtime": "^0.13.3",
"shared-memory-datastructures": "0.1.8",
"threads": "^1.4.1",
"unipept-web-components": "file:unipept-web-components-1.2.2.tgz",
"unipept-web-components": "1.2.3",
"uuid": "^7.0.3",
"vue": "^2.6.12",
"vue-class-component": "^7.1.0",
Expand Down Expand Up @@ -85,7 +83,6 @@
"sass-loader": "^7.1.0",
"speed-measure-webpack-plugin": "^1.3.3",
"style-loader": "^1.0.0",
"threads-plugin": "^1.3.1",
"typescript": "^3.9.5",
"vue-cli-plugin-electron-builder": "^2.0.0-rc.4",
"vue-cli-plugin-styleguidist": "^4.2.3",
Expand Down
57 changes: 0 additions & 57 deletions patches/better-sqlite3+7.0.1.patch

This file was deleted.

67 changes: 0 additions & 67 deletions patches/bindings+1.5.0.patch

This file was deleted.

3 changes: 1 addition & 2 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ import ConfigurationManager from "./logic/configuration/ConfigurationManager";
import Configuration from "./logic/configuration/Configuration";
import ErrorListener from "@/logic/filesystem/ErrorListener";
const electron = require("electron");
import Worker from "worker-loader?inline=fallback!./logic/system/DesktopWorker.worker";
import {
Assay,
ProteomicsAssay,
Expand Down Expand Up @@ -205,7 +204,7 @@ export default class App extends Vue implements ErrorListener {
let config: Configuration = await configurationManager.readConfiguration();
NetworkConfiguration.BASE_URL = config.apiSource;
NetworkConfiguration.PARALLEL_API_REQUESTS = config.maxParallelRequests;
QueueManager.initializeQueue(config.maxLongRunningTasks, () => new Worker());
QueueManager.initializeQueue(config.maxLongRunningTasks);
await this.$store.dispatch("setUseNativeTitlebar", config.useNativeTitlebar);
} catch (err) {
// TODO: show a proper error message to the user in case this happens
Expand Down
2 changes: 1 addition & 1 deletion src/background.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ async function createWindow() {
let options = {
width: 1200,
height: 1000,
webPreferences: { nodeIntegration: true, nodeIntegrationInWorker: true, enableRemoteModule: true },
webPreferences: { nodeIntegration: true, enableRemoteModule: true },
show: false
};

Expand Down
5 changes: 2 additions & 3 deletions src/components/navigation-drawers/AssayItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ export default class AssayItem extends Vue {
newAssay.setSearchConfiguration(searchConfiguration);
const metadataWriter = new AssayFileSystemMetaDataWriter(
`${this.$store.getters.projectLocation}${this.study.getName()}`,
this.$store.getters.database,
this.$store.getters.dbManager,
this.study
);
await newAssay.accept(metadataWriter);
Expand All @@ -371,8 +371,7 @@ export default class AssayItem extends Vue {
this.removeConfirmationActive = false;
const assayDestroyer = new AssayFileSystemDestroyer(
`${this.$store.getters.projectLocation}${this.study.getName()}`,
this.$store.getters.database,
this.$store.getters.databaseFile
this.$store.getters.dbManager
);
await this.assay.accept(assayDestroyer);
}
Expand Down
8 changes: 4 additions & 4 deletions src/components/navigation-drawers/StudyItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ export default class StudyItem extends Vue {
// Completely destroy this study and wait for the file system watcher to pick the change up.
const studyDestroyer = new StudyFileSystemRemover(
`${this.$store.getters.projectLocation}${this.study.getName()}`,
this.$store.getters.database
this.$store.getters.dbManager
);
await this.study.accept(studyDestroyer);
}
Expand All @@ -270,7 +270,7 @@ export default class StudyItem extends Vue {
// Write metadata to disk
const metaDataWriter = new AssayFileSystemMetaDataWriter(
`${this.$store.getters.projectLocation}${this.study.getName()}`,
this.$store.getters.database,
this.$store.getters.dbManager,
this.study
);
Expand Down Expand Up @@ -301,7 +301,7 @@ export default class StudyItem extends Vue {
// Write metadata to disk
const metaDataWriter = new AssayFileSystemMetaDataWriter(
`${this.$store.getters.projectLocation}${this.study.getName()}`,
this.$store.getters.database,
this.$store.getters.dbManager,
this.study
);
Expand All @@ -310,7 +310,7 @@ export default class StudyItem extends Vue {
// Write the assay to disk. It will automatically be picked up by the file system watchers
const assaySerializer = new AssayFileSystemDataWriter(
`${this.$store.getters.projectLocation}${this.study.getName()}`,
this.$store.getters.database
this.$store.getters.dbManager
);
await assay.accept(assaySerializer);
Expand Down
6 changes: 3 additions & 3 deletions src/logic/communication/DesktopAssayProcessor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ import ProcessedAssayManager from "@/logic/filesystem/assay/processed/ProcessedA
import { Database } from "better-sqlite3";
import { ShareableMap } from "shared-memory-datastructures";
import MetadataCommunicator from "@/logic/communication/metadata/MetadataCommunicator";
import DatabaseManager from "@/logic/filesystem/database/DatabaseManager";

export default class DesktopAssayProcessor implements AssayProcessor {
private pept2DataCommunicator: Pept2DataCommunicator;
private cancelled: boolean = false;

constructor(
private readonly db: Database,
private readonly dbFile: string,
private readonly dbManager: DatabaseManager,
private readonly assay: ProteomicsAssay,
private readonly progressListener?: ProgressListener
) {}
Expand Down Expand Up @@ -62,7 +62,7 @@ export default class DesktopAssayProcessor implements AssayProcessor {
peptideCountTable: CountTable<Peptide>,
forceUpdate: boolean
): Promise<[ShareableMap<Peptide, PeptideData>, PeptideTrust]> {
const processedAssayManager = new ProcessedAssayManager(this.db, this.dbFile);
const processedAssayManager = new ProcessedAssayManager(this.dbManager);
const processingResult = await processedAssayManager.readProcessingResults(this.assay);

if (processingResult !== null && !forceUpdate) {
Expand Down
Loading

0 comments on commit 1ccc6c5

Please sign in to comment.