IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 32897


Ignore:
Timestamp:
Dec 8, 2011, 11:31:08 AM (15 years ago)
Author:
Serge CHASTEL
Message:

Localization

Location:
trunk/ippdor
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/ippdor/deployment/Deployment.py

    r32874 r32897  
    9696        """
    9797        Check different elements
     98        TODO: add checks for IppSite definition
    9899        """
    99100        Deployment.logger.info('Checking Condor-IPP Softwares Configuration')
     
    153154        """
    154155        Deployment.logger.info('Deploying Condor-IPP Softwares')
     156        Deployment.logger.info('... Installing Site definition class to [%s]'
     157                               % self.target_directory)
     158        shutil.copyfile('.tmp_site/IppSite.py',
     159                        '%s/IppSite.py' % (self.target_directory))
    155160        Deployment.logger.info('... Installing Python classes to [%s]' % self.target_directory)
    156161        for filename in Deployment.CLASSES_FILENAMES:
  • trunk/ippdor/deployment/deploy.py

    r32883 r32897  
    44Utility executable for IPP Condor deployment
    55"""
    6 def hostname():
    7     """
    8     Get the host name
    9     >>> print hostname()
    10     neverland
    11     """
    12     import socket
    13     return socket.gethostbyaddr(socket.gethostname())[0].split('.')[0]
    14 
    15 # Default values
    16 class DefaultValues:
    17     """
    18     This class contains all default values for the IPP Condor deployment
    19     """
    20     if hostname().startswith('ipp'): # Production cluster
    21         svnSourceUrl          = 'https://svn.pan-starrs.ifa.hawaii.edu/repo/ipp/trunk/ippdor/src'
    22         targetDirectory       = '/home/panstarrs/ippdor/local/share/python/ipp'
    23         targetBinaryDirectory = '/home/panstarrs/ippdor/local/bin'
    24     else:
    25         svnSourceUrl          = 'file:///home/schastel/svnrepo/ippdor/trunk/src'
    26         targetDirectory       = '/home/schastel/local/share/python/ipp'
    27         targetBinaryDirectory = '/home/schastel/local/bin'
    28 
    29     def __init__(self):
    30         """Not to be used as a class
    31         """
    32         raise Exception('Not to be used as a class')
    33 
    346import sys
     7import os
    358import logging
    369#optparse Deprecated in python 2.7. Will be replaced by argparse
     
    3912
    4013if __name__ == '__main__':
    41     USAGE = """usage: %prog [options] arg1 arg2
     14    USAGE = """usage: %prog [options] <ipp site definition file>
    4215
    4316Deploy the Condor-IPP softwares
     
    5326                      help = 'Be quiet',
    5427                      default = False)
    55     PARSER.add_option( '-s', '--svnSourceUrl',
    56                        dest = "svnSourceUrl",
    57                        help = 'SVN Source URL [default: %default]',
    58                        default = DefaultValues.svnSourceUrl )
    59     PARSER.add_option( '-t', '--targetDirectory',
    60                        dest = "targetDirectory",
    61                        help = 'Target Python Directory for classes [default: %default]',
    62                        default = DefaultValues.targetDirectory )
    63     PARSER.add_option( '-b', '--targetBinaryDirectory',
    64                        dest = "targetBinaryDirectory",
    65                        help = 'Target Executables Directory [default: %default]',
    66                        default = DefaultValues.targetBinaryDirectory )
    6728    (OPTIONS, ARGS) = PARSER.parse_args()    # ... the values are stored in options
    68 
     29    if len(ARGS) != 1:
     30        PARSER.print_help()
     31        sys.exit(1)
     32    IPP_SITE_FILE = ARGS[0]
     33    # Logging setup
    6934    LOGGER = logging.getLogger('ippdor')
    7035    FORMATTER = logging.Formatter('%(asctime)s | %(levelname)7s | %(message)s',
     
    8146    else:
    8247        LOGGER.setLevel(logging.INFO)
     48    # Import IppSite definition
     49    LOGGER.info('Importing local site definitions')
     50    try:
     51        os.makedirs('.tmp_site')
     52    except OSError:
     53        LOGGER.warn('Existing .tmp_site directory')
     54    import shutil
     55    shutil.copy(IPP_SITE_FILE, '.tmp_site/IppSite.py')
     56    INITFILE = open('.tmp_site/__init__.py', 'w')
     57    INITFILE.close()
     58    sys.path.append('.tmp_site')
     59    from IppSite import IppSite
    8360
     61    # Deployment
    8462    try:
    85         DEPLOYMENT = Deployment(OPTIONS.svnSourceUrl,
    86                                 OPTIONS.targetDirectory,
    87                                 OPTIONS.targetBinaryDirectory)
     63        DEPLOYMENT = Deployment(IppSite.SVN_SOURCE_URL,
     64                                IppSite.TARGET_DIRECTORY,
     65                                IppSite.TARGET_BINARY_DIRECTORY)
    8866        DEPLOYMENT.check()
    8967        DEPLOYMENT.svn_export()
     
    9775        import traceback
    9876        traceback.print_exc()
     77    # Clean temporary site
     78    LOGGER.info('Cleaning temporary site definitions')
     79    os.remove('.tmp_site/IppSite.py')
     80    os.remove('.tmp_site/IppSite.pyc')
     81    os.remove('.tmp_site/__init__.py')
     82    os.rmdir('.tmp_site')
  • trunk/ippdor/quality_metrics.sh

    r32883 r32897  
    1010/bin/rm -rf ./test
    1111mkdir -p ./test/ipp ./test/bin
    12 ./deployment/deploy.py -t ./test/ipp -b ./test/bin
     12./deployment/deploy.py IppSiteTest.py
    1313
    1414echo "\"\"\"Stupido\n\"\"\"" > ./test/__init__.py
  • trunk/ippdor/src/executables/ippdor_chip_to_warp.py

    r32894 r32897  
    4444    def __init__(self,
    4545                 label,
    46                  recipient,
    47                  host='ippdb01.ifa.hawaii.edu',
    48                  user='ipp',
    49                  passwd='ipp'):
     46                 recipient):
    5047        """
    5148        The constructor:
     
    5451        - creates a local directory
    5552        """
    56         Gpc1Manager.__init__(self, recipient=recipient, host=host, user=user, passwd=passwd)
     53        Gpc1Manager.__init__(self, recipient=recipient)
    5754        self.label = label
    5855        if self.is_label_used():
     
    231228        print 'Aborting'
    232229        sys.exit(4)
    233     if os.getenv('USER') == 'ippdor':
    234         BUILDER = ChipWarpBuilder(LABEL, RECIPIENT)
    235     else:
    236         BUILDER = ChipWarpBuilder(LABEL, RECIPIENT, host='ipp0012.ifa.hawaii.edu')
     230    BUILDER = ChipWarpBuilder(LABEL, RECIPIENT)
    237231    # Check exposures       
    238232    EXPOSURES_IDS = dict()
  • trunk/ippdor/src/ipp/Gpc1Manager.py

    r32890 r32897  
    55import sys
    66import MySQLdb
     7from ipp.IppSite import Gpc1
    78
    89#################################################################
     
    1213    """
    1314    def __init__(self,
    14                  recipient = 'schastel@ifa.hawaii.edu',
    15                  host = 'ippdb01.ifa.hawaii.edu',
    16                  user = 'ipp',
    17                  passwd = 'ipp'):
     15                 recipient = 'schastel@ifa.hawaii.edu'):
    1816        """Create a connector to the gpc1 database
    1917        """
    2018        self.recipient = recipient
    21         self.connector = MySQLdb.connect(host, user, passwd, db = 'gpc1')
     19        self.connector = MySQLdb.connect(Gpc1.HOST,
     20                                         Gpc1.USER,
     21                                         Gpc1.PASSWORD,
     22                                         db = Gpc1.NAME)
    2223        self.label = None # Set by derived classes
    2324
  • trunk/ippdor/src/ipp/constants/Globals.py

    r32892 r32897  
    1717from ipp.helpers import hostname
    1818from ipp.exceptions.UninstantiableIppException import UninstantiableIppException
     19from ipp.IppSite import IppSite
    1920
    2021class Globals:
     
    2728        raise UninstantiableIppException()
    2829
    29     if hostname().startswith('ipp'): # Production cluster
    30         IPPDOR_BINARY_PATH = '/home/panstarrs/ippdor/local/bin'
    31         LOCAL_TMP_DIR    = '/export/%s.0/ippdor/processing' % hostname()
    32         NFS_TMP_DIR    = '/home/panstarrs/ippdor/processing'
    33         IPP_BIN_PATH = '/home/panstarrs/ippdor/psconfig/20110920/current.lin64/bin'
    34     else: # Development
    35         IPPDOR_BINARY_PATH = '~/local/bin'
    36         LOCAL_TMP_DIR    = '/tmp/ippdor_processing'
    37         NFS_TMP_DIR    = '~/ippdor_processing'
    38         IPP_BIN_PATH = '~/ipp/default.linux'
     30    IPPDOR_BINARY_PATH = IppSite.TARGET_BINARY_DIRECTORY
     31    LOCAL_TMP_DIR = IppSite.LOCAL_TMP_DIR
     32    NFS_TMP_DIR = IppSite.NFS_TMP_DIR
     33    IPP_BIN_PATH = IppSite.IPP_BIN_PATH
    3934
    4035    # Global requirements
     
    4237
    4338    # Condor scripts
    44     GENERATE_EXPOSURE_DAG = '%s/generate_exposure_dag.py %s %s %s' % (IPPDOR_BINARY_PATH, '%s', '%s', '%s')
     39    GENERATE_EXPOSURE_DAG = '%s/generate_exposure_dag.py %s %s %s' % (IPPDOR_BINARY_PATH,
     40                                                                      '%s', '%s', '%s')
    4541
    4642    ###################
     
    6763    # Stack stage
    6864    STACKTOOL = '%s/stacktool' % IPP_BIN_PATH
    69 
Note: See TracChangeset for help on using the changeset viewer.