Skip to content

Commit

Permalink
Display cost metric (#1805)
Browse files Browse the repository at this point in the history
https://ucsc-cgl.atlassian.net/browse/SEAB-5625
* Add cost metric
* Add 1.15.0 migrations
* Add space to tooltip
* Use develop artifacts
* Add cost to sampleMetrics.json
  • Loading branch information
kathy-t authored Jul 12, 2023
1 parent 2df7676 commit 80bf62a
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 11 deletions.
21 changes: 20 additions & 1 deletion cypress/fixtures/sampleMetrics.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"executionTime": null,
"id": 124,
"memory": null,
"cost": null,
"validationStatus": {
"id": 134,
"validatorTools": {
Expand Down Expand Up @@ -77,7 +78,8 @@
"executionTime": null,
"id": 126,
"memory": null,
"validationStatus": null
"validationStatus": null,
"cost": null
},
"AGC": {
"cpu": {
Expand Down Expand Up @@ -114,6 +116,14 @@
"id": 105,
"unit": "GB"
},
"cost": {
"average": 3.25,
"maximum": 4,
"minimum": 2,
"numberOfDataPointsForAverage": 4,
"id": 200,
"unit": "USD"
},
"validationStatus": null
},
"OTHER": {
Expand Down Expand Up @@ -150,6 +160,7 @@
"id": 108,
"unit": "GB"
},
"cost": null,
"validationStatus": null
},
"ALL": {
Expand Down Expand Up @@ -187,6 +198,14 @@
"id": 111,
"unit": "GB"
},
"cost": {
"average": 3.25,
"maximum": 4,
"minimum": 2,
"numberOfDataPointsForAverage": 4,
"id": 201,
"unit": "USD"
},
"validationStatus": {
"id": 138,
"validatorTools": {
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
"config": {
"webservice_version": "1.15.0",
"use_circle": true,
"circle_ci_source": "https://app.circleci.com/pipelines/github/dockstore/dockstore/10135/workflows/670e8975-9acf-4211-a104-2c37b0142452/jobs/35244/artifacts",
"circle_build_id": "35244"
"circle_ci_source": "https://app.circleci.com/pipelines/github/dockstore/dockstore/10164/workflows/ea25cb1f-4d5f-4124-86d4-2305408a3784/jobs/35487/artifacts",
"circle_build_id": "35487"
},
"scripts": {
"ng": "npx ng",
Expand Down
12 changes: 6 additions & 6 deletions src/app/workflow/executions/executions-tab.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -47,26 +47,26 @@
<ng-container matColumnDef="minimum">
<th mat-header-cell *matHeaderCellDef>Minimum</th>
<td mat-cell *matCellDef="let executionMetric">
<span *ngIf="executionMetric.minimum" matTooltip="{{ executionMetric.minimum + executionMetric.unit }}"
>{{ executionMetric.minimum | number: '1.0-2' }}{{ executionMetric.unit }}</span
<span *ngIf="executionMetric.minimum" matTooltip="{{ executionMetric.minimum + ' ' + executionMetric.unit }}"
>{{ executionMetric.minimum | number: '1.0-2' }} {{ executionMetric.unit }}</span
>
</td>
</ng-container>

<ng-container matColumnDef="average">
<th mat-header-cell *matHeaderCellDef>Average</th>
<td mat-cell *matCellDef="let executionMetric">
<span *ngIf="executionMetric.average" matTooltip="{{ executionMetric.average + executionMetric.unit }}"
>{{ executionMetric.average | number: '1.0-2' }}{{ executionMetric.unit }}</span
<span *ngIf="executionMetric.average" matTooltip="{{ executionMetric.average + ' ' + executionMetric.unit }}"
>{{ executionMetric.average | number: '1.0-2' }} {{ executionMetric.unit }}</span
>
</td>
</ng-container>

<ng-container matColumnDef="maximum">
<th mat-header-cell *matHeaderCellDef>Maximum</th>
<td mat-cell *matCellDef="let executionMetric">
<span *ngIf="executionMetric.maximum" matTooltip="{{ executionMetric.maximum + executionMetric.unit }}"
>{{ executionMetric.maximum | number: '1.0-2' }}{{ executionMetric.unit }}</span
<span *ngIf="executionMetric.maximum" matTooltip="{{ executionMetric.maximum + ' ' + executionMetric.unit }}"
>{{ executionMetric.maximum | number: '1.0-2' }} {{ executionMetric.unit }}</span
>
</td>
</ng-container>
Expand Down
9 changes: 7 additions & 2 deletions src/app/workflow/executions/executions-tab.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,11 @@ export class ExecutionsTabComponent extends EntryTab implements OnChanges {
const metrics = this.metrics.get(partner);
this.executionMetricsTable = this.createExecutionsTable(metrics);
this.executionMetricsExist =
metrics?.cpu !== null || metrics?.memory !== null || metrics?.executionTime !== null || metrics?.executionStatusCount !== null;
metrics?.cpu !== null ||
metrics?.memory !== null ||
metrics?.executionTime !== null ||
metrics?.executionStatusCount !== null ||
metrics?.cost !== null;

if (metrics?.executionStatusCount) {
this.totalExecutions =
Expand All @@ -154,10 +158,11 @@ export class ExecutionsTabComponent extends EntryTab implements OnChanges {
private createExecutionsTable(metrics: Metrics | null): ExecutionMetricsTableObject[] {
let executionsTable: ExecutionMetricsTableObject[] = [];
// Only create the table if one of the execution metrics exist
if (metrics && (metrics.cpu || metrics.memory || metrics.executionTime)) {
if (metrics && (metrics.cpu || metrics.memory || metrics.executionTime || metrics.cost)) {
executionsTable.push({ metric: 'CPU', ...metrics?.cpu });
executionsTable.push({ metric: 'Memory', ...metrics?.memory });
executionsTable.push({ metric: 'Run Time', ...metrics?.executionTime });
executionsTable.push({ metric: 'Cost', ...metrics?.cost });
}
return executionsTable;
}
Expand Down

0 comments on commit 80bf62a

Please sign in to comment.