def get_next_to_finish(self, node=None): """Return the most recent run which is either running or scheduled. If node is not None, then only looks for runs on that node. """ return next_or_none( r for r in self.runs if (not node or r.node == node) and (r.is_running or r.is_scheduled) )
def get_first_queued(self, node=None): return next_or_none( r for r in reversed(self.runs) if (not node or r.node == node) and r.state == ActionRun.QUEUED)
def get_newest(self, include_manual=True): """Returns the most recently created JobRun.""" return next_or_none(r for r in self.runs if include_manual or not r.manual)
def get_run_by_num(self, num): """Return a the run with run number which matches num.""" return next_or_none(r for r in self.runs if r.run_num == num)
def get_run_by_state(self, state): """Returns the most recent run which matches the state.""" return next_or_none(r for r in self.runs if r.state == state)
def get_first_queued(self, node=None): return next_or_none( r for r in reversed(self.runs) if (not node or r.node == node) and r.state == ActionRun.QUEUED )
def get_newest(self, include_manual=True): """Returns the most recently created JobRun.""" return next_or_none( r for r in self.runs if include_manual or not r.manual )
def get_next_to_finish(self, node=None): """Return the most recent run which is either running or scheduled. If node is not None, then only looks for runs on that node. """ return next_or_none(r for r in self.runs if ( not node or r.node == node) and (r.is_running or r.is_scheduled))