-
Notifications
You must be signed in to change notification settings - Fork 0
/
runworker.py
executable file
·62 lines (53 loc) · 1.17 KB
/
runworker.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
58
59
60
61
62
#!/usr/bin/env python
from __future__ import unicode_literals, absolute_import
import argparse
import sys
import os
import subprocess
parser = argparse.ArgumentParser(description="Run the pagure-taiga worker")
parser.add_argument(
"--config",
"-c",
dest="config",
help="Configuration file to use for pagure.",
)
parser.add_argument(
"--debug",
dest="debug",
action="store_true",
default=False,
help="Expand the level of data returned.",
)
parser.add_argument(
"--noinfo",
dest="noinfo",
action="store_true",
default=False,
help="Reduce the log level.",
)
args = parser.parse_args()
env = os.environ
if args.config:
config = args.config
if not config.startswith("/"):
here = os.path.join(os.path.dirname(os.path.abspath(__file__)))
config = os.path.join(here, config)
env["PAGURE_CONFIG"] = config
cmd = [
sys.executable,
"-m",
"celery",
"worker",
"-A",
"pagure_taiga.query",
"-Q",
"pagure_taiga",
]
if args.debug:
cmd.append("--loglevel=debug")
elif args.noinfo:
pass
else:
cmd.append("--loglevel=info")
subp = subprocess.Popen(cmd, env=env or None)
subp.wait()