code: def run_job(self,
                  job,             # type: Union[JobBase, WorkflowJob, None]
                  runtime_context  # type: RuntimeContext
                 ):  # type: (...) -> None
          
  
          if job is not None:
              with self.pending_jobs_lock:
                  self.pending_jobs.append(job)
  
          with self.pending_jobs_lock:
              n = 0
              while (n+1) <= len(self.pending_jobs):
                  job = self.pending_jobs[n]
                  if isinstance(job, JobBase):
                      if ((job.builder.resources["ram"])
                          > self.max_ram
                          or (job.builder.resources["cores"])
                          > self.max_cores):
                          _logger.error(
                              'Job "%s" cannot be run, requests more resources (%s) '
                              'than available on this host (max ram %d, max cores %d',
                              job.name, job.builder.resources,
                              self.allocated_ram,
                              self.allocated_cores,
                              self.max_ram,
                              self.max_cores)
                          self.pending_jobs.remove(job)
                          return
  
                      if ((self.allocated_ram + job.builder.resources["ram"])
                          > self.max_ram
                          or (self.allocated_cores + job.builder.resources["cores"])
                          > self.max_cores):
                          _logger.debug(
                              'Job "%s" cannot run yet, resources (%s) are not '
                              'available (already allocated ram is %d, allocated cores is %d, '
                              'max ram %d, max cores %d',
                              job.name, job.builder.resources,
                              self.allocated_ram,
                              self.allocated_cores,
                              self.max_ram,
                              self.max_cores)
                          n += 1
                          continue
  
                  thread = threading.Thread(target=self._runner, args=(job, runtime_context))
                  thread.daemon = True
                  self.threads.add(thread)
                  if isinstance(job, JobBase):
                      self.allocated_ram += job.builder.resources["ram"]
                      self.allocated_cores += job.builder.resources["cores"]
                  thread.start()
                  self.pending_jobs.remove(job)
docs: Execute a single Job in a seperate thread.