aboutsummaryrefslogtreecommitdiff
path: root/captain/db.f90
diff options
context:
space:
mode:
authorJeffrey Armstrong <jeff@approximatrix.com>2021-04-08 09:31:55 -0400
committerJeffrey Armstrong <jeff@approximatrix.com>2021-04-08 09:31:55 -0400
commiteaf8cf88305640cdaf274504c1cead5e88bf09d4 (patch)
tree6aa1814e7172f001c62ad2a15da86970b7e1860f /captain/db.f90
parent26eee62be8820373a61654c51c6f3622fe46d166 (diff)
downloadlevitating-eaf8cf88305640cdaf274504c1cead5e88bf09d4.tar.gz
levitating-eaf8cf88305640cdaf274504c1cead5e88bf09d4.zip
Fixed task handling inside the captain. Fixed static file delivery.
Diffstat (limited to 'captain/db.f90')
-rw-r--r--captain/db.f9013
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