diff --git a/pyproject.toml b/pyproject.toml index 1041e4c..e6f9d1d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "rda_python_common" -version = "1.0.14" +version = "1.0.15" authors = [ { name="Zaihua Ji", email="zji@ucar.edu" }, ] diff --git a/src/rda_python_common/PgLOG.py b/src/rda_python_common/PgLOG.py index 72363a4..93cc8dd 100644 --- a/src/rda_python_common/PgLOG.py +++ b/src/rda_python_common/PgLOG.py @@ -109,6 +109,7 @@ 'DSIDCHRS' : "d", 'DOSHELL' : False, 'NEWDSID' : True, + 'PUSGDIR' : None, 'BCHHOSTS' : "PBS", 'HOSTTYPE' : 'dav', # default HOSTTYPE 'EMLMAX' : 256, # up limit of email line count @@ -479,6 +480,13 @@ def get_call_trace(cut = 1): return str + "\n" if str else "" +# +# get caller file name +# +def get_caller_file(cidx = 0): + + return traceback.extract_stack()[cidx][0] + # # log message, msg, for degugging processes according to the debug level # @@ -556,6 +564,7 @@ def set_help_path(progfile): # def show_usage(progname, opts = None): + if PGLOG['PUSGDIR'] is None: set_help_path(get_caller_file()) usgname = join_paths(PGLOG['PUSGDIR'], progname + '.usg') if opts: @@ -1284,7 +1293,6 @@ def set_common_pglog(): SETPGLOG("DRDATAEP", "rda-quasar-drdata") # DRDATA Globus Endpoint on Quasar SETPGLOG("DBGFILE", "pgdss.dbg") # debug file name SETPGLOG("CNFPATH", PGLOG['DSSHOME']+"/config") # path to configuration files - SETPGLOG("PUSGDIR", PGLOG['DSSDBHM']+"/prog_usage") # path to program usage files SETPGLOG("DSSURL", "https://rda.ucar.edu") # current dss web URL SETPGLOG("RQSTURL", "/datasets/request") # request URL path SETPGLOG("WEBSERVERS", "rda-web-prod01.ucar.edu:rda-web-test01.ucar.edu") # webserver names for Web server