Skip to content

Commit

Permalink
Merge pull request #130 from BruceDone/master
Browse files Browse the repository at this point in the history
daemonstatus.json miscounts running & finished jobs
  • Loading branch information
Digenis committed Mar 21, 2016
2 parents 35d16c7 + 32140fd commit 1395e32
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions scrapyd/webservice.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,9 @@ def render(self, txrequest):
class DaemonStatus(WsResource):

def render_GET(self, txrequest):
running = 0
pending = 0
finished = 0
projects = self.root.scheduler.list_projects()
for project in projects:
spiders = self.root.launcher.processes.values()
running += len(spiders)
queue = self.root.poller.queues[project]
pending += queue.count()
finished += len(self.root.launcher.finished)
pending = sum(q.count() for q in self.root.poller.queues.values())
running = len(self.root.launcher.processes)
finished = len(self.root.launcher.finished)

return {"node_name": self.root.nodename, "status":"ok", "pending": pending, "running": running, "finished": finished}

Expand Down

0 comments on commit 1395e32

Please sign in to comment.