From 74c2cabd9f894f8aad8541d35fee00cd654d7f44 Mon Sep 17 00:00:00 2001
From: pyranota <92104930+pyranota@users.noreply.github.com>
Date: Tue, 24 Sep 2024 17:13:06 +0000
Subject: [PATCH] Add Explicit Progress Hint (#4433)
* Add new component `ExecutionDuration`
Reusable component helps with tracking execution time of job
It is not using job.started_at, but instead uses it's own tracking mechanism
The key difference that it can give insights during execution of job and measures pure execution time
Accuracy is configurable with `updateResolution`
Can also detect if job is `longRunning` e.g. runs more than X-seconds
* Implement Hint for Explicit Progress
It uses ExecutionDuration component introduced in previous commit
and device's local storage to handle `Dont show again`
* Remove dublication of `FlowProgressBar` in `run` page
* Change Hint styling
* Change values in `ExecutionDuration` to match required
`longDefinition`: 3 -> 30
`updateResolution`: 2 -> 10
Meaning jobs running more than 30s counts as a `Long Running Job`
* Fix broken link
* Scope to langs: `python3`, `bun` and `deno` jobKinds: `script`
* Simplify ExecutionDuration for new scope
* Bring `preview` job kind into the scope
We need this to show this tip in preview pages.
e.g. By clicking on subjob details of flow (this subjob is preview)
---
.../lib/components/ExecutionDuration.svelte | 52 +++++++++++++++++++
.../components/flows/FlowProgressBar.svelte | 4 ++
.../(root)/(logged)/run/[...run]/+page.svelte | 43 ++++++++++++++-
3 files changed, 97 insertions(+), 2 deletions(-)
create mode 100644 frontend/src/lib/components/ExecutionDuration.svelte
diff --git a/frontend/src/lib/components/ExecutionDuration.svelte b/frontend/src/lib/components/ExecutionDuration.svelte
new file mode 100644
index 0000000000..aa42d428ce
--- /dev/null
+++ b/frontend/src/lib/components/ExecutionDuration.svelte
@@ -0,0 +1,52 @@
+
diff --git a/frontend/src/lib/components/flows/FlowProgressBar.svelte b/frontend/src/lib/components/flows/FlowProgressBar.svelte
index 6970b1aca0..39ccbbf424 100644
--- a/frontend/src/lib/components/flows/FlowProgressBar.svelte
+++ b/frontend/src/lib/components/flows/FlowProgressBar.svelte
@@ -3,6 +3,7 @@
import ProgressBar from '../progressBar/ProgressBar.svelte'
export let job: Job | undefined = undefined
+ export let currentSubJobProgress: number | undefined = undefined
let error: number | undefined = undefined
let index = 0
@@ -59,6 +60,9 @@
// Jitter protection >^^^^^^^^
subStepLength = 100
subIndexIsPercent = true;
+ currentSubJobProgress = subStepIndex
+ } else {
+ currentSubJobProgress = undefined
}
error = newError
diff --git a/frontend/src/routes/(root)/(logged)/run/[...run]/+page.svelte b/frontend/src/routes/(root)/(logged)/run/[...run]/+page.svelte
index 8ab81a1e38..6131ed5ea0 100644
--- a/frontend/src/routes/(root)/(logged)/run/[...run]/+page.svelte
+++ b/frontend/src/routes/(root)/(logged)/run/[...run]/+page.svelte
@@ -92,11 +92,13 @@
import Popover from '$lib/components/Popover.svelte'
import HighlightTheme from '$lib/components/HighlightTheme.svelte'
import PreprocessedArgsDisplay from '$lib/components/runs/PreprocessedArgsDisplay.svelte'
+ import ExecutionDuration from '$lib/components/ExecutionDuration.svelte'
let job: Job | undefined
let jobUpdateLastFetch: Date | undefined
let scriptProgress: number | undefined = undefined;
+ let currentJobIsLongRunning: boolean = false
let viewTab: 'result' | 'logs' | 'code' | 'stats' = 'result'
let selectedJobStep: string | undefined = undefined
@@ -112,6 +114,8 @@
let persistentScriptDrawer: PersistentScriptDrawer
let getLogs: (() => Promise) | undefined = undefined
+ let showExplicitProgressTip: boolean =
+ (localStorage.getItem('hideExplicitProgressTip') ?? 'false') == 'false'
$: job?.logs == undefined && job && viewTab == 'logs' && getLogs?.()
let lastJobId: string | undefined = undefined
@@ -747,7 +751,35 @@