Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import yaml
- import redis
- import subprocess
- import os
- import time
- import datetime
- fname = "file_seed_origin.yaml"
- fout="new_file_seed.yaml"
- dataMap = yaml.load(fname)
- with open(fout, "w") as f:
- yaml.dump(dataMap, f)
- with open(fname) as f:
- newdct = yaml.load(f)
- r=redis.StrictRedis(host='<IP_ADDRESS>',port=6379)
- p= r.pubsub()
- p.subscribe('<CHANNEL_NAME>')
- for m in p.listen():
- string_message=m['data']
- if isinstance(string_message, basestring):
- end_message=string_message.split(';')
- bbox = []
- bbox.append(float(end_message[3]))
- bbox.append(float(end_message[4]))
- bbox.append(float(end_message[5]))
- bbox.append(float(end_message[6]))
- if end_message[0]=="<ID_LAYER>:
- caches = []
- caches.append('<CACHE1>');
- caches.append('<CACHE2>');
- caches.append('<CACHE3>');
- newdct["seeds"]["myseed"]["caches"]=caches
- newdct["coverages"]["cover1"]["bbox"]=bbox
- newdct["seeds"]["myseed"]["refresh_before"]["time"]=datetime.datetime.today()
- with open(fout, "w") as f:
- yaml.dump(newdct, f)
- subprocess.call(["mapproxy-seed","-f","mapproxy_configuration.yaml","-c","4","new_file_seed.yaml"])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement