Continued from NodeJsAndHofDiscussion
This is a basic "background" report launching and tracking draft to run reports that may take too long for an interactive session to accommodate.
(In practice there are various ways to reduce the need for these kind of tools, and RDBMS and report vendors often offer something similar, at least for their products, but that's another discussion.)
table: queue ------------ queue_id report_ref submitted_when submitted_by // user ID parameters // additional command line or URL parameters to append status // Processing, Complete, Error error_msg notif_method // how user notified when done: email, poll-screen, separate-screen table: reports ---------------- report_ID title launch_string_start // Start of URL or URI launch_string_cap // end of launch string, if applicable. ("parameters" above go in middle) finish_detection // how completion is detected: pipe, file, web (output) finish_string // string to look for in pipe, file-name, or web result match max_minutes // max number of minutes to wait until declared "stuck"This allows multiple languages and tools to potentially generate reports.
For those that generate files, ideally the file name contains the queue_id to keep it unique. Further, it's best to write to a temp file first, such as "1234.tmp", and then have the app or tool rename or move it to something like "1234.rpt" when it finishes, which the "finish_string" would look for, perhaps using an ID marker template.