Recently, while having lunch with some former members of my project the conversation drifted to some of the old code that's still around. These guys are incredibly good programmers, and so many of their contributions are still running today - four to six years after they've left the project.
One of the items that we discussed was our "batch broker" - a process responsible for handing out unique batch ids - that uniquely identify processes, end up in logs, in audit tables, and sometimes tagged to rows in the database.
We laughed about how embarrassingly simple this process was: just a few dozen lines of python code that
- open up and lock a file
- increment the number within
- close & lock the file
- log the requester & new batch_id
- return the batch_id
Our myriad batch programs (transforms, loads, publishes, etc) then simply call a bash or python function on their local system which calls this program remotely over ssh to get a new batch_id. Total amount of code is maybe 50 lines across all libraries.