def path(self, src=None, dest=None, src_id=None, dest_id=None, skips=None, save='True', _=None): log_api_call('path') results = get_results() if src_id: a1 = aget(src_id) src = '' else: a1 = asearch(src) save = save.lower() == 'true' if not a1: return seal_results(results, 'ERROR', "can't find " + src) if dest_id: a2 = aget(dest_id) dest = '' else: a2 = asearch(dest) if not a2: return seal_results(results, 'ERROR', "can't find " + dest) skipset = None if skips: try: skipset = set([sid for sid in skips.split(',')]) results['skips'] = db.artist_get(list(skipset)) except ValueError: return seal_results(results, 'ERROR', "bad skiplist " + skips) else: results['skips'] = [] results['src'] = a1 results['dest'] = a2 path = db.artist_path(a1['id'], a2['id'], skipset=skipset, save=save) results['path'] = path gc.collect(0) self.paths += 1 if self.paths % 100 == 0: gc.collect() util.summary_memory_usage() util.gc_info() print return seal_results(results)
config = { 'global' : { 'server.socket_host' : '0.0.0.0', 'server.socket_port' : 9922, 'server.thread_pool' : 10, # 'environment' : 'production', }, '/' : { 'tools.CORS.on' : True, 'error_page.404': error_page_404, } } if len(sys.argv) > 1 and sys.argv[1] == '--quick': db.init(quick=True) else: #config['global']['environment'] = 'production' db.init(quick=False) #gc.set_debug(gc.DEBUG_STATS | gc.DEBUG_COLLECTABLE) gc.collect() gc.disable() gc.set_threshold(10000) util.summary_memory_usage() static_doc_config = webtools.get_export_map_for_directory("static") config.update(static_doc_config) cherrypy.quickstart(root, '/6dobs', config=config)