def command(self): self._load_config() # We'll need a sysadmin user to perform most of the actions # We will use the sysadmin site user (named as the site_id) context = { "model": model, "session": model.Session, "ignore_auth": True, } self.admin_user = get_action("get_site_user")(context, {}) print("") if len(self.args) == 0: self.parser.print_usage() sys.exit(1) cmd = self.args[0] if cmd == "source": if len(self.args) > 2: self.create_harvest_source() else: self.show_harvest_source() elif cmd == "rmsource": self.remove_harvest_source() elif cmd == "clearsource": self.clear_harvest_source() elif cmd == "clearsource_history": self.clear_harvest_source_history() elif cmd == "sources": self.list_harvest_sources() elif cmd == "job": self.create_harvest_job() elif cmd == "jobs": self.list_harvest_jobs() elif cmd == "job_abort": self.job_abort() elif cmd == "run": self.run_harvester() elif cmd == "run_test": self.run_test_harvest() elif cmd == "gather_consumer": utils.gather_consumer() elif cmd == "fetch_consumer": utils.fetch_consumer() elif cmd == "purge_queues": self.purge_queues() elif cmd == "initdb": self.initdb() elif cmd == "import": self.initdb() self.import_stage() elif cmd == "job-all": self.create_harvest_job_all() elif cmd == "harvesters-info": print(utils.harvesters_info()) elif cmd == "reindex": self.reindex() elif cmd == "clean_harvest_log": self.clean_harvest_log() else: print("Command {0} not recognized".format(cmd))
def fetch_consumer(): """Starts the consumer for the fetching queue. """ utils.fetch_consumer()