Issue #1674
closedTasks in canceled state can not be purged
Description
Tasks Purge doesn't recognize canceled or waiting stage.
[root@ibm-x3550m3-09 ~]# rpm -qa |grep pulp
pulp-rpm-handlers-2.8.0-0.5.beta.git.38.5c48348.el7.noarch
pulp-admin-client-2.8.0-0.5.beta.git.59.f7eb659.el7.noarch
pulp-agent-2.8.0-0.5.beta.git.88.61a6029.el7.noarch
python-pulp-docker-common-2.0.0-0.5.beta.git.10.3ce1ef2.el7.noarch
pulp-rpm-admin-extensions-2.8.0-0.5.beta.git.25.8b3df25.el7.noarch
python-pulp-agent-lib-2.8.0-0.5.beta.git.88.61a6029.el7.noarch
python-isodate-0.5.0-4.pulp.el7.noarch
python-pulp-puppet-common-2.8.0-0.5.beta.git.4.2960d39.el7.noarch
python-pulp-oid_validation-2.8.0-0.5.beta.git.59.f7eb659.el7.noarch
pulp-puppet-plugins-2.8.0-0.5.beta.git.4.2960d39.el7.noarch
pulp-puppet-admin-extensions-2.8.0-0.5.beta.git.4.2960d39.el7.noarch
pulp-puppet-consumer-extensions-2.8.0-0.5.beta.git.6.5894bd0.el7.noarch
pulp-docker-plugins-2.0.0-0.5.beta.git.10.3ce1ef2.el7.noarch
python-pulp-repoauth-2.8.0-0.5.beta.git.59.f7eb659.el7.noarch
pulp-rpm-plugins-2.8.0-0.5.beta.git.25.8b3df25.el7.noarch
python-pulp-bindings-2.8.0-0.5.beta.git.59.f7eb659.el7.noarch
pulp-docker-admin-extensions-2.0.0-0.5.beta.git.10.3ce1ef2.el7.noarch
python-pulp-streamer-2.8.0-0.5.beta.git.59.f7eb659.el7.noarch
pulp-rpm-consumer-extensions-2.8.0-0.5.beta.git.38.5c48348.el7.noarch
pulp-puppet-handlers-2.8.0-0.5.beta.git.6.5894bd0.el7.noarch
python-pulp-rpm-common-2.8.0-0.5.beta.git.25.8b3df25.el7.noarch
pulp-server-2.8.0-0.5.beta.git.59.f7eb659.el7.noarch
pulp-selinux-2.8.0-0.5.beta.git.59.f7eb659.el7.noarch
pulp-consumer-client-2.8.0-0.5.beta.git.88.61a6029.el7.noarch
pulp-rpm-yumplugins-2.8.0-0.5.beta.git.38.5c48348.el7.noarch
python-pulp-common-2.8.0-0.5.beta.git.59.f7eb659.el7.noarch
python-kombu-3.0.33-1.pulp.el7.noarch
python-pulp-client-lib-2.8.0-0.5.beta.git.59.f7eb659.el7.noarch
1. Create a repo & run repo sync
2. Cancel the sync so that the task is in a waiting state
3. Run pulp-admin tasks purge -s canceled
[root@ibm-x3550m3-09 ~]# pulp-admin tasks purge -s canceled
+----------------------------------------------------------------------+
Purge Completed Tasks
+----------------------------------------------------------------------+
Invalid task state passed to purge: canceled.
[root@ibm-x3550m3-09 ~]# pulp-admin tasks purge -s waiting
+----------------------------------------------------------------------+
Purge Completed Tasks
+----------------------------------------------------------------------+
Invalid task state passed to purge: waiting.
Updated by sbhawsin about 8 years ago
Only tasks that are completed i.e.(finished, error, skipped states) can be purged except the 'canceled' state. It will be risky to expose the purge functionality for canceled and waiting states because it might leave the system in an inconsistent state.
The documents also mentions this here https://github.com/pulp/pulp/blob/master/docs/user-guide/admin-client/tasks.rst#purging
Updated by pthomas@redhat.com about 8 years ago
- Status changed from NEW to CLOSED - NOTABUG
Closing as per the comment.
Updated by bmbouter about 8 years ago
I agree that given how the documentation reads this should be closed, but it's not obvious to me why the 'canceled' state is not a final state that can be purged.
Updated by bmbouter about 8 years ago
This could get re-opened as a story to have the canceled state be purge-able.
Updated by rbarlow about 8 years ago
bmbouter wrote:
I agree that given how the documentation reads this should be closed, but it's not obvious to me why the 'canceled' state is not a final state that can be purged.
Hello Brian!
The problem is that the 'canceled' state has two meanings, and it is not obvious which meaning applies to any given task. Meaning one is "cancel requested" and meaning two is "cancel complete". I've filed an issue about this, which would be a great to fix in Pulp 3:
Updated by bmbouter about 8 years ago
@rbarlow, +1 to having the state more clearly reflect what is happening. With or without that change, it's still not clear why purging the TaskStatus records could have a negative impact, even with today's code and possible task states. Once the cancel is handled by the webserver, it sends a celery signal to all workers which are stored in a registry of cancelled tasks internally to Celery. In other words once celery is told to cancel a task, removing the TaskStatus record should have no effect.
Updated by rbarlow about 8 years ago
Pulp wrote:
it's still not clear why purging the TaskStatus records could have a
negative impact, even with today's code and possible task states. Once
the cancel is handled by the webserver, it sends a celery signal to all
workers which are stored in a registry of cancelled tasks internally to
Celery. In other words once celery is told to cancel a task, removing
the TaskStatus record should have no effect.
Hello Brian!
I think the only problem lies with tasks that don't immediately stop
when getting canceled (like a sync/publish). Those may continue writing
data to the TaskStatus. That is probably not a big deal, but something
to consider. Maybe it's fine for them to just write to nothing and error
(or maybe they would fail silently depending on how they form their
update query).
--
Randy Barlow
irc: bowlofeggs
Updated by bmbouter about 8 years ago
@rbarlow, yes that makes sense. Thanks for the info.