From 025b5d1dcbb30e727afee3307d49328432bae603 Mon Sep 17 00:00:00 2001 From: Jeffrey Armstrong Date: Fri, 9 Apr 2021 08:09:20 -0400 Subject: Modified how logging works so that multiple processes can write in theory. --- captain/api.f90 | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) (limited to 'captain/api.f90') diff --git a/captain/api.f90 b/captain/api.f90 index b330d30..fc4e248 100644 --- a/captain/api.f90 +++ b/captain/api.f90 @@ -41,9 +41,9 @@ contains if(associated(req%query_string)) then job_i = req%path_component_int(5) task_i = req%path_component_int(7) - call write_log("task update is "//trim(req%query_string)) + call write_log("Task Update Is "//trim(req%query_string), LOG_DEBUG) if(req%query_string == "starting") then - call write_log("Inserting task") + call write_log("Inserting task", LOG_DEBUG) call insert_task(job_i, task_i) call update_job_status(job_i, JOB_STATUS_WORKING) else if(req%query_string == "inprogress") then @@ -78,13 +78,11 @@ 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") + call write_log("Job "//trim(req%component(5))//" update arrived", LOG_INFO) write(player, *) job_i - call write_log("int is "//trim(player)) 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 @@ -93,7 +91,7 @@ contains end if if(trim(req%component(6)) == "task") then - call write_log("Task update encountered") + call write_log("Task update encountered", LOG_INFO) call handle_task_request(req) end if @@ -119,7 +117,7 @@ contains checkin_work_json => build_job_available_json(job_i) if(associated(checkin_work_json)) then resp%code = GEMINI_CODE_SUCCESS - call write_log("Sending: "//trim(checkin_work_json)) + call write_log("Sending: "//trim(checkin_work_json), LOG_DEBUG) call resp%set_body_contents(trim(checkin_work_json), "text/gemini") deallocate(checkin_work_json) else @@ -161,7 +159,7 @@ contains fullpath => null() - call write_log("Titan request encountered") + call write_log("Titan request encountered", LOG_INFO) ! Task - "/api/player/{name}/job/{jobid}/task/{task num}" if(trim(req%component(2)) == "player" .and. & @@ -175,7 +173,7 @@ contains write(job_text, '(I6)') job_id write(task_text, '(I6)') task_num - call write_log("Handling a task update for job "//trim(job_text)//" task "//trim(task_text)) + call write_log("Handling a task update for job "//trim(job_text)//" task "//trim(task_text), LOG_INFO) call handle_task_request(req) fullpath => get_task_result_static_filename(job_id, task_num) @@ -185,7 +183,7 @@ contains if(associated(fullpath)) then ! Write the file - call write_log("Storing titan file to "//trim(fullpath)) + call write_log("Storing titan file to "//trim(fullpath), LOG_DEBUG) call req%write_to(fullpath) -- cgit v1.2.3