Beispiel #1
0
from sqlalchemy.orm import sessionmaker
from lsst.db.engineFactory import getEngineFromFile
from lsst.db.exception import produceExceptionClass
from .schema_utils import parse_schema
from .model import MSUser, MSRepo, MSDatabase, MSDatabaseSchema, \
    MSDatabaseTable, MSDatabaseColumn

MetaBException = produceExceptionClass(
    'MetaBException',
    [(3005, "BAD_CMD", "Bad command, see HELP for details."),
     (3010, "DB_DOES_NOT_EXIST", "Database does not exist."),
     (3015, "NOT_MATCHING", "Schema from db and ascii file do not match."),
     (3020, "TB_NOT_IN_DB", "Table not found in the database."),
     (3025, "COL_NOT_IN_TB", "Column not found in the table."),
     (3030, "COL_NOT_IN_FL", "Column not found in the ascii file."),
     (3035, "OWNER_NOT_FOUND", "Owner not found."),
     (3040, "PROJECT_EXISTS", "Project already exists."),
     (3045, "PROJECT_NOT_FOUND", "Project not found."),
     (3050, "INST_EXISTS", "Institution already exists.."),
     (3055, "INST_NOT_FOUND", "Institution not found."),
     (9998, "NOT_IMPLEMENTED", "Feature not implemented yet."),
     (9999, "INTERNAL", "Internal error.")])


class CliConfig(object):
    def __init__(self, config_path):
        self.engine = getEngineFromFile(config_path)


pass_config = click.make_pass_decorator(CliConfig)
Beispiel #2
0
import logging

# -----------------------------
# Imports for other modules --
# -----------------------------
from lsst.db.exception import produceExceptionClass
from lsst.qserv.wmgr.client import WmgrClient

# ----------------------------------
# Local non-exported definitions --
# ----------------------------------

_LOG = logging.getLogger(__name__)

_Exception = produceExceptionClass('WorkerAdminException', [
    (100, "ARG_ERR", "Missing or inconsistent arguments"),
    (110, "CSS_HOST_NAME_MISS", "Missing host name is in CSS"),
])

# ------------------------
# Exported definitions --
# ------------------------


class NodeAdmin(object):
    """
    Class representing administration/communication endpoint for qserv worker.
    """

    def __init__(self, name=None, css=None, host=None, port=None, wmgrSecretFile=None):
        """
        Make new endpoint for remote worker. Worker can be specified
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the LSST License Statement and
# the GNU General Public License along with this program.  If not,
# see <http://www.lsstcorp.org/LegalNotices/>.

"""
Exception for MetaServ Backend.

@author  Jacek Becla, SLAC

"""

from lsst.db.exception import produceExceptionClass

MetaBException = produceExceptionClass('MetaBException', [
    (3005, "BAD_CMD",           "Bad command, see HELP for details."),
    (3010, "DB_DOES_NOT_EXIST", "Database does not exist."),
    (3015, "NOT_MATCHING",      "Schema from db and ascii file do not match."),
    (3020, "TB_NOT_IN_DB",      "Table not found in the database."),
    (3025, "COL_NOT_IN_TB",     "Column not found in the table."),
    (3030, "COL_NOT_IN_FL",     "Column not found in the ascii file."),
    (3035, "OWNER_NOT_FOUND",   "Owner not found."),
    (3040, "PROJECT_EXISTS",    "Project already exists."),
    (3045, "PROJECT_NOT_FOUND", "Project not found."),
    (3050, "INST_EXISTS",       "Institution already exists.."),
    (3055, "INST_NOT_FOUND",    "Institution not found."),
    (9998, "NOT_IMPLEMENTED",   "Feature not implemented yet."),
    (9999, "INTERNAL",          "Internal error.")])
Beispiel #4
0
from past.builtins import basestring
import logging

# -----------------------------
# Imports for other modules --
# -----------------------------
from lsst.db.exception import produceExceptionClass
from lsst.qserv.wmgr.client import ServerError
from .nodeAdmin import NodeAdmin

# ----------------------------------
# Local non-exported definitions --
# ----------------------------------

_Exception = produceExceptionClass('WorkerMgmtException', [
    (100, "TABLE_SCHEMA_ERR", "Invalid table schema specification"),
])

# ------------------------
# Exported definitions --
# ------------------------

# ---------------------
#  Class definition --
# ---------------------


class NodeMgmt(object):
    """
    NodeMgmt class main purpose is to facilitate management operations on
    a set of nodes. It's two main responsibities are:
Beispiel #5
0
import logging
import sys
import time

# third-party software imports
from kazoo.client import KazooClient
from kazoo.exceptions import NodeExistsError, NoNodeError

# local imports
from lsst.db.exception import produceExceptionClass

####################################################################################
KvException = produceExceptionClass('KvException', [
        (2010, "INVALID_CONNECTION", "Invalid connection information."),
        (2015, "KEY_EXISTS",         "Key already exists."),
        (2020, "KEY_DOES_NOT_EXIST", "Key does not exist."),
        (2025, "KEY_INVALID",        "Key Invalid key."),
        (2030, "MISSING_PARAM",      "Missing parameter."),
        (9998, "NOT_IMPLEMENTED",    "Feature not implemented yet."),
        (9999, "INTERNAL",           "Internal error.")])

####################################################################################
class KvInterface(object):
    """
    @brief KvInterface class defines interface to the Central State Service CSS).

    @param connInfo  Connection information.
    """

    def __init__(self, connInfo):
        """
        Initialize the interface.
Beispiel #6
0
import logging

# -----------------------------
# Imports for other modules --
# -----------------------------
from lsst.db.exception import produceExceptionClass
from lsst.qserv.wmgr.client import WmgrClient

# ----------------------------------
# Local non-exported definitions --
# ----------------------------------

_LOG = logging.getLogger(__name__)

_Exception = produceExceptionClass('WorkerAdminException', [
    (100, "ARG_ERR", "Missing or inconsistent arguments"),
    (110, "CSS_HOST_NAME_MISS", "Missing host name is in CSS"),
])

# ------------------------
# Exported definitions --
# ------------------------


class NodeAdmin(object):
    """
    Class representing administration/communication endpoint for qserv worker.
    """
    def __init__(self,
                 name=None,
                 css=None,
                 host=None,