fortrangoingonforty/fgof-devloop / 9b6b6b6

Browse files

Harden devloop release edges

Authored by mfwolffe <wolffemf@dukes.jmu.edu>
SHA
9b6b6b6012099096f2bae5100908be8cb58aefb0
Parents
85ce6c4
Tree
55b14f0

3 changed files

StatusFile+-
M src/fgof_devloop.f90 6 0
M test/test_devloop_jobs.f90 8 0
M test/test_devloop_watch.f90 7 0
src/fgof_devloop.f90modified
@@ -536,6 +536,8 @@ contains
536
     if (present(options)) local_options = options
536
     if (present(options)) local_options = options
537
     call normalize_options(local_options)
537
     call normalize_options(local_options)
538
 
538
 
539
+    if (.not. local_options%restart_on_change) return
540
+
539
     effective_change_count = summary%change_count
541
     effective_change_count = summary%change_count
540
     if (.not. local_options%restart_on_directory_change) then
542
     if (.not. local_options%restart_on_directory_change) then
541
       effective_change_count = summary%file_change_count
543
       effective_change_count = summary%file_change_count
@@ -684,6 +686,10 @@ contains
684
     if (.not. job_state%spec%enabled) return
686
     if (.not. job_state%spec%enabled) return
685
     if (.not. job_state%configured) return
687
     if (.not. job_state%configured) return
686
     if (trigger%kind == FGOF_DEVLOOP_TRIGGER_NONE) return
688
     if (trigger%kind == FGOF_DEVLOOP_TRIGGER_NONE) return
689
+    if (job_state%released) then
690
+      plan%reason = "job released"
691
+      return
692
+    end if
687
 
693
 
688
     if (job_state%terminal_handoff_required .and. job_state%spec%release_on_handoff) then
694
     if (job_state%terminal_handoff_required .and. job_state%spec%release_on_handoff) then
689
       plan%should_release = .true.
695
       plan%should_release = .true.
test/test_devloop_jobs.f90modified
@@ -1,5 +1,6 @@
1
 program test_devloop_jobs
1
 program test_devloop_jobs
2
   use fgof_devloop, only : &
2
   use fgof_devloop, only : &
3
+    FGOF_DEVLOOP_JOB_ACTION_NONE, &
3
     FGOF_DEVLOOP_JOB_ACTION_RESTART, &
4
     FGOF_DEVLOOP_JOB_ACTION_RESTART, &
4
     FGOF_DEVLOOP_JOB_ACTION_START, &
5
     FGOF_DEVLOOP_JOB_ACTION_START, &
5
     attach_devloop_job, &
6
     attach_devloop_job, &
@@ -60,6 +61,13 @@ contains
60
     if (.not. job%released) error stop "release should mark devloop job released"
61
     if (.not. job%released) error stop "release should mark devloop job released"
61
     if (job%cleanup_needed) error stop "release should clear cleanup obligations"
62
     if (job%cleanup_needed) error stop "release should clear cleanup obligations"
62
     if (.not. job%running) error stop "release should not alter runtime state"
63
     if (.not. job%running) error stop "release should not alter runtime state"
64
+
65
+    plan = devloop_job_restart_plan(job, devloop_change_trigger(1, "source changed"))
66
+    if (plan%action /= FGOF_DEVLOOP_JOB_ACTION_NONE) error stop "released job should not plan action"
67
+    if (plan%should_stop) error stop "released job should not stop"
68
+    if (plan%should_start) error stop "released job should not start"
69
+    if (plan%should_restart) error stop "released job should not restart"
70
+    if (plan%reason /= "job released") error stop "released job reason should be explicit"
63
   end subroutine test_service_restart_plan
71
   end subroutine test_service_restart_plan
64
 
72
 
65
   subroutine test_terminal_handoff_plan()
73
   subroutine test_terminal_handoff_plan()
test/test_devloop_watch.f90modified
@@ -74,6 +74,13 @@ program test_devloop_watch
74
   if (trigger%kind /= FGOF_DEVLOOP_TRIGGER_CHANGE) error stop "watch changes should create a change trigger"
74
   if (trigger%kind /= FGOF_DEVLOOP_TRIGGER_CHANGE) error stop "watch changes should create a change trigger"
75
   if (trigger%change_count /= 4) error stop "watch trigger should carry the change count"
75
   if (trigger%change_count /= 4) error stop "watch trigger should carry the change count"
76
 
76
 
77
+  options = clear_devloop_options()
78
+  options%restart_on_change = .false.
79
+  trigger = devloop_watch_trigger(summary, options)
80
+  if (trigger%kind /= FGOF_DEVLOOP_TRIGGER_NONE) then
81
+    error stop "restart-on-change policy should suppress watch triggers"
82
+  end if
83
+
77
   options = clear_devloop_options()
84
   options = clear_devloop_options()
78
   options%restart_on_directory_change = .false.
85
   options%restart_on_directory_change = .false.
79
   options%min_restart_changes = 4
86
   options%min_restart_changes = 4