"""
This is the file in which all constants relative to the Condor-IPP
framework are defined. It defines the following constants:

- IPPDOR_BINARY_PATH: the path to ippdor executables (they do not
  strictly have to be binaries)
- LOCAL_TMP_DIR: The local file system where some files can be
  stored. On the IPP production cluster, it is dependent on the host
  name.
- NFS_TMP_DIR: The NFS file system where some files are located.
- IPP_BIN_PATH: The path to the IPP executables. It is recommended to
  leave it to a fixed value (like current.lin64) and to relink 
  current.lin64 to any new install.
"""

from ipp.exceptions.UninstantiableIppException import UninstantiableIppException
from ipp.IppSite import IppSite

class Globals:
    """
    This class is not intended to be instantiated.
    All its members are static (and constant).
    """
    def __init__(self):
        """We don't want this class to be instantiated"""
        raise UninstantiableIppException()

    IPPDOR_BINARY_PATH = IppSite.TARGET_BINARY_DIRECTORY
    LOCAL_TMP_DIR = IppSite.LOCAL_TMP_DIR
    NFS_TMP_DIR = IppSite.NFS_TMP_DIR
    IPP_BIN_PATH = IppSite.IPP_BIN_PATH

    # Global requirements
    REQUIREMENTS     = 'LoadAvg < 0.3'

    # Condor scripts
    GENERATE_EXPOSURE_DAG = '%s/generate_exposure_dag.py %s %s %s' % (IPPDOR_BINARY_PATH, 
                                                                      '%s', '%s', '%s')

    ###################
    # IPP executables
    ###################
    # Chip stage
    CHIPTOOL = '%s/chiptool -dbname gpc1' % IPP_BIN_PATH
    CHIPIMFILE = '%s/chip_imfile.pl --dbname gpc1 --redirect-output --verbose --threads 1' % IPP_BIN_PATH

    # Cam stage
    CAMTOOL = '%s/camtool' % IPP_BIN_PATH
    CAMEXP = '%s/camera_exp.pl --dbname gpc1 --redirect-output --verbose' % IPP_BIN_PATH

    # Fake stage
    FAKETOOL = '%s/faketool -dbname gpc1' % IPP_BIN_PATH
    FAKE_IMFILE = '%s/fake_imfile.pl --dbname gpc1 --redirect-output --verbose' % IPP_BIN_PATH

    # Warp stage
    WARPTOOL = '%s/warptool -dbname gpc1' % IPP_BIN_PATH
    WARP_OVERLAP = '%s/warp_overlap.pl --dbname gpc1' % IPP_BIN_PATH
    WARP_SKYCELL = '%s/warp_skycell.pl --dbname gpc1 --threads 1 --redirect-output' % IPP_BIN_PATH
    WARP_JPEG = '%s/skycell_jpeg.pl -dbname gpc1 -stage warp' % IPP_BIN_PATH

    # Stack stage
    STACKTOOL = '%s/stacktool' % IPP_BIN_PATH
