Skip to content

Commit 9608365

Browse files
committed
Update readme
1 parent b16cf87 commit 9608365

File tree

2 files changed

+14
-12
lines changed

2 files changed

+14
-12
lines changed

README.md

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,19 @@
33
I was wondering whether you could use the [Mermaid](https://mermaid.js.org/) diagramming
44
tool to visualize the live progress of a workflow or pipeline similar to
55
[Airflow](https://airflow.apache.org/) or [Dagster](https://dagster.io/).
6-
Turns out you can! All you need is a bit of JavaScript:
6+
It turns out you can! All you need is a bit of JavaScript:
77

88
![Workflow Visualization](images/workflow.png)
99

10+
There is also a progress-bar available that is based on the states of the blocks. See
11+
the example.html file for how to include it:
12+
13+
![Progress Bar](images/progress-bar.png)
14+
1015
## Usage
1116
The principle is simple:
1217

13-
1. Define a workflow or pipeline in a .mmd file using Mermaid syntax. This file is
18+
1. Define a workflow or pipeline in an .mmd file using Mermaid syntax. This file is
1419
meant to be generated programmatically (e.g. a Python script).
1520
```
1621
graph LR
@@ -22,7 +27,7 @@ The principle is simple:
2227
Copy --> Inform(Send Email)
2328
```
2429
25-
2. Add a comment to that file indicating the recency of the data as
30+
2. Add a comment to the file indicating the data's recency as
2631
[ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) timestamp.
2732
```
2833
graph LR
@@ -62,14 +67,13 @@ The principle is simple:
6267
%% Copy: Running (212s)
6368
%% Inform: Waiting
6469
```
65-
Valid states are `Success`, `Failed`, `Running`, and `Waiting`. Blocks which are
66-
not mentioned are assumed to be in `Waiting` state with undefined runtime.
70+
Valid states are `Success`, `Failed`, `Running`, and `Waiting`. Blocks not mentioned are assumed to be in the `Waiting` state with an undefined runtime.
6771
6872
4. Update the information in the file at least once a minute (keep the timestamp recent
69-
even if nothing else changes). Dagmaid will read the file once a second and
70-
update the diagram in the browser.
73+
even if nothing else changes). Dagmaid reads the file in a specified interval and
74+
updates the diagram in the browser. In the below example, it is set to half a second.
7175
72-
5. The diagram.mmd files need to be served by a web server. If you have Python installed,
76+
5. The .mmd files must be served by a web server. If you have Python installed,
7377
this can be as simple as calling `python -m http.server` in the directory containing the
7478
files. They will then be served at `http://localhost:8000/`.
7579
@@ -80,9 +84,7 @@ The principle is simple:
8084
<html>
8185
<head>
8286
<script src="https://cdn.jsdelivr.net/npm/mermaid/dist/mermaid.min.js"></script>
83-
<script src="utils.js"></script>
84-
<script src="dag.js"></script>
85-
<script src="progress-bar.js"></script>
87+
<script src="dagmaid.min.js"></script>
8688
<script>
8789
// Create diagram manager. It continuously fetches example.mmd
8890
const diagram = createDiagramManager('example.mmd', 0.5);
@@ -93,7 +95,7 @@ The principle is simple:
9395
// Start fetching and updating the diagram.
9496
diagram.start();
9597
96-
// Cleanup everything when the page unloads.
98+
// Clean up resources when the page unloads.
9799
window.addEventListener('beforeunload', () => {
98100
dagCleanup();
99101
diagram.stop();

images/progress-bar.png

3.45 KB
Loading

0 commit comments

Comments
 (0)