gsksivesh / dagobah

Simple DAG-based job scheduler in Python
Do What The F*ck You Want To Public License
2 stars 1 forks source link

DagobahError: no independent nodes detected #44

Open gsksivesh opened 5 years ago

gsksivesh commented 5 years ago

Issue by zhenlongbai Thursday Apr 23, 2015 at 04:28 GMT Originally opened as https://github.com/thieman/dagobah/issues/150


Hi , I think I am a trouble.

When I add a job and make schedule ,but I did't add a task .There will be a issue .

I think the issue is associated with the code of /dagobah/core/dag.py.

all_nodes=dependent_nodes=0, then raise a exception . And the exception maybe refuse to EOF the thread . So that ,it will not start a thread .As a result , Dagobah maybe not update for next_run.

/dagobah/core/dag.py

def ind_nodes(self, graph):
    """ Returns a list of all nodes in the graph with no dependencies. """
    if graph is None:
        raise Exception("Graph given is None")
    all_nodes, dependent_nodes = set(graph.keys()), set()
    for downstream_nodes in graph.itervalues():
        [dependent_nodes.add(node) for node in downstream_nodes]
    return list(all_nodes - dependent_nodes)

def validate(self, graph=None):
    """ Returns (Boolean, message) of whether DAG is valid. """
    graph = graph if graph is not None else self.graph
    if   len(graph)!=0 and  len(self.ind_nodes(graph)) == 0:
        return (False, 'no independent nodes detected')
    try:
        self._topological_sort(graph)
    except ValueError:
        return (False, 'failed topological sort')
    return (True, 'valid')
gsksivesh commented 5 years ago

Comment by zhenlongbai Friday Apr 24, 2015 at 03:05 GMT


// I think it maybe better to deal the exception . so that when a job broken, the others can work well

//dagobah/core/components.py def run(self): """ Continually monitors Jobs of the parent Dagobah. """ while not self.stopped: now = datetime.now() for job in self.parent.jobs: if not job.next_run: continue if job.next_run >= self.last_check and job.next_run <= now: if job.state.allow_start: try: job.start() except Exception , e : traceback.print_exc() else: job.next_run = job.cron_iter.get_next(datetime) self.last_checked = now time.sleep(1)

gsksivesh commented 5 years ago

Comment by kakiezhang Monday Jun 15, 2015 at 02:16 GMT


yes, and there's another situation. if a job has been created(but the job task has not been set yet), the error will be showed in errorlog too when this job being activated by the scheduler at it's cron-time.