Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

workflow snapshots documentation #516

Merged
merged 5 commits into from
Jul 30, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 57 additions & 0 deletions docs/build/workflow-snapshots.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
---
title: Workflow Snapshots
sidebar_label: Workflow Snapshots
slug: /workflow-snapshots
---

Workflow snapshots capture and store the state of a workflow and job code at a specific point in time based on a save operation and/or run. Snapshots are helpful with debugging, auditing, and improving overall workflow performance.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ritazagoni what is the "state of a workflow" vs. "job code"?
Also I'm worried "state" will be confused with job "state"... what if we changed this language to something like the below (assuming the below is accurate)?

Workflow snapshots capture and store the state/version of a workflow's configuration and job code at a specific point in time, when a workflow was updated or run.


### When is a snapshot made?
Snapshots are created in 2 ways:
1. When a user saves changes to their workflow either through the canvas or the job editor
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you mean by "job editor"? Do you mean the Inspector? That's what we're calling it in our current docs
@ritazagoni

2. When a run is made either by creating a new work order or retrying a run

### How can I view a snapshot?
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ritazagoni @christad92 so confirming there's no one central list view of all my snapshots somewhere, right?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No. We don't have an interface for viewing the list of snapshots right now.

To view a snapshot, go to the `History` page. Expand a work order to see the runs included.

![Snapshot1](/img/snapshots1.png)

From the expanded history view, there are two ways to visualize snapshots:
1. By inspecting a step in the run
2. From the Run view

#### Viewing a snapshot by inspecting a step in the run

Click on the inspect icon in front of the step you would like to view.

![Inspect](/img/inspect.png)

This will open the inspector screen for that step in the run with all associated artifacts: logs and input/output data. On the inspector, you'll notice that you're in a read-only mode, and hovering on the workflow snapshot ID chip, you’ll see a message that reads “You are viewing a snapshot of this workflow that was taken on ….”
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we link to this existing docs page for more on the Inspector?
https://docs.openfn.org/documentation/build/steps/step-editor


![Snapshot2](/img/snapshots2.png)

To view the corresponding canvas for this snapshot, close this inspector view by clicking the `X` on the top right corner of the page. This will open the associated canvas with the step selected as shown below.

![Snapshot3](/img/snapshots3.png)

From the canvas, you can inspect any step by clicking on the step and opening the inspector for the run associated with the step and snapshot.

#### Viewing a snapshot from the Run view
From the expanded history view, click on the run ID to open the run view.

![Snapshot4](/img/snapshots4.png)

From this view, click on the Workflow name (Simple Flow) to open the workflow canvas for this snapshot.
Similar to viewing a snapshot by inspecting a step, you can click the inspect icon in front of the steps to open the inspector for the step.

### Editing a Snapshot
Snapshots are read-only and serve as a reference for the state of a workflow when saved or a run is executed. To enable editing more, users can either click on the `Switch to latest version` on the canvas or use the toggle at the bottom right of the inspector page to switch to the latest version of the workflow.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"To enable editing more" ... more what?


When you switch to the latest version, the snapshot ID tag will change to blue colour and the text will be `latest`.

![Snapshot5](/img/snapshots5.png)

![Snapshot6](/img/snapshots6.png)

### Retrying a Snapshot
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ritazagoni so does this mean that you cannot retry a workflow with a specific snapshot? Then I think we should say that explicitly

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add a ### Version Control section to briefly summarize how snapshotting is different than version control, and then link to our existing docs page on Github version control?

When retrying a run with a snapshot, the retry will be executed with the latest version of the workflow and job code.
1 change: 1 addition & 0 deletions sidebars-main.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ module.exports = {
'build/editing-locally',
'build/working-with-branches',
'build/troubleshooting',
'build/workflow-snapshots',
],
},
{
Expand Down
Binary file added static/img/inspect.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/img/snapshots1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/img/snapshots2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/img/snapshots3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/img/snapshots4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/img/snapshots5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/img/snapshots6.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.