artifact-engine
Advanced tools
Comparing version 0.1.7 to 0.1.9
@@ -24,2 +24,4 @@ "use strict"; | ||
this.logger.logProgress(); | ||
sourceProvider.artifactItemStore = this.artifactItemStore; | ||
destProvider.artifactItemStore = this.artifactItemStore; | ||
sourceProvider.getRootItems().then((itemsToProcess) => { | ||
@@ -26,0 +28,0 @@ this.artifactItemStore.addItems(itemsToProcess); |
@@ -59,4 +59,11 @@ "use strict"; | ||
var failedItems = fileTickets.filter(x => x.state == ticketState_1.TicketState.Failed); | ||
var downloadSizeInBytes = 0; | ||
var fileSizeInBytes = 0; | ||
for (var ticket of fileTickets) { | ||
downloadSizeInBytes += ticket.downloadSizeInBytes; | ||
fileSizeInBytes += ticket.fileSizeInBytes; | ||
} | ||
var downloadSizeInMB = (downloadSizeInBytes / (1024 * 1024)); | ||
var endTime = new Date(); | ||
var timeElapsed = (endTime.valueOf() - this.startTime.valueOf()) / 1000; | ||
var downloadTime = (endTime.valueOf() - this.startTime.valueOf()) / 1000; | ||
console.log("Total Files: " + fileTickets.length | ||
@@ -66,3 +73,4 @@ + ", Processed: " + processedItems.length | ||
+ ", Failed: " + failedItems.length | ||
+ ", Time elapsed: " + timeElapsed + "secs"); | ||
+ ", Download time: " + downloadTime + "secs" | ||
+ (downloadSizeInMB > 1 ? ", Download size: " + downloadSizeInMB.toFixed(3) + "MB" : "")); | ||
ci.publishEvent('performance', { | ||
@@ -75,3 +83,5 @@ location: this.store.getRootLocation(), | ||
failed: failedItems.length, | ||
timetaken: timeElapsed | ||
downloadTimeInSeconds: downloadTime, | ||
downloadSizeInBytes: downloadSizeInBytes, | ||
fileSizeInBytes: fileSizeInBytes | ||
}); | ||
@@ -78,0 +88,0 @@ if (Logger.verbose) { |
@@ -9,2 +9,4 @@ import { ArtifactItem } from "./artifactItem"; | ||
retryCount: number; | ||
downloadSizeInBytes: number; | ||
fileSizeInBytes: number; | ||
} |
import { ArtifactItem } from "./artifactItem"; | ||
import { ArtifactItemStore } from '../Store/artifactItemStore'; | ||
export interface IArtifactProvider { | ||
artifactItemStore: ArtifactItemStore; | ||
getRootItems(): Promise<ArtifactItem[]>; | ||
@@ -4,0 +6,0 @@ getArtifactItems(artifactItem: ArtifactItem): Promise<ArtifactItem[]>; |
{ | ||
"name": "artifact-engine", | ||
"version": "0.1.7", | ||
"version": "0.1.9", | ||
"description": "Artifact Engine to download artifacts from jenkins, teamcity, vsts", | ||
@@ -5,0 +5,0 @@ "repository": { |
import * as models from '../Models'; | ||
import { ArtifactItemStore } from '../Store/artifactItemStore'; | ||
export declare class FilesystemProvider implements models.IArtifactProvider { | ||
artifactItemStore: ArtifactItemStore; | ||
constructor(rootLocation: string); | ||
@@ -4,0 +6,0 @@ getRootItems(): Promise<models.ArtifactItem[]>; |
@@ -27,2 +27,5 @@ "use strict"; | ||
var contentStream = fs.createReadStream(itemPath); | ||
contentStream.on('end', () => { | ||
this.artifactItemStore.updateDownloadSize(artifactItem, contentStream.bytesRead); | ||
}); | ||
resolve(contentStream); | ||
@@ -56,2 +59,5 @@ } | ||
}); | ||
outputStream.on("finish", () => { | ||
this.artifactItemStore.updateFileSize(item, outputStream.bytesWritten); | ||
}); | ||
} | ||
@@ -58,0 +64,0 @@ catch (err) { |
import * as models from '../Models'; | ||
import { ItemType } from '../Models'; | ||
import { ArtifactItemStore } from '../Store/artifactItemStore'; | ||
export declare class StubProvider implements models.IArtifactProvider { | ||
artifactItemStore: ArtifactItemStore; | ||
getArtifactItemCalledCount: number; | ||
@@ -5,0 +7,0 @@ getArtifactItemsCalledCount: number; |
@@ -5,3 +5,5 @@ import * as stream from 'stream'; | ||
import { IRequestHandler, IRequestOptions } from './typed-rest-client/Interfaces'; | ||
import { ArtifactItemStore } from '../Store/artifactItemStore'; | ||
export declare class WebProvider implements models.IArtifactProvider { | ||
artifactItemStore: ArtifactItemStore; | ||
constructor(rootItemsLocation: any, templateFile: string, variables: any, handler: IRequestHandler, requestOptions?: IRequestOptions); | ||
@@ -8,0 +10,0 @@ getRootItems(): Promise<models.ArtifactItem[]>; |
@@ -43,2 +43,5 @@ "use strict"; | ||
this.httpc.get(itemUrl).then((res) => { | ||
res.message.on('end', () => { | ||
this.artifactItemStore.updateDownloadSize(artifactItem, res.message.socket.bytesRead); | ||
}); | ||
if (res.message.headers['content-encoding'] === 'gzip') { | ||
@@ -45,0 +48,0 @@ try { |
@@ -12,4 +12,6 @@ import * as models from "../Models"; | ||
increaseRetryCount(item: models.ArtifactItem): void; | ||
updateDownloadSize(item: models.ArtifactItem, downloadSizeInBytes: number): void; | ||
updateFileSize(item: models.ArtifactItem, fileSizeInBytes: number): void; | ||
size(): number; | ||
flush(): void; | ||
} |
@@ -16,3 +16,5 @@ "use strict"; | ||
finishTime: undefined, | ||
retryCount: 0 | ||
retryCount: 0, | ||
downloadSizeInBytes: 0, | ||
fileSizeInBytes: 0 | ||
}; | ||
@@ -65,2 +67,14 @@ this._downloadTickets.push(artifactDownloadTicket); | ||
} | ||
updateDownloadSize(item, downloadSizeInBytes) { | ||
var ticket = this._downloadTickets.find(x => x.artifactItem.path === item.path); | ||
if (ticket) { | ||
ticket.downloadSizeInBytes = downloadSizeInBytes; | ||
} | ||
} | ||
updateFileSize(item, fileSizeInBytes) { | ||
var ticket = this._downloadTickets.find(x => x.artifactItem.path === item.path); | ||
if (ticket) { | ||
ticket.fileSizeInBytes = fileSizeInBytes; | ||
} | ||
} | ||
size() { | ||
@@ -67,0 +81,0 @@ return this._downloadTickets.length; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
143400
66
2092