Skip to content

Commit

Permalink
Merge pull request #4 from NCAR/hua-work-common
Browse files Browse the repository at this point in the history
add from . to import local modile
  • Loading branch information
zaihuaji authored Jan 22, 2025
2 parents 4abfc19 + 9e66994 commit 0cc01ca
Show file tree
Hide file tree
Showing 11 changed files with 64 additions and 52 deletions.
15 changes: 8 additions & 7 deletions src/rda_python_common/PgCMD.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,24 @@
# Title : PgCMD.py
# Author : Zaihua Ji, [email protected]
# Date : 08/25/2020
# 2025-01-10 transferred to package rda_python_common from
# https://github.com/NCAR/rda-shared-libraries.git
# Purpose : python library module for functions to record commands for delayed
# mode or command recovery
#
# Work File : $DSSHOME/lib/python/PgCMD.py
# Github : https://github.com/NCAR/rda-shared-libraries.git
# Github : https://github.com/NCAR/rda-python-common.git
#
###############################################################################
#
import os
import re
import sys
import time
import PgLOG
import PgSIG
import PgUtil
import PgLock
import PgDBI
from . import PgLOG
from . import PgSIG
from . import PgUtil
from . import PgLock
from . import PgDBI

# cached dscheck info
DSCHK = {}
Expand Down
7 changes: 4 additions & 3 deletions src/rda_python_common/PgDBI.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@
# Title : PgDBI.py -- PostgreSQL DataBase Interface
# Author : Zaihua Ji, [email protected]
# Date : 06/07/2022
# 2025-01-10 transferred to package rda_python_common from
# https://github.com/NCAR/rda-shared-libraries.git
# Purpose : Python library module to handle query and manipulate PostgreSQL database
#
# Work File : $DSSHOME/lib/python/PgDBI.py
# Github : https://github.com/NCAR/rda-shared-libraries.git
# Github : https://github.com/NCAR/rda-python-common.git
#
###############################################################################

Expand All @@ -19,7 +20,7 @@
from psycopg2.extras import execute_values
from psycopg2.extras import execute_batch
from os import path as op
import PgLOG
from . import PgLOG

pgdb = None # reference to a connected database object
curtran = 0 # 0 - no transaction, 1 - in transaction
Expand Down
13 changes: 7 additions & 6 deletions src/rda_python_common/PgFile.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@
# Title : PgFile.py
# Author : Zaihua Ji, [email protected]
# Date : 08/05/2020
# 2025-01-10 transferred to package rda_python_common from
# https://github.com/NCAR/rda-shared-libraries.git
# Purpose : python library module to copy, move and delete data files locally
# and remotely
#
# Work File : $DSSHOME/lib/python/PgFile.py
# Github : https://github.com/NCAR/rda-shared-libraries.git
# Github : https://github.com/NCAR/rda-python_common.git
#
###############################################################################
#
Expand All @@ -22,10 +23,10 @@
import time
import glob
import json
import PgLOG
import PgUtil
import PgSIG
import PgDBI
from . import PgLOG
from . import PgUtil
from . import PgSIG
from . import PgDBI

CMDBTH = (0x0033) # return both stdout and stderr, 16 + 32 + 2 + 1
RETBTH = (0x0030) # return both stdout and stderr, 16 + 32
Expand Down
16 changes: 9 additions & 7 deletions src/rda_python_common/PgGLBS.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,23 @@
# Title : PgGLBS.py
# Author : Thomas Cram, [email protected]
# Date : 12/10/2014
# Purpose : python library module for Globus functions and utilities
# Changes : 10/10/2020, Zaihua Ji, [email protected]:
# 10/10/2020, Zaihua Ji, [email protected]:
# converted from perl package to python module
# 2025-01-10, Zaihua Ji, [email protected]:
# transferred to package rda_python_common from
# https://github.com/NCAR/rda-shared-libraries.git
# Purpose : python library module for Globus functions and utilities
#
# Work File : $DSSHOME/lib/python/PgGLBS.py
# Github : https://github.com/NCAR/rda-shared-libraries.git
# Github : https://github.com/NCAR/rda-python-common.git
#
###############################################################################
#
import os
import re
import PgLOG
import PgUtil
from . import PgLOG
from . import PgUtil
from MyGlobus import MyGlobus, MyEndpoints, GLOBUS_REQUEST_DOMAIN
import PgDBI
from . import PgDBI

try:
from urllib.parse import urlencode
Expand Down
5 changes: 3 additions & 2 deletions src/rda_python_common/PgLOG.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@
# Title : PgLOG.py -- Module for logging messages.
# Author : Zaihua Ji, [email protected]
# Date : 03/02/2016
# 2025-01-10 transferred to package rda_python_common from
# https://github.com/NCAR/rda-shared-libraries.git
# Purpose : Python library module to log message and also do other things
# according to the value of logact, like display the error
# message on screen and exit script
#
# Work File : $DSSHOME/lib/python/PgLOG.py
# Github : https://github.com/NCAR/rda-shared-libraries.git
# Github : https://github.com/NCAR/rda-python-common.git
#
###############################################################################

Expand Down
15 changes: 8 additions & 7 deletions src/rda_python_common/PgLock.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,21 @@
# Title : PgLock.py
# Author : Zaihua Ji, [email protected]
# Date : 08/118/2020
# 2025-01-10 transferred to package rda_python_common from
# https://github.com/NCAR/rda-shared-libraries.git
# Purpose : python library module for functions to lock RDADB records
#
# Work File : $DSSHOME/lib/python/PgLock.py
# Github : https://github.com/NCAR/rda-shared-libraries.git
# Github : https://github.com/NCAR/rda-python-common.git
#
###############################################################################
#
import re
import time
import PgLOG
import PgSIG
import PgUtil
import PgFile
import PgDBI
from . import PgLOG
from . import PgSIG
from . import PgUtil
from . import PgFile
from . import PgDBI

DOLOCKS = {-2 : 'Force Unlock', -1 : 'Unlock', 0 : 'Unlock', 1 : 'Relock', 2 : 'Force Relock'}

Expand Down
13 changes: 7 additions & 6 deletions src/rda_python_common/PgOPT.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@
#
# Author : Zaihua Ji, [email protected]
# Date : 08/26/2020
# 2025-01-10 transferred to package rda_python_common from
# https://github.com/NCAR/rda-shared-libraries.git
# Purpose : python library module for holding global varaibles
# functions for processing options and other global functions
#
# Work File : $DSSHOME/lib/python/PgOPT.py
# Github : https://github.com/NCAR/rda-shared-libraries.git
# Github : https://github.com/NCAR/rda-pyhon-common.git
#
###############################################################################
#
Expand All @@ -18,10 +19,10 @@
import re
import time
from os import path as op
import PgLOG
import PgUtil
import PgFile
import PgDBI
from . import PgLOG
from . import PgUtil
from . import PgFile
from . import PgDBI

OUTPUT = None
CMDOPTS = {}
Expand Down
7 changes: 4 additions & 3 deletions src/rda_python_common/PgPGS.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,18 @@
# Title : PgPGS.py -- PostgreSQL Interface for CDP DataBase Per psql
# Author : Zaihua Ji, [email protected]
# Date : 08/31/2020
# 2025-01-10 transferred to package rda_python_common from
# https://github.com/NCAR/rda-shared-libraries.git
# Purpose : python library module to handle sql scripts to retrieve info
# from cdp database per psql
#
# Work File : $DSSHOME/lib/python/PgPGS.py
# Github : https://github.com/NCAR/rda-shared-libraries.git
# Github : https://github.com/NCAR/rda-python-common.git
#
###############################################################################
#
import PgLOG
import os
import re
from . import PgLOG

PGPGS = {}
PGPGS["PGSSERV"] = PgLOG.get_environment("PGSSERV", '-h vetsdbprod -p 5432 -U acadmin access_control');
Expand Down
9 changes: 5 additions & 4 deletions src/rda_python_common/PgSIG.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@
#
# Author : Zaihua Ji, [email protected]
# Date : 08/05/2020
# 2025-01-10 transferred to package rda_python_common from
# https://github.com/NCAR/rda-shared-libraries.git
# Purpose : python library module for start and control daemon process
#
# Work File : $DSSHOME/lib/python/PgSIG.py
# Github : https://github.com/NCAR/rda-shared-libraries.git
# Github : https://github.com/NCAR/rda-python-common.git
#
###############################################################################
#
Expand All @@ -19,8 +20,8 @@
import signal
import time
from contextlib import contextmanager
import PgLOG
import PgDBI
from . import PgLOG
from . import PgDBI

VUSERS = [] # allow users to start this daemon
CPIDS = {} # allow upto 'mproc' processes at one time for daemon
Expand Down
11 changes: 6 additions & 5 deletions src/rda_python_common/PgSplit.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,20 @@
# Title : PgSplit.py -- PostgreSQL DataBase Interface foe table wfile
# Author : Zaihua Ji, [email protected]
# Date : 09/010/2024
# 2025-01-10 transferred to package rda_python_common from
# https://github.com/NCAR/rda-shared-libraries.git
# Purpose : Python library module to handle query and manipulate table wfile
#
# Work File : $DSSHOME/lib/python/PgSplit.py
# Github : https://github.com/NCAR/rda-shared-libraries.git
# Github : https://github.com/NCAR/rda-python-common.git
#
###############################################################################

import os
import re
from os import path as op
import PgLOG
import PgDBI
import PgUtil
from . import PgLOG
from . import PgDBI
from . import PgUtil

#
# compare wfile records between tables wfile and wfile_dNNNNNN,
Expand Down
5 changes: 3 additions & 2 deletions src/rda_python_common/PgUtil.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@
# Title : PgUtil.py -- module for misc utilities.
# Author : Zaihua Ji, [email protected]
# Date : 07/27/2020
# 2025-01-10 transferred to package rda_python_common from
# https://github.com/NCAR/rda-shared-libraries.git
# Purpose : python library module for global misc utilities
#
# Work File : $DSSHOME/lib/python/PgUtil.py
# Github : https://github.com/NCAR/rda-shared-libraries.git
# Github : https://github.com/NCAR/rda-python-common.git
#
###############################################################################
#
Expand Down

0 comments on commit 0cc01ca

Please sign in to comment.