From c493170e73506e974a0644452fc5a334c08171bc Mon Sep 17 00:00:00 2001 From: Jeffrey Armstrong Date: Wed, 7 Apr 2021 14:21:35 -0400 Subject: Fixed many issues related to reporting status. Initial debugging of titan upload handling. --- player/instructions.f90 | 21 ++++++++++++++++++--- player/levitating-player.prj | 24 ++++++------------------ player/player.F90 | 7 +++++-- player/talking.f90 | 4 ++-- 4 files changed, 31 insertions(+), 25 deletions(-) (limited to 'player') diff --git a/player/instructions.f90 b/player/instructions.f90 index 273c379..a3dc97a 100644 --- a/player/instructions.f90 +++ b/player/instructions.f90 @@ -34,9 +34,14 @@ contains character(len=:), allocatable::json_string_value logical::found - call j%get("idle", json_string_value, found) + call j%get("status", json_string_value, found) - work_available = .not. found + if(found) then + Print *, "Checkin status: "//json_string_value + work_available = (json_string_value /= "idle") + else + work_available = .false. + end if end function work_available @@ -140,7 +145,7 @@ contains character(*), intent(out)::label write(label, '(A6,I3,A2)') "tasks(", i, ")." - label = label//trim(component) + label = trim(label)//trim(component) end subroutine task_component @@ -242,6 +247,15 @@ contains call get_task_operation(j, i, operation) + Print *, "Task: ", i + Print *, "Operation: "//trim(operation) + + if(len_trim(operation) == 0) then + success = .false. + capture_filename => null() + return + end if + found = .true. capture_filename => null() @@ -326,6 +340,7 @@ contains task_count = get_task_count(j) + ! Remember to zero-index your json! do i = 1, task_count call get_status_url(job_id, i, url, status=STATUS_STARTING) diff --git a/player/levitating-player.prj b/player/levitating-player.prj index 8bfa9c8..3817ee4 100644 --- a/player/levitating-player.prj +++ b/player/levitating-player.prj @@ -8,22 +8,16 @@ "enabled":"1" },{ "filename":"../common/network.F90", - "enabled":"1", - "panel":1, - "open":"1" + "enabled":"1" },{ "filename":"../common/protocol.f90", - "enabled":"1", - "panel":1, - "open":"1" + "enabled":"1" },{ "filename":"../common/request.f90", "enabled":"1" },{ "filename":"../common/utilities.F90", - "enabled":"1", - "panel":1, - "open":"1" + "enabled":"1" },{ "filename":"../common/wsa.f90", "enabled":"0" @@ -35,9 +29,7 @@ "enabled":"1" },{ "filename":"endpoints.f90", - "enabled":"1", - "panel":1, - "open":"1" + "enabled":"1" },{ "filename":"instructions.f90", "enabled":"1", @@ -45,14 +37,10 @@ "open":"1" },{ "filename":"player.F90", - "enabled":"1", - "panel":1, - "open":"1" + "enabled":"1" },{ "filename":"talking.f90", - "enabled":"1", - "panel":1, - "open":"1" + "enabled":"1" },{ "filename":"tasks.f90", "enabled":"1" diff --git a/player/player.F90 b/player/player.F90 index f5e4055..bac6d6f 100644 --- a/player/player.F90 +++ b/player/player.F90 @@ -39,6 +39,7 @@ implicit none end if if(work_to_do) then + Print *, "Work Available" job_id = get_job_id_from_checkin(j_checkin) call get_instruction_name_from_checkin(j_checkin, instruction_name) @@ -46,6 +47,8 @@ implicit none instr_json_available = request_json(url, j_instructions) if(instr_json_available) then + Print *, "instructions available" + ! Task loop call perform_tasks(j_instructions, job_id) @@ -55,7 +58,7 @@ implicit none else #ifdef GNU - call sleep(50) + call sleep(20) #endif end if @@ -157,7 +160,7 @@ contains ! NOTE: will fail on Windows if(.not. associated(logfile)) then allocate(character(len=256) :: logfile) - logfile = "/tmp/levitating.log" + logfile = "/tmp/levitating-player.log" end if ! Assign this computer an identity if not explicitly specified diff --git a/player/talking.f90 b/player/talking.f90 index 9c9db05..733f463 100644 --- a/player/talking.f90 +++ b/player/talking.f90 @@ -23,7 +23,7 @@ contains mod_url = url open(newunit=unit_number, file=filename, status='UNKNOWN', & - access='STREAM', form='UNFORMATTED', iostat=istatus) + access='STREAM', form='FORMATTED', iostat=istatus) if(istatus == 0) then status_code = request_url(mod_url, unit_number, return_type) @@ -98,7 +98,7 @@ contains inquire(file=filename, size=file_size) - open(newunit=unit_number, file=trim(filename), status='UNKNOWN', & + open(newunit=unit_number, file=trim(filename), status='OLD', & access='STREAM', form='UNFORMATTED', iostat=istatus) if(istatus == 0) then -- cgit v1.2.3