Skip to content

Commit 8d5f97f

Browse files
committed
fix: replace condor_watch_q by condor_q in a loop
1 parent f4a4fff commit 8d5f97f

1 file changed

Lines changed: 20 additions & 4 deletions

File tree

.github/workflows/test-htcondor.yml

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,26 @@ jobs:
6060
6161
- name: Wait for Job Completion
6262
run: |
63-
# -table is an option for CI workflows that do not have an TTY attached
64-
echo "Monitoring Cluster ID: 1"
65-
docker exec -u test_user condor-local condor_watch_q -summary -exit all,done -clusters 1
66-
63+
# Using "condor_watch_q -summary -exit all,done -clusters 1" would have been better,
64+
# but it tries to use TTY for rendering information, which fails in GH workflows
65+
# So, use a more complex condor_q method...
66+
echo "Monitoring Cluster ID: 1..."
67+
for i in {1..60}; do
68+
# condor_q prints the Cluster ID only if the job is active/idle/running.
69+
# If the output is empty, the job has left the queue and is complete.
70+
STATUS=$(docker exec -u test_user condor-local condor_q 1 -format "%d" ClusterId)
71+
72+
if [ -z "$STATUS" ]; then
73+
echo "Job left the queue (Completed)!"
74+
exit 0
75+
fi
76+
77+
echo "Job is still pending/processing... ($i/60)"
78+
sleep 1
79+
done
80+
81+
echo "Error: Job did not finish within 60 seconds."
82+
exit 1
6783
- name: Verify Job Output Logs
6884
run: |
6985
# Check the output file written back to the GitHub workspace runner

0 commit comments

Comments
 (0)