-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfeed_initializer.py
More file actions
54 lines (42 loc) · 1.3 KB
/
feed_initializer.py
File metadata and controls
54 lines (42 loc) · 1.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
"""
Module: feed_initializer
Description: Reads in fed def file and controls the feed construction process
Authored by: MapLarge, Inc. (Scott Rowles)
Change Log:
"""
"""
Define all the imports for the feed_initializer module
"""
import os.path
import feed_def_reader as fdr
import time
from feed_manager import update_feed
import argparse
def build_feeds(feed_def):
"""
Read in the configuration file with the feed_def_reader module and construct the feed with its appropriate class
"""
feeds = fdr.construct_feeds_from_defs(feed_def)
pid = None
for feed in feeds:
pid = os.fork()
print "Constructing feed {0}".format(feed)
if pid == 0:
time.sleep(10)
if feed:
feed.construct_feed()
update_feed(feed.provide_params())
time.sleep(60)
os._exit(0)
os.wait()
def main():
"""
Read the command argument and execute the build_feeds method with the argument
"""
parser = argparse.ArgumentParser(description='Create feeds.')
parser.add_argument('--defs', '-d', help='feed definition file', required=True)
args = parser.parse_args()
current_dir = os.path.dirname(os.path.realpath(__file__))
build_feeds(args.defs)
if __name__ == '__main__':
main()