MarcusBarnes / mik

The Move to Islandora Kit is an extensible PHP command-line tool for converting source content and metadata into packages suitable for importing into Islandora (or other digital repository and preservations systems).
GNU General Public License v3.0
34 stars 10 forks source link

Add post-completion hooks #156

Open mjordan opened 8 years ago

mjordan commented 8 years ago

It would be useful to be able to fire one or more scripts just before MIK stops executing. Some use cases are to send an email when the job completes, to run QA scripts on all the output, or to copy/Bag MIK's output.

One way of implementing this would be using register_shutdown_function(), having the hook scripts run as background processes.

mjordan commented 8 years ago

Related issue: https://github.com/MarcusBarnes/mik/issues/148.

bondjimbond commented 7 years ago

Here's a use case for this kind of functionality. Specifically, I'd like to see an option to clear the temp_directory after the run. Here's why:

I’ve got 11 different CSV files to process. The first runs through MIK smoothly. But for all subsequent runs, despite MIK correctly finding the desired CSV, MIK spits out XML and PDFs as if it were reading the first CSV.

This happens because of the temp_directory: If the “metadata” files aren’t cleared from the temp_directory first, MIK just reads those files instead of reading the new CSV.

An option to clear out the temp_directory would make multiple consecutive runs much simpler.

mjordan commented 7 years ago

We could provide a standard script to clear out the temp directory. All you'd need to do is enable/disable the script in the [WRITER] section of your .ini file.

MarcusBarnes commented 7 years ago

Further to @mjordan's comment, such as script would also make a nice example (while still being useful).

mjordan commented 7 years ago

@MarcusBarnes I'd like to pursue adding a register_shutdown_function() to mik which would loop through all registered scripts. What do you think? We could register them in [WRITER] shutdownhooks[] entries. Any objections? Might not get to it until the weekend.

MarcusBarnes commented 7 years ago

@mjordan Sounds like a good approach to explore. Thank you.

mjordan commented 7 years ago

I said the weekend, but I need to put https://github.com/MarcusBarnes/mik/issues/293 to bed first.

mjordan commented 7 years ago

188 may offer another potential use case.

mjordan commented 7 years ago

First version of the wiki docs at https://github.com/MarcusBarnes/mik/wiki/Shutdown-hooks. Please take a look.

jpeak5 commented 7 years ago

@mjordan I added a comment about the wiki here https://github.com/MarcusBarnes/mik/issues/354