예제 #1
0
def exe(name, params):
	cfg = myconfig.read()
	cfgvalues = cfg.dispatcher()

	if cfgvalues.has_key(name):
		try:
			func = myloader.myimport(cfgvalues[name])
			func(params)
		except Exception, err:
			print "Error: %s" % err
예제 #2
0
def exe(name, params):
    cfg = myconfig.read()
    cfgvalues = cfg.dispatcher()

    if cfgvalues.has_key(name):
        try:
            func = myloader.myimport(cfgvalues[name])
            func(params)
        except Exception, err:
            print "Error: %s" % err
예제 #3
0
			content.rstrip()

			for line in content.split("\r\n"):
				if line:
					packet = json.loads(line)
					data.append( {"key": packet["key"], "value": json.loads(packet["value"])} )

		except Exception, err:
			log.err("Cannot decode JSON: %s" % str(err))
			log.err("MQ Return: %s" % content)
		else:
			for job in data:
				log.msg("*** Processing job \"%s\" ***" % job["key"])

				for task in job["value"].keys():
					log.msg("=> Dispatching task \"%s\"" % task)
					dispatcher.exe(task, job["value"][task])

	def close(self):
		pass


if __name__ == "__main__":
	cfg = myconfig.read()
	cfgvalues = cfg.restmq()

	log.startLogging(sys.stdout)

	client.downloadPage("http://%s:%s/c/%s" % (cfgvalues["host"], str(cfgvalues["port"]), cfgvalues["queuename"]), CometClient())
	reactor.run()