Files
tryton/trytond/bin/trytond-worker
T

35 lines
898 B
Python
Raw Normal View History

2018-07-27 09:32:28 +02:00
#!/usr/bin/env python3
# PYTHON_ARGCOMPLETE_OK
2018-07-27 09:32:28 +02:00
# This file is part of Tryton. The COPYRIGHT file at the top level of
# this repository contains the full copyright notices and license terms.
import os
2021-12-11 17:58:45 +01:00
import sys
2018-07-27 09:32:28 +02:00
try:
import argcomplete
except ImportError:
argcomplete = None
2018-07-27 09:32:28 +02:00
DIR = os.path.abspath(os.path.normpath(os.path.join(__file__,
'..', '..', 'trytond')))
if os.path.isdir(DIR):
sys.path.insert(0, os.path.dirname(DIR))
import trytond.commandline as commandline
from trytond.config import config
parser = commandline.get_parser_worker()
if argcomplete:
argcomplete.autocomplete(parser)
2018-07-27 09:32:28 +02:00
options = parser.parse_args()
config.update_etc(options.configfile)
commandline.config_log(options)
2021-12-11 17:58:45 +01:00
import trytond.worker as worker
2018-07-27 09:32:28 +02:00
# Import after application is configured
from trytond.pool import Pool
2018-07-27 09:32:28 +02:00
with commandline.pidfile(options):
Pool.start()
2018-07-27 09:32:28 +02:00
worker.work(options)