-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
39 lines (33 loc) · 1.08 KB
/
main.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
#coding=utf-8
import os
import sys
import logging
import datetime
from os.path import join
#------------set up environment-------------------------------------
CUR_DIR, CUR_SCRIPT = os.path.split(os.path.abspath(sys.argv[0]))
#HOME_LOCAL = os.path.split(CUR_DIR)[0]
HOME_LOCAL = CUR_DIR
HOME_SRC = join(HOME_LOCAL, "src")
HOME_LIB = join(HOME_LOCAL, "lib")
HOME_DATA = join(HOME_LOCAL, "data")
HOME_CONF = join(HOME_LOCAL, "conf")
TODAY = datetime.date.today()
LOG_FILE = "{}/log/{}-{}.log".format(HOME_LOCAL, CUR_SCRIPT, TODAY)
logging.basicConfig(
filename = LOG_FILE, level = logging.INFO,
format = "%(asctime)s [%(levelname)s]: %(message)s")
sys.path.append(HOME_SRC)
from util import *
import argparse
import ConfigParser
config = ConfigParser.ConfigParser()
config.read(join(HOME_CONF, "conf.ini"))
config = ConfigUtil(config)
parser = argparse.ArgumentParser()
parser.add_argument("--job", dest="job", default="run", help="name of the function be evaluated.")
params = parser.parse_args()
def run():
print("hello word!")
if __name__ == "__main__":
eval(params.job)()