perf: 优化运行的命名

pull/7385/head
ibuler 2021-12-14 17:41:53 +08:00 committed by Jiangjie.Bai
parent fa5c433c7c
commit 0020343ae0
1 changed files with 9 additions and 8 deletions

17
jms
View File

@ -121,20 +121,21 @@ def start_services():
if action == 'start' and {'all', 'web'} & set(services):
prepare()
services_string = ' '.join(services)
cmd = f'{args.action} {services_string}'
start_args = []
if args.daemon:
cmd += ' --daemon'
start_args.append('--daemon')
if args.worker:
cmd += f' --worker {args.worker}'
start_args.extend(['--worker', str(args.worker)])
if args.force:
cmd += ' --force'
start_args.append('--force')
lines = cmd.split()
try:
management.call_command(*lines)
management.call_command(action, *services, *start_args)
except KeyboardInterrupt:
logging.info('Cancel ...')
time.sleep(2)
except Exception as e:
logging.error("Start service error {}: {}".format(lines[0], e))
logging.error("Start service error {}: {}".format(services, e))
time.sleep(2)