code: def test_node_hash(tmpdir):
      from nipype.interfaces.utility import Function
  
      tmpdir.chdir()
  
      config.set_default_config()
      config.set("execution", "stop_on_first_crash", True)
      config.set("execution", "crashdump_dir", os.getcwd())
  
      def func1():
          return 1
  
      def func2(a):
          return a + 1
  
      n1 = pe.Node(
          Function(input_names=[], output_names=["a"], function=func1),
          name="n1",
      )
      n2 = pe.Node(
          Function(
              input_names=["a"], output_names=["b"], function=func2
          ),
          name="n2",
      )
      w1 = pe.Workflow(name="test")
  
      def modify(x):
          return x + 1
  
      n1.inputs.a = 1
      w1.connect(n1, ("a", modify), n2, "a")
      w1.base_dir = os.getcwd()
  
      # create dummy distributed plugin class
      from nipype.pipeline.plugins.base import DistributedPluginBase
  
      # create a custom exception
      class EngineTestException(Exception):
          pass
  
      class RaiseError(DistributedPluginBase):
          def _submit_job(self, node, updatehash=False):
              raise EngineTestException(
                  "Submit called - cached=%s, updated=%s"
                  % node.is_cached()
              )
  
      # check if a proper exception is raised
      with pytest.raises(EngineTestException) as excinfo:
          w1.run(plugin=RaiseError())
      assert str(excinfo.value).startswith("Submit called")
  
      # generate outputs
      w1.run(plugin="Linear")
      # ensure plugin is being called
      config.set("execution", "local_hash_check", False)
  
      # rerun to ensure we have outputs
      w1.run(plugin="Linear")
  
      # set local check
      config.set("execution", "local_hash_check", True)
      w1 = pe.Workflow(name="test")
      w1.connect(n1, ("a", modify), n2, "a")
      w1.base_dir = os.getcwd()
      w1.run(plugin=RaiseError())
  
imports: import os
  from copy import deepcopy
  import pytest
  from ....None import config
  from ....interfaces import utility
  from ....interfaces import base
  from ...None import engine
  from ..utils import merge_dict
  from .test_base import EngineTestInterface
  from .test_utils import UtilsTestInterface
label_desc: Use image node_id 7 for calling a global function with example usage: test_node_hash(tmpdir) and returns: int, unknown, unknown