Skip to content

Commit

Permalink
test: background process testing
Browse files Browse the repository at this point in the history
  • Loading branch information
Zachary Bailey committed Apr 22, 2024
1 parent ae24506 commit e525813
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion vhdbuilder/packer/install-dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,18 @@ for imageToBePulled in ${ContainerImages[*]}; do
echo " - ${CONTAINER_IMAGE}" >> ${VHD_LOGS_FILEPATH}
while [[ $(jobs -p | wc -l) -ge $PARALLEL_CONTAINER_IMAGE_PULL_LIMIT ]]; do
wait -n
done
done
bg_processes=$(ps -o pid,cmd --no-headers | wc -l)
active_pulls=0
for pid in ${containerImagePids[@]}; do
if kill -0 $pid 2>/dev/null; then
active_pulls=$((active_pulls + 1))
fi
done
other_bg_processes=$((bg_processes - active_pulls))
echo "Number of background processes: $bg_processes"
echo "Number of parallel container pulls: $active_pulls"
echo "Number of other background processes: $other_bg_processes"
done
wait ${containerImagePids[@]}
done
Expand Down

0 comments on commit e525813

Please sign in to comment.