How to get summary of pulp tasks from katello task export?
Environment
- Red Hat Satellite 6
Issue
- investigating a problem with pulp task system
- possible problems being investigated: some task hasnt been picked up, some task was pending to be picked up for hours, etc.
- having Satellite/katello task-export, how can I get a list of
pulptasks from it?- ideally with information like starting and finish time, worker executing the task and pulp task type
Resolution
- unpack task export archive and go to the directory with tasks:
tar xzf task-export-1456312264.tar.gz
cd tmp/task-export*
- execute the below script - modify PATTERN to filter just tasks started or finished in that time
# PATTERN should filter timestamps like "2025-01-04T01:02:03" and not "2025-01-04 11:22:33", so we encourage having the "T" in the pattern
PATTERN="2025-01-0[4-7]T"
for i in $(grep -c "/pulp/api/v3/tasks/" *html | grep -v ":0" | cut -d: -f1); do if [ $(grep -c "${PATTERN}" $i) -gt 0 ]; then echo $(grep -e started_at: -e finished_at: -e worker: -e "name: pulp" -e pulp_href: $i) | tr '\n' '\t'; fi; echo; done | sed "s/- pulp_href:/\n- pulp_href:/g" | awk '{ print $3" "$5" "$7" "$9" "$11 }' | sed "s/\"//g" | sed "s/\'//g" | sort -nk3 | uniq > workers_activity.txt
- for pulp-2 (Satellite 6.9 or older), use this version of script:
PATTERN="2016-01-0[4-7]"
for i in $(grep -c "queue: reserved_resource_worker" * | grep -v ":0" | cut -d: -f1); do
if [ $(grep -c "${PATTERN}" $i) -gt 0 ]; then
echo $(grep -e start_time -e finish_time -e queue: -e task_type: -e task_id: $i) | tr '\n' '\t'
fi
echo
done \
| sed "s/ task_type/\n task_type/g" | awk '{ print $8" "$6" "$NF" "$2" "$4 }' | grep -v "^[ ]*$" | sort -n | uniq > workers_activity.txt
workers_activity.txt having columns:
start_time_of_job end_time_of_job worker_that_run_the_job type_of_pulp_task task_id
-
Be aware, the table would not capture running tasks well.
-
When adding some other information to the output, add it to "
echo $(grep -e start_time .." line and then to "awk '{ print $6.." (with "$12" on some position in theawk print)
For more KB articles/solutions related to Red Hat Satellite 6.x Pulp 2.0 Issues, please refer to the Consolidated Troubleshooting Article for Red Hat Satellite 6.x Pulp 2.0-related Issues
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.