forked from junyanz/pytorch-CycleGAN-and-pix2pix
-
Notifications
You must be signed in to change notification settings - Fork 3
/
index.py
38 lines (30 loc) · 989 Bytes
/
index.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
import logging, thread_worker, sys
from logging import handlers
import os
def main():
# set args
amqp_url = os.environ["AMQP_TRAINING"]
queue = 'dev_trainingQueue'
log_path = 'output.log'
thread_num = 1
# set logging
log = logging.getLogger('')
log.setLevel(logging.DEBUG)
format = logging.Formatter(
"%(asctime)s - %(name)s - %(levelname)s - %(message)s")
ch = logging.StreamHandler(sys.stdout)
ch.setFormatter(format)
log.addHandler(ch)
fh = handlers.RotatingFileHandler(
log_path, maxBytes=(1048576 * 5), backupCount=7)
fh.setFormatter(format)
log.addHandler(fh)
logging.basicConfig(
filename=log_path, datefmt='%m/%d/%Y %I:%M:%S %p', level=logging.DEBUG)
# threading
for i in range(0, thread_num):
tw = thread_worker.ThreadWorker(amqp_url, queue,
"Thread Number : " + str(i))
tw.start()
if __name__ == '__main__':
main()