Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Colossus archive script #5193

Merged
merged 18 commits into from
Dec 12, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix failure handling and adjust timeouts
  • Loading branch information
Lezek123 committed Nov 15, 2024
commit c550c0eaad11176ab2a6d040218cbeb27984dfe9
16 changes: 10 additions & 6 deletions storage-node/src/services/archive/tasks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,20 +91,22 @@ export class CompressFilesTask implements Task {
}
}

private async handleFailure(e: Error): Promise<void> {
private async handleFailure(error: Error): Promise<void> {
const pathsToClean = [this.tmpArchiveFilePath, this.archiveFilePath, ...this.dataObjectPaths]
// Untrack data objects so that they can be re-downloaded
// and remove data objects and any archives that were created from uploadsDir
try {
await Promise.all(this.dataObjectIds.map((id) => this.objectTrackingService.untrack(id)))
for (const id of this.dataObjectIds) {
await this.objectTrackingService.untrack(id)
}
await Promise.all(pathsToClean.map((p) => fsp.rm(p, { force: true })))
} catch (e) {
this.logger.error(`Compression failed: ${e.toString()}`)
this.logger.error(`Failed to clean up local data: ${e.toString()}`)
this.logger.error(`Exiting due to cirtical error...`)
process.exit(1)
}
throw new Error(`Compression task failed: ${e.toString()}`)
throw new Error(`Compression task failed: ${error.toString()}`)
}

private async clenaup(): Promise<void> {
Expand Down Expand Up @@ -186,18 +188,20 @@ export class UploadArchiveFileTask implements Task {
}
}

private async handleFailure(e: Error, dataObjectIds: string[]): Promise<void> {
private async handleFailure(error: Error, dataObjectIds: string[]): Promise<void> {
// Untrack the data objects so that they can be re-downloaded and remove the archive file
try {
await Promise.all(dataObjectIds.map((id) => this.objectTrackingService.untrack(id)))
for (const id of dataObjectIds) {
await this.objectTrackingService.untrack(id)
}
await fsp.rm(this.archiveFilePath, { force: true })
} catch (e) {
this.logger.error(`Upload failed: ${e.toString()}`)
this.logger.error(`Failed to clean up local data: ${e.toString()}`)
this.logger.error(`Exiting due to cirtical error...`)
process.exit(1)
}
throw new Error(`Upload failed: ${e.toString()}`)
throw new Error(`Upload failed: ${error.toString()}`)
}

public async execute(): Promise<void> {
Expand Down
5 changes: 2 additions & 3 deletions storage-node/src/services/archive/tracking.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,8 @@ abstract class TrackfileService {
// Source: https://www.npmjs.com/package/retry
retries: {
minTimeout: 10,
maxTimeout: 100,
factor: 1.5,
retries: 10,
maxTimeout: 10,
retries: 10_000,
},
})
}
Expand Down
4 changes: 2 additions & 2 deletions storage-node/src/services/s3/AwsConnectionHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ export class AwsConnectionHandler implements IConnectionHandler<StorageClass> {
credentials: fromEnv(),
region: opts.region,
requestHandler: {
connectionTimeout: 60_000,
requestTimeout: 60_000,
connectionTimeout: 30_000,
requestTimeout: 120_000,
},
})
}
Expand Down
Loading