class_docstr: A context manager to run NiPype interfaces.
docstr: Tear-down interface execution.
docstr_tok: ["Tear-down","interface","execution","."]
code: def __exit__(self, exc_type, exc_value, exc_tb):
      """Tear-down interface execution."""
      self._runtime.endTime = dt.isoformat(dt.utcnow())
      timediff = parseutc(self._runtime.endTime) - parseutc(
          self._runtime.startTime
      )
      self._runtime.duration = (
          timediff.days * 86400
          + timediff.seconds
          + timediff.microseconds / 1e6
      )
      # Collect monitored data
      for k, v in self._resmon.stop().items():
          setattr(self._runtime, k, v)
  
      os.chdir(self._runtime.prevcwd)
  
      if (
          exc_type is not None
          or exc_value is not None
          or exc_tb is not None
      ):
          import traceback
  
          # Retrieve the maximum info fast
          self._runtime.traceback = "".join(
              traceback.format_exception(exc_type, exc_value, exc_tb)
          )
          # Gather up the exception arguments and append nipype info.
          exc_args = (
              exc_value.args if getattr(exc_value, "args") else tuple()
          )
          exc_args += (
              f"An exception of type {exc_type.__name__} occurred while "
              f"running interface {self._runtime.interface}.",
          )
          self._runtime.traceback_args = (
              "\n".join([f"{arg}" for arg in exc_args]),
          )
  
          if self._ignore_exc:
              return True
  
      if hasattr(self._runtime, "cmdline"):
          retcode = self._runtime.returncode
          if retcode not in self._runtime.success_codes:
              self._runtime.traceback = f"RuntimeError: subprocess exited with code {retcode}."
  
imports: import os
  from contextlib import AbstractContextManager
  from copy import deepcopy
  from textwrap import wrap
  import re
  from datetime import datetime
  from dateutil.parser import parse
  import platform
  from ...None import logging, config
  from ...utils.misc import is_container, rgetcwd
  from ...utils.filemanip import md5, hash_infile
label_desc: Use image node_id 4 for calling the RuntimeContext obj's underlying member method code with example usage: obj.__exit__(exc_type, exc_value, exc_tb) and returns: True