Skip to content

Commit 3240a8e

Browse files
fix: anchor grep patterns in get_progress and fix emit_status comment
Anchor percent_complete and estimated_time_remaining grep patterns to line start to prevent false matches from nested YAML values or comments. Fix emit_status argument list in comment to include the reset parameter. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 102a2a5 commit 3240a8e

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

scripts/openfe/runtime/check_status.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -183,8 +183,8 @@ get_progress() {
183183
yaml_file="$(ls -t "$replica_dir"/shared_*/simulation_real_time_analysis.yaml 2>/dev/null | head -1)"
184184
if [[ -n "$yaml_file" && -f "$yaml_file" ]]; then
185185
local pct eta
186-
pct="$(grep 'percent_complete:' "$yaml_file" | tail -1 | awk '{print $2}')"
187-
eta="$(grep 'estimated_time_remaining:' "$yaml_file" | tail -1 | sed 's/.*estimated_time_remaining: *//')"
186+
pct="$(grep -E '^[[:space:]]*percent_complete:' "$yaml_file" | tail -1 | awk '{print $2}')"
187+
eta="$(grep -E '^[[:space:]]*estimated_time_remaining:' "$yaml_file" | tail -1 | sed 's/.*estimated_time_remaining: *//')"
188188
if [[ -n "$pct" ]]; then
189189
[[ -n "$eta" ]] && echo "${pct}% (ETA: ${eta})" || echo "${pct}%"
190190
return
@@ -212,7 +212,7 @@ match_active_jobs() {
212212
done <<<"$matches"
213213
}
214214

215-
# Emit a status line. Args: replica_dir color status replica_id info
215+
# Emit a status line. Args: replica_dir color status reset replica_id info
216216
emit_status() {
217217
printf '%s\t%s\t%s\t%s\n' "$1" "$2$3$4" "replica_$5" "$6"
218218
}

0 commit comments

Comments
 (0)