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}))
def write_event(self, event, data): """ Send a message to the client """ message = json_encode({'event': event, 'data': data}) self.write_message(message)
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)
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)