     job "Error when creating tasks" 
     (let [spec (-> (jdbc/query (rdbms/get-ds) 
                                ["SELECT * FROM job_specifications WHERE id = ?" 
-                                (:expanded_job_specification_id job)])
+                                (:job_specification_id job)])
                    first :data)]
       (build-tasks job spec))))
 

  (if-let [job (get-job (:job_id message))] 
    (wrap-exception-create-job-issue 
      job "Error during create-tasks-and-trials" 
      (-> job expand-job-spec create-tasks)
      (doseq [task-with-id (jdbc/query 
                             (rdbms/get-ds) 
                             ["SELECT id FROM tasks WHERE job_id = ?" 

        job "Error during task creation" 
        (task/create-db-task raw-task)))))


;### create tasks for job ###############################################

