X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/1e74db260a84317d58969b9b530d0d87a325da9c..242d3272391baeb95eb0a5e4e51627c2d54e7bc6:/services/nodemanager/arvnodeman/computenode/dispatch/slurm.py diff --git a/services/nodemanager/arvnodeman/computenode/dispatch/slurm.py b/services/nodemanager/arvnodeman/computenode/dispatch/slurm.py index 39ee48f240..919b57f42c 100644 --- a/services/nodemanager/arvnodeman/computenode/dispatch/slurm.py +++ b/services/nodemanager/arvnodeman/computenode/dispatch/slurm.py @@ -34,8 +34,16 @@ class ComputeNodeShutdownActor(ShutdownActorBase): def _get_slurm_state(self): return subprocess.check_output(['sinfo', '--noheader', '-o', '%t', '-n', self._nodename]) + # The following methods retry on OSError. This is intended to mitigate bug + # #6321 where fork() of node manager raises "OSError: [Errno 12] Cannot + # allocate memory" resulting in the untimely death of the shutdown actor + # and tends to result in node manager getting into a wedged state where it + # won't allocate new nodes or shut down gracefully. The underlying causes + # of the excessive memory usage that result in the "Cannot allocate memory" + # error are still being investigated. + @ShutdownActorBase._retry((subprocess.CalledProcessError, OSError)) - def cancel_shutdown(self): + def cancel_shutdown(self, reason): if self._nodename: if self._get_slurm_state() in self.SLURM_DRAIN_STATES: # Resume from "drng" or "drain" @@ -44,17 +52,17 @@ class ComputeNodeShutdownActor(ShutdownActorBase): # Node is in a state such as 'idle' or 'alloc' so don't # try to resume it because that will just raise an error. pass - return super(ComputeNodeShutdownActor, self).cancel_shutdown() + return super(ComputeNodeShutdownActor, self).cancel_shutdown(reason) - @ShutdownActorBase._stop_if_window_closed @ShutdownActorBase._retry((subprocess.CalledProcessError, OSError)) + @ShutdownActorBase._stop_if_window_closed def issue_slurm_drain(self): self._set_node_state('DRAIN', 'Reason=Node Manager shutdown') self._logger.info("Waiting for SLURM node %s to drain", self._nodename) self._later.await_slurm_drain() - @ShutdownActorBase._stop_if_window_closed @ShutdownActorBase._retry((subprocess.CalledProcessError, OSError)) + @ShutdownActorBase._stop_if_window_closed def await_slurm_drain(self): output = self._get_slurm_state() if output in self.SLURM_END_STATES: