get_restart_defaults Subroutine

public subroutine get_restart_defaults(auto_restart, restart_delay, restart_max, self_exe)

Read supervisor defaults from the manifest (when present).

These are used by watch_restart and can be configured under [extra.fpm-watch].

Keys: - auto-restart (logical) - restart-delay (real, seconds) - restart-max (integer, 0 = unlimited) - self or self-exe (string, explicit path to fpm-watch)

Arguments

Type IntentOptional Attributes Name
logical, intent(out) :: auto_restart
real, intent(out) :: restart_delay
integer, intent(out) :: restart_max
character(len=:), intent(out), allocatable :: self_exe

Calls

proc~~get_restart_defaults~~CallsGraph proc~get_restart_defaults get_restart_defaults proc~load_watch_table load_watch_table proc~get_restart_defaults->proc~load_watch_table proc~toml_get_int toml_get_int proc~get_restart_defaults->proc~toml_get_int proc~toml_get_logical toml_get_logical proc~get_restart_defaults->proc~toml_get_logical proc~toml_get_real toml_get_real proc~get_restart_defaults->proc~toml_get_real proc~toml_get_string toml_get_string proc~get_restart_defaults->proc~toml_get_string exists exists proc~load_watch_table->exists get_value get_value proc~load_watch_table->get_value read_package_file read_package_file proc~load_watch_table->read_package_file proc~toml_get_int->get_value proc~toml_get_logical->get_value proc~toml_get_real->get_value proc~toml_get_string->get_value

Called by

proc~~get_restart_defaults~~CalledByGraph proc~get_restart_defaults get_restart_defaults proc~parse_restart_flags parse_restart_flags proc~parse_restart_flags->proc~get_restart_defaults proc~maybe_supervise maybe_supervise proc~maybe_supervise->proc~parse_restart_flags

Source Code

   subroutine get_restart_defaults(auto_restart, restart_delay, restart_max, self_exe)
      logical, intent(out) :: auto_restart
      real, intent(out) :: restart_delay
      integer, intent(out) :: restart_max
      character(len=:), allocatable, intent(out) :: self_exe

      type(toml_table), allocatable :: root
      type(toml_table), pointer :: wt
      logical :: ok
      character(len=:), allocatable :: tmp

      auto_restart  = .false.
      restart_delay = 1.0
      restart_max   = 0
      self_exe      = ""

      call load_watch_table(root, wt, ok)
      if (.not. ok) return

      call toml_get_logical(wt, "auto-restart",  auto_restart)
      call toml_get_real(wt,    "restart-delay", restart_delay)
      call toml_get_int(wt,     "restart-max",   restart_max)

      tmp = ""
      call toml_get_string(wt, "self", tmp)
      if (len_trim(tmp) == 0) call toml_get_string(wt, "self-exe", tmp)
      if (len_trim(tmp) > 0) self_exe = trim(tmp)

      if (restart_delay < 0.0) restart_delay = 0.0
      if (restart_max < 0) restart_max = 0
   end subroutine get_restart_defaults