new_contents: #!/usr/bin/env python
  
  """A kernel that compares two ASCII files and outputs the differences in a detailed
     format.
  """
  
  __author__    = "Ioannis Paraskevakos <i.paraskev@rutgers.edu>"
  __copyright__ = "Copyright 2014, http://radical.rutgers.edu"
  __license__   = "MIT"
  
  from copy import deepcopy
  
  from radical.ensemblemd.exceptions import ArgumentError
  from radical.ensemblemd.exceptions import NoKernelConfigurationError
  from radical.ensemblemd.kernel_plugins.kernel_base import KernelBase
  
  # ------------------------------------------------------------------------------
  # 
  _KERNEL_INFO = {
      "name":         "misc.diff",
      "description":  "Counts the differences between two ASCII files.",
      "arguments":   {"--inputfile1=":     
                          {
                          "mandatory": True,
                          "description": "The first input ASCII file."
                          },
                      "--inputfile2=":     
                          {
                          "mandatory": True,
                          "description": "The second input ASCII file."
                          },
                      "--outputfile=":     
                          {
                          "mandatory": True,
                          "description": "The output file containing the difference count."
                          },
                      },
      "machine_configs": 
      {
          "*": {
              "environment"   : None,
              "pre_exec"      : None,
              "executable"    : "diff",
              "uses_mpi"      : False
          }
      }
  }
  
  
  # ------------------------------------------------------------------------------
  # 
  class Kernel(KernelBase):
  
      # --------------------------------------------------------------------------
      #
      def __init__(self):
          """Le constructor.
          """
          super(Kernel, self).__init__(_KERNEL_INFO)
  
      # --------------------------------------------------------------------------
      #
      @staticmethod
      def get_name():
          return _KERNEL_INFO["name"]
  
      # --------------------------------------------------------------------------
      #
      def _bind_to_resource(self, resource_key):
          """(PRIVATE) Implements parent class method. 
          """
          if resource_key not in _KERNEL_INFO["machine_configs"]:
              if "*" in _KERNEL_INFO["machine_configs"]:
                  # Fall-back to generic resource key
                  resource_key = "*"
              else:
                  raise NoKernelConfigurationError(kernel_name=_KERNEL_INFO["name"], resource_key=resource_key)
  
          cfg = _KERNEL_INFO["machine_configs"][resource_key]
  
          executable = "/bin/bash" 
          arguments  = ['-l', '-c', 'diff -U 0 {input1} {input2} > {output}'.format(
              input1 = self.get_arg("--inputfile1="),
              input2 = self.get_arg("--inputfile2="),
              output = self.get_arg("--outputfile="))
          ]
  
          self._executable  = executable
          self._arguments   = arguments
          self._environment = cfg["environment"]
          self._uses_mpi    = cfg["uses_mpi"]
          self._pre_exec    = None 
          self._post_exec   = None
  
subject: Create diff.py