code: def _run_link(self, stream=sys.stdout, dry_run=False,
                    stage_files=True, resubmit_failed=False):
          
          check_ok = self._pre_run_checks(stream, dry_run)
          if not check_ok:
              return
  
          if self._file_stage is not None:
              input_file_mapping, output_file_mapping = self._map_scratch_files(
                  self.files)
              if stage_files:
                  self._file_stage.make_scratch_dirs(input_file_mapping, dry_run)
                  self._file_stage.make_scratch_dirs(
                      output_file_mapping, dry_run)
                  self._stage_input_files(input_file_mapping, dry_run)
  
          return_code = self.run_command(stream, dry_run)
          print ("return code ", return_code)
          if return_code == 0:
              status = JobStatus.done
              if self._file_stage is not None and stage_files:
                  self._stage_output_files(output_file_mapping, dry_run)
              self._finalize(dry_run)
          else:
              if resubmit_failed:
                  print ("Not resubmitting failed link %s"%(self.linkname))
              status = JobStatus.failed
          if dry_run:
              return
          self._write_status_to_log(return_code, stream)
          self._set_status_self(status=status)
docs: Internal function that actually runs this link.
  
          This checks if input and output files are present.
  
          If input files are missing this will raise `OSError` if dry_run is False
          If all output files are present this will skip execution.
  
          Parameters
          -----------
          stream : `file`
              Stream that this `Link` will print to,
              must have 'write' function.
  
          dry_run : bool
              Print command but do not run it.
  
          stage_files : bool
              Stage files to and from the scratch area.
  
          resubmit_failed : bool
              Resubmit failed jobs.