Is your feature request related to a problem? Please describe.
If server crashes while the .ctllog or .ctx files are being written, these files will become corrupted or incomplete. This will cause any restart attempts to either crash immediately or behave unexpectedly.
Describe the solution you'd like
During the write operation, write to an alternate version of the file before replacing the final file.
To explain further, a job running under APP_NAME=my_job will periodically create a my_job.ctllog and my_job.ctx file in the temp dir.
During the write operation, the framework currently overwrites the above two files directly. Instead, it should write to .my_job.ctllog and .my_job.ctx first, then once complete, move+replace the file (shutil should be able to move and replace, if exists), such that the files are "all-or-nothing".