Пример #1
0
def mudpuppy_main():
	logging.config.fileConfig(os.path.join(os.path.dirname(os.path.abspath(__file__)),'logging.conf'))

	api = MagicLink()

	# Load in the modules that do the real work
	auto.load_modules()

	logging.info("Started. Waiting for things to do.")
	while not exit_gracefully:
		tasks = api.get_tasks()

		automated_something = False
		for uuid in tasks:
			automated = automate_task(uuid)		
			automated_something |= automated

		if not automated_something:
			# Didn't manage to change the state of anything
			# so wait at least a second before hammering
			# the server again
			time.sleep(1)
			continue

		logging.debug("Polling make-magic for serverbuilds for us to automate")
	logging.info("Exiting gracefully after SIGHUP")