-
Notifications
You must be signed in to change notification settings - Fork 53
/
profile.py
57 lines (42 loc) · 1.66 KB
/
profile.py
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
"""
Starts up with a gevent based profiler. Probably superfluous and
the profiler doesn't work
"""
import bitHopper
import gevent
import argparse
import logging
def parse_config():
"""
Parses the low level bitHopper configuration
"""
parser = argparse.ArgumentParser(
description='Process bitHopper CommandLine Arguments')
parser.add_argument('--mine_port', metavar='mp', type=int,
default=8337, help='Mining Port Number')
parser.add_argument('--config_port', metavar='cp', type=int,
default=8339, help='Configuration Port Number')
parser.add_argument('--mine_localname', metavar='cp', type=str,
default='', help='Dns name to bind to')
parser.add_argument('--config_localname', metavar='cp', type=str,
default='', help='Dns name to bind to')
parser.add_argument('--debug', action="store_true", default=False)
args = parser.parse_args()
return args
def run():
"""Main driver function"""
args = parse_config()
#Setup debugging output
bitHopper.setup_logging(logging.DEBUG if args.debug else logging.INFO)
#Setup mining port
bitHopper.setup_miner(port = args.mine_port, host=args.mine_localname)
#Set up the control website
bitHopper.setup_control(port = args.config_port, host=args.config_localname)
#Setup Custom Pools
bitHopper.custom_pools()
while True:
gevent.sleep(100)
if __name__ == "__main__":
import gevent_profiler
gevent_profiler.attach()
run()