Add CLI
This commit is contained in:
parent
72e8355031
commit
1bcdef0728
@ -19,10 +19,23 @@ from protocols.protocol import TestError
|
||||
import database
|
||||
from multiprocessing import Process
|
||||
import json
|
||||
import argparse
|
||||
|
||||
host = os.uname()[1]
|
||||
log = logging.getLogger('Supervisor [{}]'.format(host))
|
||||
|
||||
parser = argparse.ArgumentParser(description='Run minigrida supervisor')
|
||||
parser.add_argument('--conf',
|
||||
metavar='config',
|
||||
default='config.json',
|
||||
type=str,
|
||||
help='the path to the supervisor\'s config file.')
|
||||
parser.add_argument('--cred',
|
||||
metavar='credentials',
|
||||
default='credentials.json',
|
||||
type=str,
|
||||
help='the path to the DB credentials file.')
|
||||
args = parser.parse_args()
|
||||
|
||||
def run(expe, hostpid=host):
|
||||
database.update_experiment(expe,
|
||||
@ -70,7 +83,7 @@ def main(pid=None):
|
||||
log.name = 'Supervisor [{}]'.format(hostpid)
|
||||
|
||||
log.info('Connecting to database')
|
||||
database.connect('credentials.json')
|
||||
database.connect(args.cred)
|
||||
|
||||
while(True):
|
||||
if not database.pending_experiments():
|
||||
@ -94,7 +107,7 @@ if __name__ == '__main__':
|
||||
logger.setup_logging()
|
||||
log.info('Starting supervisor')
|
||||
try:
|
||||
with open('config.json') as f:
|
||||
with open(args.conf) as f:
|
||||
config = json.load(f)
|
||||
process_count = config['process_count']
|
||||
except Exception as e:
|
||||
|
@ -2,3 +2,4 @@ sklearn
|
||||
sap>=0.2.2
|
||||
pony
|
||||
psycopg2
|
||||
pyyml
|
||||
|
Loading…
Reference in New Issue
Block a user