aboutsummaryrefslogtreecommitdiff
path: root/captain/api.f90
diff options
context:
space:
mode:
authorJeffrey Armstrong <jeff@approximatrix.com>2021-04-07 20:17:41 -0400
committerJeffrey Armstrong <jeff@approximatrix.com>2021-04-07 20:17:41 -0400
commit26eee62be8820373a61654c51c6f3622fe46d166 (patch)
treede8eceb3efb8383b681a3a3ce2803a78cfeb5b46 /captain/api.f90
parent90591a3e98463bec9bb678a5058b8d714c765054 (diff)
downloadlevitating-26eee62be8820373a61654c51c6f3622fe46d166.tar.gz
levitating-26eee62be8820373a61654c51c6f3622fe46d166.zip
Fixed tasks such that they are created in the db initially. Fixed link to results to be consistent with filenames for saving results.
Diffstat (limited to 'captain/api.f90')
-rw-r--r--captain/api.f9022
1 files changed, 10 insertions, 12 deletions
diff --git a/captain/api.f90 b/captain/api.f90
index 003a601..19c4cea 100644
--- a/captain/api.f90
+++ b/captain/api.f90
@@ -35,17 +35,17 @@ contains
implicit none
class(request)::req
- character(8)::job_text, task_text
integer::job_i, task_i, ierr
- call req%path_component(5, job_text)
- read(job_text, *, iostat=ierr) job_i
-
+ job_i = req%path_component_int(5)
if(ierr == 0) then
- call req%path_component(7, task_text)
- read(task_text, *, iostat=ierr) task_i
+
+ task_i = req%path_component_int(7)
if(ierr == 0) then
- if(req%query_string == "starting" .or. req%query_string == "inprogress") then
+ if(req%query_string == "starting") then
+ call insert_task(job_i, task_i)
+ call update_job_status(job_i, JOB_STATUS_WORKING)
+ else if(req%query_string == "inprogress") then
call update_task_status(job_i, task_i, JOB_STATUS_WORKING)
call update_job_status(job_i, JOB_STATUS_WORKING)
else if(req%query_string == "complete") then
@@ -68,9 +68,8 @@ contains
type(request), intent(in)::req
type(response)::resp
- character(8)::job_text
character(PLAYER_NAME_LENGTH)::player, instruction
- integer::job_i, player_i, instruction_i, ierr
+ integer::job_i, player_i, ierr
character(len=:), pointer::checkin_work_json
@@ -78,10 +77,9 @@ contains
! Failed - "/api/player/{name}/job/{jobid}/failed"
! Task - "/api/player/{name}/job/{jobid}/task/{task num}"
if(trim(req%component(2)) == "player" .and. trim(req%component(4)) == "job") then
- call req%path_component(5, job_text)
- read(job_text, *, iostat=ierr) job_i
+ job_i = req%path_component_int(5)
- if(ierr == 0 .and. .not. is_final_job_status(job_i)) then
+ if(is_final_job_status(job_i)) then
if(trim(req%component(6)) == "complete") then
call update_job_status(job_i, JOB_STATUS_SUCCESS)
else if(trim(req%component(6)) == "failure") then