-
Notifications
You must be signed in to change notification settings - Fork 18
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
Conversation
There was a problem hiding this 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
?
There was a problem hiding this 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
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 |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
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.