Improved dtl-run function to detect whether current file is task or job