45 lines
1.7 KiB
Python
Executable File
45 lines
1.7 KiB
Python
Executable File
#!/usr/bin/env python
|
|
|
|
import sys
|
|
from os.path import expanduser
|
|
# look for sehistory and frappy at usual locations in home directory
|
|
sys.path.extend([expanduser('~'), expanduser('~/frappy')])
|
|
import argparse
|
|
from webserver import server
|
|
from base import Client
|
|
from influxgraph import InfluxGraph
|
|
from secop import SecopInteractor
|
|
from sehistory.seinflux import SEHistory
|
|
|
|
|
|
def parseArgv(argv):
|
|
parser = argparse.ArgumentParser(
|
|
description="start a webserver for history and interaction",
|
|
)
|
|
# loggroup = parser.add_mutually_exclusive_group()
|
|
# loggroup.add_argument("-v", "--verbose",
|
|
# help="Output lots of diagnostic information",
|
|
# action='store_true', default=False)
|
|
# loggroup.add_argument("-q", "--quiet", help="suppress non-error messages",
|
|
# action='store_true', default=False)
|
|
parser.add_argument("port",
|
|
type=str,
|
|
help="port number to serve\n")
|
|
# parser.add_argument('-d',
|
|
# '--daemonize',
|
|
# action='store_true',
|
|
# help='Run as daemon',
|
|
# default=False)
|
|
parser.add_argument('-i',
|
|
'--instrument',
|
|
action='store',
|
|
help="instrument, if running on an instrument computer\n"
|
|
"if the value is HOST, take the host name as instrument name",
|
|
default=None)
|
|
return parser.parse_args(argv)
|
|
|
|
args = parseArgv(sys.argv[1:])
|
|
|
|
instrument = None if args.instrument=='main' else args.instrument
|
|
server.run(int(args.port), SEHistory(), InfluxGraph, Client, single_instrument=instrument, secop=SecopInteractor)
|