diff options
Diffstat (limited to 'captain/db.f90')
-rw-r--r-- | captain/db.f90 | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/captain/db.f90 b/captain/db.f90 index 7bc501d..56e8a70 100644 --- a/captain/db.f90 +++ b/captain/db.f90 @@ -569,11 +569,16 @@ contains end function get_job_tasks subroutine update_job_status(job_id, status) + use logging implicit none integer, intent(in)::job_id, status type(sqlite3_stmt)::stmt - + character(128)::msg + + write(msg, *) "Update ", job_id, " to ", status + call write_log(trim(msg)) + if(stmt%prepare(db, "UPDATE jobs SET status=? WHERE id=?") == SQLITE_OK) then if(stmt%bind_int(1, status) == SQLITE_OK .and. stmt%bind_int(2, job_id) == SQLITE_OK) then call stmt%step_now() @@ -614,7 +619,7 @@ contains integer, intent(in)::job_id, task_id type(sqlite3_stmt)::stmt - if(stmt%prepare(db, "INSERT INTO tasks(job, task, status) VALUES(?,?,?") == SQLITE_OK) then + if(stmt%prepare(db, "INSERT INTO tasks(job, task, status) VALUES(?,?,?)") == SQLITE_OK) then if(stmt%bind_int(1, job_id) == SQLITE_OK .and. & stmt%bind_int(2, task_id) == SQLITE_OK .and. & stmt%bind_int(3, JOB_STATUS_WORKING) == SQLITE_OK) then @@ -647,15 +652,19 @@ contains end subroutine update_task_status function is_final_job_status(job_id) + use logging implicit none integer, intent(in)::job_id logical::is_final_job_status integer::i + character(128)::s i = get_job_status(job_id) is_final_job_status = (i == JOB_STATUS_SUCCESS .or. i == JOB_STATUS_FAILURE) + write(s, *) "Status for ", job_id, " is ", i, " or ", is_final_job_status + call write_log(trim(s)) end function is_final_job_status |