From 26eee62be8820373a61654c51c6f3622fe46d166 Mon Sep 17 00:00:00 2001 From: Jeffrey Armstrong Date: Wed, 7 Apr 2021 20:17:41 -0400 Subject: Fixed tasks such that they are created in the db initially. Fixed link to results to be consistent with filenames for saving results. --- captain/db.f90 | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'captain/db.f90') diff --git a/captain/db.f90 b/captain/db.f90 index 7937383..7bc501d 100644 --- a/captain/db.f90 +++ b/captain/db.f90 @@ -608,13 +608,32 @@ contains end subroutine update_job_time + subroutine insert_task(job_id, task_id) + implicit none + + 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%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 + call stmt%step_now() + end if + end if + call stmt%finalize() + + call update_job_time(job_id) + + end subroutine insert_task + subroutine update_task_status(job_id, task_id, status) implicit none integer, intent(in)::job_id, task_id, status type(sqlite3_stmt)::stmt - if(stmt%prepare(db, "UPDATE jobs SET status=? WHERE job=? AND task=?") == SQLITE_OK) then + if(stmt%prepare(db, "UPDATE tasks SET status=? WHERE job=? AND task=?") == SQLITE_OK) then if(stmt%bind_int(1, status) == SQLITE_OK .and. & stmt%bind_int(2, job_id) == SQLITE_OK .and. & stmt%bind_int(3, task_id) == SQLITE_OK) then -- cgit v1.2.3