def run(pipe): # parse the config config = parseConfig() # load all the feeds feeds = [] for i in config['feeds'].split(','): feeds.append(load(config['feeddir'] + '/' + i + '.py')) # generate the inital queue for i in feeds: insertQueue(i) # main loop while True: sleepUntilNext() # check if we got interrupted for some reason if time() < queue[0][0]: continue feed = queue.pop(0)[1] # run the feed and send it to the updater for i in feed.run(): pipe.send(i) # reinsert it into the queue insertQueue(feed)
buildpkg(data) db[data[0]] = ','.join([data[1], data[2]]) # parse the configuration file for options config = confParse('updater.conf')[''] # do additional processing of the config config = processConfig(config) # create a pipe for other processes to use recvp, sendp = Pipe() # load the hoppers modules = [] for i in config['hoppers']: modules.append(load(config['hopperdir'] + '/' + i + '.py')) # load the storage modules storages = [] for i in config['storages']: print('Loading storage module: ' + i) storages.append(load(config['storagedir'] + '/' + i + '.py')) # run the hoppers hopperp = [] for i in modules: print("Starting " + i.__str__()) p = Process(target = i.run, args = (sendp,)) p.start() hopperp.append(p)