code: def ncores_allocated(self):
          
          return sum(task.manager.num_cores for task in self if task.status in [task.S_SUB, task.S_RUN])
docs: Returns the number of CPUs allocated in this moment.
          A core is allocated if it's running a task or if we have
          submitted a task to the queue manager but the job is still pending.