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

Change restart flag to an restart policy enum in interfaces #217

Merged
merged 14 commits into from Apr 2, 2024

Conversation

inf17101
Copy link
Contributor

@inf17101 inf17101 commented Mar 26, 2024

Issues: #5, #212

Changes:

  • Replaced the restart bool flag in all public interfaces and internal objects
  • Fixed the utests using the restart enum
  • Adapted the user docs refering to the restart configuration item
  • Explicitly made "restart: NEVER" the default for all existing stest configs to prevent them from different behavior when implementing the actual restart behavior
  • introduced a new stest config containing a startup state with all the different restart policies
  • adapted the server/resources/startConfig.yaml file to include the types of the restart policies
  • added Swdd item explaining the support of the new restart policy values

Definition of Done

The PR shall be merged only if all items mentioned in CONTRIBUTING.md have been followed. In case an item is not applicable as described, please provide a short explanation in the description.

@inf17101 inf17101 self-assigned this Mar 26, 2024
@inf17101 inf17101 added breaking-change Issue will appear in the change log "Breaking Changes" enhancement New feature or request. Issue will appear in the change log "Features" labels Mar 26, 2024
@inf17101
Copy link
Contributor Author

inf17101 commented Mar 26, 2024

@krucod3: After all local modifications, I had an enum called RestartPolicy. But then, I thought it is too long and the old name is also suitable. So, I have renamed it to Restart again. Please let me know if you prefer RestartPolicy.

@inf17101
Copy link
Contributor Author

Shall I add an comment out stest also?

Copy link
Contributor

@krucod3 krucod3 left a comment

Choose a reason for hiding this comment

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

All in all looks good, just a couple of small findings.

doc/docs/reference/complete-state.md Outdated Show resolved Hide resolved
server/resources/startConfig.yaml Show resolved Hide resolved
@inf17101
Copy link
Contributor Author

inf17101 commented Mar 27, 2024

@krucod3: Since a restart of a workload is basically an update (delete + create), I would recommend that we rename the Restart stuff related to the retry mechanism inside the WorkloadControlLoop to "Retry" instead of "Restart". This prevents confusion (especially for the swdd chapters).

agent/doc/swdesign/README.md Outdated Show resolved Hide resolved
doc/docs/reference/complete-state.md Outdated Show resolved Hide resolved
examples/config/startupState.yaml Outdated Show resolved Hide resolved
examples/cpp_control_interface/src/main.cpp Outdated Show resolved Hide resolved
examples/nodejs_control_interface/src/main.js Outdated Show resolved Hide resolved
tests/resources/configs/state_with_dependency_cycle.yaml Outdated Show resolved Hide resolved
tests/resources/configs/state_with_dependency_cycle.yaml Outdated Show resolved Hide resolved
tools/install.sh Outdated Show resolved Hide resolved
Co-authored-by: lingnoi <42992756+lingnoi@users.noreply.github.com>
@krucod3
Copy link
Contributor

krucod3 commented Mar 28, 2024

We should not just update all configs to ALWAYS if the previous value was true. Workloads that go to succeeded will end up in a restart loop and this is not what we are targeting.

@inf17101
Copy link
Contributor Author

We should not just update all configs to ALWAYS if the previous value was true. Workloads that go to succeeded will end up in a restart loop and this is not what we are targeting.

Yes this is why I have carefully thought about the need for restart or not for each workload config or documentation snippet. And I have disabled the restart feature for all stests not testing the restart feature itself to prevent stests from failing because of the restart failure even if their intend tests a different feature.

@lingnoi
Copy link
Contributor

lingnoi commented Mar 28, 2024

@krucod3: After all local modifications, I had an enum called RestartPolicy. But then, I thought it is too long and the old name is also suitable. So, I have renamed it to Restart again. Please let me know if you prefer RestartPolicy.

I think, utilizing the term "RestartPolicy" is more precise, as the term "Restart" alone could potentially be misunderstood in various contexts.

@inf17101
Copy link
Contributor Author

@krucod3: After all local modifications, I had an enum called RestartPolicy. But then, I thought it is too long and the old name is also suitable. So, I have renamed it to Restart again. Please let me know if you prefer RestartPolicy.

I think, utilizing the term "RestartPolicy" is more precise, as the term "Restart" alone could potentially be misunderstood in various contexts.

I will do a commit in a few minutes. But I need to test all examples again after the changes.

@inf17101
Copy link
Contributor Author

inf17101 commented Mar 28, 2024

@krucod3: All changes for renaming "restart" into "RestartPolicy" are done (Manifest + Enum). The problem is since two builds in GH actions and on my local side the mkdocs build is failing tools/generate_docs.sh serve with the following error:

image

It is failing on the main branch as well (see picture above).

The mystique thing is that on @lingnoi WSL2 both main and this branch builds the documentation successfully.

We have found out that it is the social plugin of mkdocs:
image

If I comment out the social plugin then it works. However, after analyzing the python code of the social plugin it seems like it is trying to download the Roboto.zip of google fonts (this is happen when the documentation is built). The download does not return a valid zip file if you download it in a programmatic way (curl, python code of the function that loads the zip). It returns a javascript file. However, if you download the google fonts with the browser it returns a valid zip file.

The issue was also mentioned in the past here: squidfunk/mkdocs-material#5628 (but with different setting)
So, shall I comment out the social plugin? I think otherwise this PR is blocked from merging. I would open a ticket. I would recommend not relying on external downloads such as google fonts, because it can break something like we see here. Maybe we can host them locally for building if a cooler font is needed or change to a default font maybe.

@lingnoi
Copy link
Contributor

lingnoi commented Mar 28, 2024

@krucod3: All changes for renaming "restart" into "RestartPolicy" are done (Manifest + Enum). The problem is since two builds in GH actions and on my local side the mkdocs build is failing tools/generate_docs.sh serve with the following error:

image

It is failing on the main branch as well (see picture above).

The mystique thing is that on @lingnoi WSL2 both main and this branch builds the documentation successfully.

We have found out that it is the social plugin of mkdocs: image

If I comment out the social plugin then it works. However, after analyzing the python code of the social plugin it seems like it is trying to download the Roboto.zip of google fonts (this is happen when the documentation is built). The download does not return a valid zip file if you download it in a programmatic way (curl, python code of the function that loads the zip). It returns a javascript file. However, if you download the google fonts with the browser it returns a valid zip file.

The issue was also mentioned in the past here: squidfunk/mkdocs-material#5628 (but with different setting) So, shall I comment out the social plugin? I think otherwise this PR is blocked from merging.

I can confirm, I can build and serve the documentation of this branch and also of main branch on my machine (WSL2).

@lingnoi
Copy link
Contributor

lingnoi commented Mar 28, 2024

@krucod3: All changes for renaming "restart" into "RestartPolicy" are done (Manifest + Enum). The problem is since two builds in GH actions and on my local side the mkdocs build is failing tools/generate_docs.sh serve with the following error:
image
It is failing on the main branch as well (see picture above).
The mystique thing is that on @lingnoi WSL2 both main and this branch builds the documentation successfully.
We have found out that it is the social plugin of mkdocs: image
If I comment out the social plugin then it works. However, after analyzing the python code of the social plugin it seems like it is trying to download the Roboto.zip of google fonts (this is happen when the documentation is built). The download does not return a valid zip file if you download it in a programmatic way (curl, python code of the function that loads the zip). It returns a javascript file. However, if you download the google fonts with the browser it returns a valid zip file.
The issue was also mentioned in the past here: squidfunk/mkdocs-material#5628 (but with different setting) So, shall I comment out the social plugin? I think otherwise this PR is blocked from merging.

I can confirm, I can build and serve the documentation of this branch and also of main branch on my machine (WSL2).

After removing the .cache folder, I'm able to reproduce the issue:
image

Copy link
Contributor

@lingnoi lingnoi left a comment

Choose a reason for hiding this comment

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

LGTM, now 👍

Copy link
Contributor

@krucod3 krucod3 left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@krucod3 krucod3 merged commit cfc7e49 into main Apr 2, 2024
7 checks passed
@krucod3 krucod3 deleted the 212_restart_policy_interface branch April 2, 2024 11:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking-change Issue will appear in the change log "Breaking Changes" enhancement New feature or request. Issue will appear in the change log "Features"
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants