-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from NCAR/hua-work-common
add from . to import local modile
- Loading branch information
Showing
11 changed files
with
64 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 = {} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 | ||
# | ||
############################################################################### | ||
|
||
|
@@ -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 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 | ||
# | ||
############################################################################### | ||
# | ||
|
@@ -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 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 | ||
# | ||
############################################################################### | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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'} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 | ||
# | ||
############################################################################### | ||
# | ||
|
@@ -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 = {} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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'); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 | ||
# | ||
############################################################################### | ||
# | ||
|
@@ -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 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 | ||
# | ||
############################################################################### | ||
# | ||
|