Open mjordan opened 8 years ago
Related issue: https://github.com/MarcusBarnes/mik/issues/148.
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.
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.
Further to @mjordan's comment, such as script would also make a nice example (while still being useful).
@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.
@mjordan Sounds like a good approach to explore. Thank you.
I said the weekend, but I need to put https://github.com/MarcusBarnes/mik/issues/293 to bed first.
First version of the wiki docs at https://github.com/MarcusBarnes/mik/wiki/Shutdown-hooks. Please take a look.
@mjordan I added a comment about the wiki here https://github.com/MarcusBarnes/mik/issues/354
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.