Skip to content
This repository has been archived by the owner on May 4, 2024. It is now read-only.

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
Seb-sti1 committed Dec 16, 2023
1 parent eb61651 commit f983665
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
14 changes: 7 additions & 7 deletions backend/src/upload/file.processor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,11 @@ export class FileProcessor {
@Process('process-file')
async handleFileProcessing(job: Job<{ filePath: string }>) {
const printJobInfo = (...args: any[]) => {
console.log(`[${job.id} ${job.progress}%]`, ...args);
console.log(`[${job.id} ${job.toJSON()['progress']}%]`, ...args);
};

const printJobError = (...args: any[]) => {
console.error(`[${job.id} ${job.progress}%]`, ...args);
console.error(`[${job.id} ${job.toJSON()['progress']}%]`, ...args);
};

try {
Expand All @@ -99,7 +99,7 @@ export class FileProcessor {
//here we make sure that there is at least one RSP file and a HDC directory
let surveys = find_surveys(filePath, debug);
if (debug) {
console.debug(surveys);
printJobInfo(surveys);
}

if (surveys.length == 0) {
Expand Down Expand Up @@ -159,18 +159,18 @@ export class FileProcessor {
try {
const tempFolderPath = path.dirname(job.data.filePath);
fs.rmSync(tempFolderPath, { recursive: true });
console.log(`Deleted extracted folder: ${job.data.filePath}`);
printJobInfo(`Deleted extracted folder: ${job.data.filePath}`);
} catch (error) {
console.error(
printJobError(
`Error deleting extracted folder: ${job.data.filePath}`,
error,
);
}
console.log(
printJobInfo(
`File processed successfully and imported into Database: ${filePath}`,
);
} catch (error) {
console.error(`Error processing file: ${job.data.filePath}`, error);
printJobError(`Error processing file: ${job.data.filePath}`, error);
}
}
}
2 changes: 1 addition & 1 deletion backend/src/upload/valhalla.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ export async function valhalla(
},
};

return fetch('http://localhost:8002/trace_attributes', {
return fetch(process.env.VALHALLA_ENDPOINT + '/trace_attributes', {
method: 'POST',
body: JSON.stringify(request),
headers: { 'Content-Type': 'application/json' },
Expand Down

0 comments on commit f983665

Please sign in to comment.