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

restart fetch only when it is idling #548

Merged
merged 8 commits into from
Sep 26, 2022
Merged

restart fetch only when it is idling #548

merged 8 commits into from
Sep 26, 2022

Conversation

FuhuXia
Copy link
Member

@FuhuXia FuhuXia commented Sep 20, 2022

For GSA/data.gov#3962

Check catalog-fetch instances before restart. When none of them is generating new logs, and none of them shows CPU usage >=1%, we consider catalog-fetch is idling, can it can be restarted.

Copy link
Contributor

@nickumia-reisys nickumia-reisys left a comment

Choose a reason for hiding this comment

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

Why make a different file? Can't we just make a file restart_harvester.sh that can be passed with either catalog-gather or catalog-fetch?

Copy link
Contributor

@nickumia-reisys nickumia-reisys left a comment

Choose a reason for hiding this comment

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

🕹️

if script exits with non-zero, the entire github action will fail
@nickumia-reisys
Copy link
Contributor

Added a fix for the following case

image

image

@nickumia-reisys nickumia-reisys requested a review from a team September 26, 2022 13:00
instances=$(cf app $app_to_restart | grep '^instances:' | sed 's/.*\///')
i=0
cf app $app_to_restart | tail -n $instances | awk '{ split($4,cpu,"."); print cpu[1]}' | while read -r cpu ; do
if [[ $cpu < 1 ]]; then
Copy link
Contributor

Choose a reason for hiding this comment

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

where do we get $cpu from?

Copy link
Contributor

Choose a reason for hiding this comment

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

The while read -r cpu iterates through the previous command and makes the iteration available through the cpu variable.

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks! I feel like this line might benefit from a comment explaining the pipes.

@nickumia-reisys nickumia-reisys merged commit 98179d5 into main Sep 26, 2022
@nickumia-reisys nickumia-reisys deleted the restart-fetch branch September 26, 2022 16:51
@FuhuXia FuhuXia changed the title restart fetcfh only when it is idling restart fetch only when it is idling Sep 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants