code: def _terminate_resource_request(self):
          
  
          try:
  
              if self._pilot:
  
                  self._prof.prof('canceling resource allocation', uid=self._uid)
                  self._pilot.cancel()
                  download_rp_profile = os.environ.get('RADICAL_PILOT_PROFILE', False)
                  self._session.close(cleanup=self._rts_config.get('db_cleanup', False),
                                      download=download_rp_profile)
                  self._prof.prof('resource allocation canceled', uid=self._uid)
  
          except KeyboardInterrupt:
  
              self._logger.exception('Execution interrupted by user (you probably hit Ctrl+C), ' +
                                 'trying to exit callback thread gracefully...')
              raise KeyboardInterrupt
  
          except Exception, ex:
              self._logger.exception('Could not cancel resource request, error: %s' % ex)
              raise
docs: **Purpose**: Cancel the RADICAL Pilot Job