Skip to content

Commit 94b7b39

Browse files
Merge pull request #2317 from MetRonnie/times
Estimated job finish times
2 parents 3ab80f8 + c61dd24 commit 94b7b39

File tree

17 files changed

+489
-261
lines changed

17 files changed

+489
-261
lines changed

changes.d/2317.feat.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Show estimated finish times of running jobs in the tree and table views.

src/components/cylc/Info.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,7 @@ import {
215215
mdiCheckboxBlankOutline
216216
} from '@mdi/js'
217217
import { cloneDeep } from 'lodash-es'
218+
import { formatDatetime } from '@/utils/tasks'
218219
219220
export default {
220221
name: 'InfoComponent',
@@ -301,7 +302,7 @@ export default {
301302
// Since we've created this date from a Unix timestamp, we can safely assume it is in UTC:
302303
xtrigger.id = xtrigger.id.replace(
303304
/trigger_time=(?<unixTime>[0-9.]+)/,
304-
(match, p1) => `trigger_time=${new Date(p1 * 1000).toISOString().slice(0, -5)}Z`
305+
(match, p1) => `trigger_time=${formatDatetime(new Date(p1 * 1000))}`
305306
)
306307
return xtrigger
307308
})

src/components/cylc/analysis/AnalysisTable.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ export default {
186186
value = value[index]
187187
}
188188
if (header.formatter) {
189-
return header.formatter(value, header.allowZeros)
189+
return header.formatter(value, header)
190190
}
191191
return value
192192
}

src/components/cylc/analysis/BoxPlot.vue

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -165,11 +165,11 @@ export default {
165165
},
166166
tooltip: {
167167
custom ({ seriesIndex, dataPointIndex, w }) {
168-
const max = formatDuration(w.globals.seriesCandleC[seriesIndex][dataPointIndex], true)
169-
const q3 = formatDuration(w.globals.seriesCandleL[seriesIndex][dataPointIndex], true)
170-
const med = formatDuration(w.globals.seriesCandleM[seriesIndex][dataPointIndex], true)
171-
const q1 = formatDuration(w.globals.seriesCandleH[seriesIndex][dataPointIndex], true)
172-
const min = formatDuration(w.globals.seriesCandleO[seriesIndex][dataPointIndex], true)
168+
const max = formatDuration(w.globals.seriesCandleC[seriesIndex][dataPointIndex], { allowZeros: true })
169+
const q3 = formatDuration(w.globals.seriesCandleL[seriesIndex][dataPointIndex], { allowZeros: true })
170+
const med = formatDuration(w.globals.seriesCandleM[seriesIndex][dataPointIndex], { allowZeros: true })
171+
const q1 = formatDuration(w.globals.seriesCandleH[seriesIndex][dataPointIndex], { allowZeros: true })
172+
const min = formatDuration(w.globals.seriesCandleO[seriesIndex][dataPointIndex], { allowZeros: true })
173173
return `
174174
<div class="pa-2">
175175
<div>Maximum: ${max}</div>
@@ -197,7 +197,7 @@ export default {
197197
text: `${upperFirst(props.timingOption)} time`,
198198
},
199199
labels: {
200-
formatter: (value) => formatDuration(value, true)
200+
formatter: (value) => formatDuration(value, { allowZeros: true })
201201
},
202202
},
203203
}))

src/components/cylc/analysis/TimeSeries.vue

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,7 @@ export default {
366366
if (!value) {
367367
return null
368368
}
369-
const y = formatDuration(value, true)
369+
const y = formatDuration(value, { allowZeros: true })
370370
const platform = this.series[seriesIndex].data[dataPointIndex].platform
371371
return `${y} (${platform})`
372372
}
@@ -387,9 +387,7 @@ export default {
387387
text: upperFirst(this.timingOption) + ' time',
388388
},
389389
labels: {
390-
formatter: function (value) {
391-
return formatDuration(value, true)
392-
}
390+
formatter: (value) => formatDuration(value, { allowZeros: true })
393391
},
394392
},
395393
}
@@ -448,9 +446,7 @@ export default {
448446
text: upperFirst(this.timingOption) + ' time',
449447
},
450448
labels: {
451-
formatter: function (value) {
452-
return formatDuration(value, true)
453-
}
449+
formatter: (value) => formatDuration(value, { allowZeros: true })
454450
},
455451
min: this.showOrigin ? 0 : undefined
456452
},
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
<!--
2+
Copyright (C) NIWA & British Crown (Met Office) & Contributors.
3+
4+
This program is free software: you can redistribute it and/or modify
5+
it under the terms of the GNU General Public License as published by
6+
the Free Software Foundation, either version 3 of the License, or
7+
(at your option) any later version.
8+
9+
This program is distributed in the hope that it will be useful,
10+
but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
GNU General Public License for more details.
13+
14+
You should have received a copy of the GNU General Public License
15+
along with this program. If not, see <http://www.gnu.org/licenses/>.
16+
-->
17+
18+
<!-- Simple component to show an actual time or fall back to an estimate if present. -->
19+
20+
<template>
21+
<template v-if="isTruthyOrZero(actual)">
22+
{{ formatter(actual) }}
23+
</template>
24+
<span
25+
v-else-if="isTruthyOrZero(estimate)"
26+
v-tooltip="{ text: tooltip, openDelay: 200 }"
27+
class="d-inline-flex align-center text-blue-grey"
28+
>
29+
{{ formatter(estimate) }}
30+
<v-icon
31+
:icon="mdiTimerSand"
32+
size="small"
33+
class="ml-1"
34+
/>
35+
</span>
36+
</template>
37+
38+
<script setup>
39+
import { mdiTimerSand } from '@mdi/js'
40+
import { isTruthyOrZero } from '@/utils/tasks'
41+
42+
defineProps({
43+
actual: {
44+
type: [String, Number],
45+
},
46+
estimate: {
47+
type: [String, Number],
48+
},
49+
formatter: {
50+
type: Function,
51+
default: (x) => x,
52+
},
53+
tooltip: {
54+
type: String,
55+
default: 'Estimate',
56+
},
57+
})
58+
</script>

src/components/cylc/common/JobDetails.vue

Lines changed: 28 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -42,27 +42,42 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
4242
<td>{{ node.jobRunnerName }}</td>
4343
</tr>
4444
<tr>
45-
<td>Submitted time</td>
45+
<td>Submit time</td>
4646
<td>{{ node.submittedTime }}</td>
4747
</tr>
48-
<tr>
49-
<td>Started time</td>
50-
<td>{{ node.startedTime }}</td>
51-
</tr>
52-
<tr>
53-
<td>Finished time</td>
54-
<td>{{ node.finishedTime }}</td>
55-
</tr>
56-
<tr v-if="meanElapsedTime">
57-
<td>Mean run time</td>
58-
<td>{{ formatDuration(meanElapsedTime) }}</td>
48+
<template v-if="node.startedTime">
49+
<tr>
50+
<td>Start time</td>
51+
<td>{{ node.startedTime }}</td>
52+
</tr>
53+
<tr>
54+
<td>Finish time</td>
55+
<td>
56+
<EstimatedTime
57+
:actual="node.finishedTime"
58+
:estimate="node.estimatedFinishTime"
59+
/>
60+
</td>
61+
</tr>
62+
</template>
63+
<tr v-if="node.finishedTime || meanElapsedTime">
64+
<td>Run time</td>
65+
<td>
66+
<EstimatedTime
67+
:actual="getRunTime(node)"
68+
:estimate="meanElapsedTime"
69+
:formatter="(x) => formatDuration(x, { allowZeros: true })"
70+
tooltip="Mean for this task"
71+
/>
72+
</td>
5973
</tr>
6074
</tbody>
6175
</v-table>
6276
</template>
6377

6478
<script setup>
65-
import { formatDuration } from '@/utils/tasks'
79+
import { formatDuration, getRunTime } from '@/utils/tasks'
80+
import EstimatedTime from '@/components/cylc/common/EstimatedTime.vue'
6681
6782
defineProps({
6883
node: {

0 commit comments

Comments
 (0)