Esempio n. 1
0
# -*- coding: utf-8 -*-

import os
import time
import random
import config
import json
import datetime
import dateutil.parser

from sqlalchemy import create_engine
from dashboard_logging import dashboard_logging

db_url = config.db_url
engine = create_engine(db_url)
logger = dashboard_logging(config="logging.json", name=__name__)


def readSnapshot():
    """
            readSegmentos()
    """
    result = []

    try:
        cur = engine.connect()
    except Exception, ex:
        logger.error("read snapshot", traceback=True)
        result = []
    else:
        segment_snapshot = cur.execute("SELECT * FROM segment_snapshot")
Esempio n. 2
0
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import datetime
import time
import analisis
import sys

from dashboard_logging import dashboard_logging
logger = dashboard_logging(config="analisis/logging.json", name=__name__)


class setInterval:

    def __init__(self, production):

        self.setTimeOut = 0
        self.dawn = [23, 00, 1, 2, 3, 4, 5, 6]
        # 36 extraccion lun/vier, 9 extraciones sab/dom
        self.morning = range(7, 10)
        # 42 extraccion lun/vier, 21 extraciones sab/dom
        self.midday = range(10, 17)
        # 36 extraccion lun/vier, 18 extraciones sab, 9 extraciones dom
        self.afternoon = range(17, 20)
        self.night = range(20, 23)  # 12 extraccion lun/sab, 6 extraciones dom
        self.daily = ['Monday', 'Tuesday', 'Wednesday',
                      'Thursday', 'Friday', 'Saturday', 'Sunday']
        self.production = production

    def setCfg(self):
        """
Esempio n. 3
0
# -*- coding: utf-8 -*-

import os
import time
import random
import config
import json
import datetime
import dateutil.parser

from sqlalchemy import create_engine
from dashboard_logging import dashboard_logging

db_url = config.db_url
engine = create_engine(db_url)
logger = dashboard_logging(config="logging.json", name=__name__)


def readSnapshot():
    """
            readSegmentos()
    """
    result = []

    try:
        cur = engine.connect()
    except Exception, ex:
        logger.error("read snapshot", traceback=True)
        result = []
    else:
        segment_snapshot = cur.execute("SELECT * FROM segment_snapshot")
Esempio n. 4
0
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import datetime
import time
import analisis
import os

from dashboard_logging import dashboard_logging
logger = dashboard_logging(config="analisis/logging.json", name=__name__)

if os.environ.get('OPENSHIFT_PYTHON_DIR'):
    # en caso de estarlo, activo entorno virtual y agarro las variables de
    # entorno para ip y puerto
    zvirtenv = os.path.join(os.environ['OPENSHIFT_PYTHON_DIR'],
                            'virtenv', 'bin', 'activate_this.py')
    execfile(zvirtenv, dict(__file__=zvirtenv))
    logger.info("activo virtenv openshift")
else:
    pass


class setInterval:

    def __init__(self):

        self.setTimeOut = 0
        self.dawn = [23, 00, 1, 2, 3, 4, 5, 6, 7]
        # 36 extraccion lun/vier, 9 extraciones sab/dom
        self.morning = range(8, 11)
        # 42 extraccion lun/vier, 21 extraciones sab/dom