diff options
Diffstat (limited to 'captain/api.f90')
-rw-r--r-- | captain/api.f90 | 22 |
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 |