# Path: static_aid/config.py
# ROOT = realpath(curdir)
# CONFIG_DEFAULTS_FILE_PATH = join(ROOT, 'local_settings.default')
#     ROOT = realpath(join(dirname(__file__), '..'))
#     CONFIG_DEFAULTS_FILE_PATH = join(ROOT, 'local_settings.default')
# CONFIG_FILE_PATH = join(ROOT, 'local_settings.cfg')
# SAMPLE_DATA_DIR = join(ROOT, 'data')
# SITE_SRC_DIR = join(ROOT, 'site')
# BUILD_DIR = join(ROOT, 'build')
# DATA_DIR = join(BUILD_DIR, 'data')
# STAGING_DIR = join(BUILD_DIR, 'staging')
# RAW_DATA_DIR = join(BUILD_DIR, 'raw')
# SITE_BUILD_DIR = join(BUILD_DIR, 'site')  # must match 'dest' settings in Gruntfile.js
# TEMP_DIR = join(BUILD_DIR, 'tmp')
# PID_FILE_PATH = join(TEMP_DIR, 'daemon.pid')
# OBJECT_CACHE_DIR = join(TEMP_DIR, 'object_cache')
# ROW_FETCH_LIMIT = 100
# def _configSection(section):
# def _stringToBoolean(string):
# def _stringToList(string):
# 
# Path: static_aid/utils.py
# def bytes_label(size):
# def create_directory(path):
# def load_json(path):
# def remove_file_or_dir(path):


import logging
import pickle
from os.path import join, exists, isfile, dirname
from os import getpid, makedirs
from psutil import pid_exists
from sys import exit
from time import time
from json import dump
from static_aid import config, utils
#!/usr/bin/env python3




class DataExtractor(object):

    def __init__(self, update=False):
        if self.is_running():
            logging.error('Process already running, exiting')
            exit()
        self.register_pid()
        self.update = update

    def run(self):
        logging.info('\n*** Export started ***')

        start_time = int(time())
        utils.remove_file_or_dir(config.DATA_DIR)
        self._run()
        self.set_last_export_time(start_time)

        logging.info('*** Export completed ***')

# Path: static_aid/config.py
# ROOT = realpath(curdir)
# CONFIG_DEFAULTS_FILE_PATH = join(ROOT, 'local_settings.default')
#     ROOT = realpath(join(dirname(__file__), '..'))
#     CONFIG_DEFAULTS_FILE_PATH = join(ROOT, 'local_settings.default')
# CONFIG_FILE_PATH = join(ROOT, 'local_settings.cfg')
# SAMPLE_DATA_DIR = join(ROOT, 'data')
# SITE_SRC_DIR = join(ROOT, 'site')
# BUILD_DIR = join(ROOT, 'build')
# DATA_DIR = join(BUILD_DIR, 'data')
# STAGING_DIR = join(BUILD_DIR, 'staging')
# RAW_DATA_DIR = join(BUILD_DIR, 'raw')
# SITE_BUILD_DIR = join(BUILD_DIR, 'site')  # must match 'dest' settings in Gruntfile.js
# TEMP_DIR = join(BUILD_DIR, 'tmp')
# PID_FILE_PATH = join(TEMP_DIR, 'daemon.pid')
# OBJECT_CACHE_DIR = join(TEMP_DIR, 'object_cache')
# ROW_FETCH_LIMIT = 100
# def _configSection(section):
# def _stringToBoolean(string):
# def _stringToList(string):
# 
# Path: static_aid/utils.py
# def bytes_label(size):
# def create_directory(path):
# def load_json(path):
# def remove_file_or_dir(path):


# Path: static_aid/DataExtractor.py
import logging
import pickle
from os.path import join, exists, isfile, dirname
from os import getpid, makedirs
from psutil import pid_exists
from sys import exit
from time import time
from json import dump
from static_aid import config, utils

#!/usr/bin/env python3




class DataExtractor(object):

    def __init__(self, update=False):
        if self.is_running():
            logging.error('Process already running, exiting')
            exit()
        self.register_pid()
        self.update = update

    def run(self):
        logging.info('\n*** Export started ***')

        start_time = int(time())
        utils.remove_file_or_dir(config.DATA_DIR)
        self._run()
        self.set_last_export_time(start_time)

        logging.info('*** Export completed ***')

        utils.remove_file_or_dir(config.PID_FILE_PATH)