diff options
author | Jeffrey Armstrong <jeff@approximatrix.com> | 2021-04-08 09:31:55 -0400 |
---|---|---|
committer | Jeffrey Armstrong <jeff@approximatrix.com> | 2021-04-08 09:31:55 -0400 |
commit | eaf8cf88305640cdaf274504c1cead5e88bf09d4 (patch) | |
tree | 6aa1814e7172f001c62ad2a15da86970b7e1860f /captain/api.f90 | |
parent | 26eee62be8820373a61654c51c6f3622fe46d166 (diff) | |
download | levitating-eaf8cf88305640cdaf274504c1cead5e88bf09d4.tar.gz levitating-eaf8cf88305640cdaf274504c1cead5e88bf09d4.zip |
Fixed task handling inside the captain. Fixed static file delivery.
Diffstat (limited to 'captain/api.f90')
-rw-r--r-- | captain/api.f90 | 46 |
1 files changed, 26 insertions, 20 deletions
diff --git a/captain/api.f90 b/captain/api.f90 index 19c4cea..b330d30 100644 --- a/captain/api.f90 +++ b/captain/api.f90 @@ -32,27 +32,27 @@ contains subroutine handle_task_request(req) use server_response use captain_db + use logging implicit none class(request)::req - integer::job_i, task_i, ierr + integer::job_i, task_i - job_i = req%path_component_int(5) - if(ierr == 0) then - + if(associated(req%query_string)) then + job_i = req%path_component_int(5) task_i = req%path_component_int(7) - if(ierr == 0) 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 - call update_task_status(job_i, task_i, JOB_STATUS_SUCCESS) - else if(req%query_string == "failed") then - call update_task_status(job_i, task_i, JOB_STATUS_FAILURE) - end if + call write_log("task update is "//trim(req%query_string)) + if(req%query_string == "starting") then + call write_log("Inserting task") + 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 + call update_task_status(job_i, task_i, JOB_STATUS_SUCCESS) + else if(req%query_string == "failed") then + call update_task_status(job_i, task_i, JOB_STATUS_FAILURE) end if end if @@ -69,7 +69,7 @@ contains type(response)::resp character(PLAYER_NAME_LENGTH)::player, instruction - integer::job_i, player_i, ierr + integer::job_i, player_i character(len=:), pointer::checkin_work_json @@ -78,8 +78,13 @@ contains ! Task - "/api/player/{name}/job/{jobid}/task/{task num}" if(trim(req%component(2)) == "player" .and. trim(req%component(4)) == "job") then job_i = req%path_component_int(5) + call write_log("Job "//trim(req%component(5))//" update arrived") + + write(player, *) job_i + call write_log("int is "//trim(player)) - if(is_final_job_status(job_i)) then + if(.not. is_final_job_status(job_i)) then + call write_log("Processing line") if(trim(req%component(6)) == "complete") then call update_job_status(job_i, JOB_STATUS_SUCCESS) else if(trim(req%component(6)) == "failure") then @@ -87,7 +92,8 @@ contains end if end if - if(ierr == 0 .and. trim(req%component(6)) == "task") then + if(trim(req%component(6)) == "task") then + call write_log("Task update encountered") call handle_task_request(req) end if @@ -149,7 +155,7 @@ contains character(len=:), pointer::fullpath character(12)::job_text, task_text - integer::job_id, task_num, ierr + integer::job_id, task_num character(64)::msg |