<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def run_jobs(self, stream=sys.stdout, resubmit_failed=False):
 """Function to dipatch jobs and collect results Parameters stream : `file` Stream that this function will print to, Must have 'write' function. resubmit_failed : bool Resubmit failed jobs. Returns ------- status_vect : `JobStatusVector` Vector that summarize the number of jobs in various states. """

        self._build_job_dict()

        self._interface._dry_run = self.args['dry_run']
        scatter_status = self._interface.submit_jobs(self.scatter_link,
                                                     job_archive=self._job_archive,
                                                     stream=stream)
        if scatter_status == JobStatus.failed:
            return JobStatus.failed

        status_vect = self.check_status(stream, write_status=True)
        status = status_vect.get_status()

        if status == JobStatus.partial_failed:
            if resubmit_failed:
                sys.write("Resubmitting partially failed link %s\n" %
                          self.full_linkname)
                status_vect = self.resubmit(stream=stream, fail_running=False, resubmit_failed=True)
            else:
                sys.stdout.write("NOT resubmitting partially failed link %s\n" %
                                 self.full_linkname)
        return status_vect