예제 #1
0
    def get(self):
        crawl_ids_arg = self.get_argument('crawl_ids', '')

        if crawl_ids_arg == '':
            jobs = self.crawler_process.get_jobs()
        else:
            crawl_ids = set(map(int, crawl_ids_arg.split(',')))
            jobs = [job for job in self.crawler_process.get_jobs()
                    if job['id'] in crawl_ids]

        self.write(json_encode({"jobs": jobs}))
예제 #2
0
 def write_event(self, event, data):
     """ Send a message to the client """
     message = json_encode({'event': event, 'data': data})
     self.write_message(message)
예제 #3
0
 def get(self):
     jobs = self.crawler_process.jobs
     initial_data_json = json_encode({"jobs": jobs})
     return self.render("index.html", initial_data_json=initial_data_json)
예제 #4
0
 def render(self, *args, **kwargs):
     proc_stats = self.crawler_process.procmon.get_recent()
     kwargs['initial_process_stats_json'] = json_encode(proc_stats)
     return super(BaseRequestHandler, self).render(*args, **kwargs)
예제 #5
0
 def write_event(self, event, data):
     """ Send a message to the client """
     message = json_encode({'event': event, 'data': data})
     self.write_message(message)