ArchiveTeam / seesaw-kit

Making a reusable toolkit for writing seesaw scripts
Other
69 stars 30 forks source link

Add on_cleanup event to pipeline #56

Closed hannahwhy closed 10 years ago

hannahwhy commented 10 years ago

Some pipelines (i.e. ArchiveBot's) run threads that, if not terminated, will prevent the usual touch STOP mechanism from stopping a pipeline*. Such pipelines need a way to be told "hey, the runner's about to stop, so do whatever you need to do to prepare for shutdown".

This commit adds such an event and makes SimpleRunner (i.e. what most Seesaw sessions use) trigger it.

(Because this event requires runner-pipeline interaction, other Runner subclasses will have to be sure that they trigger it.)

I have only added this event to the python3/development branch because it's currently only really of use to ArchiveBot, and ArchiveBot uses the aforementioned branch. It should not be too difficult to backport the change if that is desired.

*: https://github.com/ArchiveTeam/ArchiveBot/compare/pipeline-next%5E%5E%5E...pipeline-next