-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.star
executable file
·85 lines (73 loc) · 2.59 KB
/
main.star
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
DEFAULT_CONFIG_FILE = "github.com/logos-co/wadoku/waku/config.json"
DEFAULT_RUN_PAIR = "lf"
def get_config_file(args):
return DEFAULT_CONFIG_FILE if not hasattr(args, "config") else args.config
def get_run_pair(args):
return DEFAULT_RUN_PAIR if not hasattr(args, "run_pair") else args.run_pair
def run(args):
print(args)
config_file = get_config_file(args)
run_pair = get_run_pair(args)
print("Reading the config from: %s" %config_file)
print("The runpair is %s" %run_pair)
config_json = read_file(src=config_file)
config = json.decode(config_json)
#input_file = config['input_file']
output_file = config['output_file']
duration = config['duration']
iat = config['iat']
loglvl = config['log_level']
ctopic = config['content_topic']
print(config)
if run_pair == "lf": # run lightpush and filter
waku_filtr = add_service(
service_id = "waku-filter",
config = struct(
image = "waku-filter:alpha",
entrypoint= ["/go/bin/waku-filter"],
cmd = [ "-o=" + "/go/bin/out/filter.out",
"-d=" + duration,
"-c=" + ctopic,
"-l=" + loglvl,
"-i=" + iat ],
),
)
waku_lpush = add_service(
service_id = "waku-lightpush",
config = struct(
image = "waku-lightpush:alpha",
entrypoint= ["/go/bin/waku-lightpush"],
cmd = [ "-o=" + "/go/bin/out/lightpush.out",
"-d=" + duration,
"-c=" + ctopic,
"-l=" + loglvl,
"-i=" + iat ],
),
)
print(waku_filtr, waku_lpush)
else: # run waku publish and subscribe
waku_sub = add_service(
service_id = "waku-subscribe",
config = struct(
image = "waku-subscribe:alpha",
entrypoint= ["/go/bin/waku-subscribe"],
cmd = [ "-o=" + "/go/bin/out/subscribe.out",
"-d=" + duration,
"-c=" + ctopic,
"-l=" + loglvl,
"-i=" + iat ],
),
)
waku_pub = add_service(
service_id = "waku-publish",
config = struct(
image = "waku-publish:alpha",
entrypoint= ["/go/bin/waku-publish"],
cmd = [ "-o=" + "/go/bin/out/publish.out",
"-d=" + duration,
"-c=" + ctopic,
"-l=" + loglvl,
"-i=" + iat ],
),
)
print(waku_sub, waku_pub)