scripts: reordered functions to allow decorator to work with no job_id