[Pulp-dev] pulp3: task - worker relationship

Michael Hrivnak mhrivnak at redhat.com
Wed Nov 16 22:28:24 UTC 2016

Looking at the Task model, I noticed that it has a foreign key to Worker.
That's useful. But because the default on_delete policy is "CASCADE", if
the worker gets deleted (such as when it simply shuts down or gets
restarted), so will the task record. That's not desirable, because we want
to keep task history around.


- We could set the policy to SET_NULL. When the worker entry gets deleted,
the task would simply lose its record of which worker it ran on.
- We could change this to a TextField and just capture the name of the
worker. This would have more long-term value in case someone wants to know
what host and process ran a task.

Given how thin the Worker model is, I don't anticipate that someone looking
at a task would want dig into the worker entry to know anything else
besides the name. So capturing that directly on the Task model would likely

Or we could add a "worker_name" field for posterity and keep the
ForeignKey, giving us the best of both worlds.

Thoughts? Other ideas?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/pulp-dev/attachments/20161116/92845bf4/attachment.htm>

More information about the Pulp-dev mailing list