Esempio n. 1
0
INITIALIZATION_DEFAULT_LOG = {}
for key in INITIALIZATION_TABLE_TITLES:
	INITIALIZATION_DEFAULT_LOG[key] = ''



# ======================================================== CODE

process_handler = {
	'forest_mode' : 1,#Choose 1 if it will act as a balancer or 2 if it will act as a final server (states are at constants.py)
	'server_index' : 1,#If forest_mode is 1 this data will be ignored
	'synchronization_layer_1' : {
		'process_instance' : _Synchronization_Layer_1.excute_synchronization_layer_1,# Process instance that will be executed for each subprocess (thread) of this process
		'process_name' : 'synchronization_layer_1',
		'process_file_name' : SL1_LOGGING_CONFIG['process_file_name'],
		'specific_process_logger' : _Utilities.get_logger(SL1_LOGGING_CONFIG['process_file_name']),# Logger for this process (Note: each subprocess of this process will have its own logs but this is the main logger of this process)
		'cron_logger_starting_message' : 'SL1 start',# Message to confirm the main logger (cron-logger) that process has started
		'threads' : SL1_THREADS,# Threads or servers (depending on the mode) in which this process will run
		'specific_shared_variables' : {
			'current_table_row' : Value('i',SL1_LOGGING_CONFIG['table_row_limit'])
		},
		'default_log' : SL1_DEFAULT_LOG
	},
	'equalization' : {
		'process_instance' : _Equalization.equalize_dbs,
		'process_name' : 'equalization',
		'process_file_name' : EQUALIZATION_LOGGING_CONFIG['process_file_name'],
		'specific_process_logger' : _Utilities.get_logger(EQUALIZATION_LOGGING_CONFIG['process_file_name']),
		'cron_logger_starting_message' : 'EQUALIZATION start',
		'threads' : EQUALIZATION_THREADS,
		'specific_shared_variables' : {
Esempio n. 2
0
		_Processes_Handler.execute(process)
	except Already_Handled_Exception as already_handled_exception:
		raise already_handled_exception
	except Exception as e:
		cron_logger.critical(e.message)
		already_handled_exception = Already_Handled_Exception(e.message)
		return already_handled_exception

# Start a process execution: 
if __name__ == '__main__':
	# Main process name:
	multiprocessing.current_process().name = 'cron'
	# Set all loggers:
	set_all_loggers()
	# Init:
	cron_logger = _Utilities.get_logger('cron')
	cron_logger.info(' ')
	cron_logger.info(_Constants.LOG_SEPARATOR)
	# Process params:
	process = 'synchronization_layer_1'
	process_params = {
		'process' : process
	}#End of process_params
	# Exectuion:
	main(sys.argv[1:])





Esempio n. 3
0
from corebook_sdk import corebook_sdk as _Corebook_SDK
Corebook_SDK_Error = _Corebook_SDK.Error

# Development:
from General import constants as _Constants
from General import utilities as _Utilities
from Processes.Equalization import config as _Equalization_config
EQUALIZATION_CONFIG = _Equalization_config.equalization
EQUALIZATION_LOGGING_CONFIG = EQUALIZATION_CONFIG['logging']

# ======================================================== CODE

LOG_INDENT = _Constants.LOG_INDENT

# Cron logger (Main):
cron_logger = _Utilities.get_logger('cron')
equalization_logger = _Utilities.get_logger(
    EQUALIZATION_LOGGING_CONFIG['process_file_name'])

#  _____                _                 _     ____________
# /  __ \              | |               | |    |  _  \ ___ \_
# | /  \/ ___  _ __ ___| |__   ___   ___ | | __ | | | | |_/ (_)
# | |    / _ \| '__/ _ \ '_ \ / _ \ / _ \| |/ / | | | | ___ \
# | \__/\ (_) | | |  __/ |_) | (_) | (_) |   <  | |/ /| |_/ /_
#  \____/\___/|_|  \___|_.__/ \___/ \___/|_|\_\ |___/ \____/(_)


def get_cfdis_count_in_corebook_for_this_taxpayer_at_period(
        identifier, begin_date, end_date, logger=None):
    try:
        corebook_db = _Utilities.set_connection_to_corebook_db()
Esempio n. 4
0
from pauli_sdk.Classes.response import Already_Handled_Exception

# Development:
from General import constants as _Constants
from General import utilities as _Utilities
from Processes.Synchronization_layer_1 import config as _SL1_config

# ======================================================== CODE                                                                                                                                                                          

LOG_INDENT = _Constants.LOG_INDENT
SL1_CONFIG = _SL1_config.synchronization_layer_1
SL1_LOGGING_CONFIG = SL1_CONFIG['logging']


# Cron logger (Main):
cron_logger = _Utilities.get_logger('cron')
sl1_logger = _Utilities.get_logger(SL1_LOGGING_CONFIG['process_file_name'])

#  _                       _               
# | |                     (_)            _ 
# | |     ___   __ _  __ _ _ _ __   __ _(_)
# | |    / _ \ / _` |/ _` | | '_ \ / _` |  
# | |___| (_) | (_| | (_| | | | | | (_| |_ 
# \_____/\___/ \__, |\__, |_|_| |_|\__, (_)
#               __/ | __/ |         __/ |  
#              |___/ |___/         |___/   

# Dictionary to log synchronization layer 1 data:
def new_synchronization_layer_1_log(logger=None):
	try:
		synchronization_layer_1_log = {
Esempio n. 5
0
from pauli_sdk.Classes.response import Already_Handled_Exception
from pauli_sdk.Modules import log as _Log
from pauli_sdk.Modules import constants as _Pauli_Constants
from pauli_sdk.Modules import helper as _Pauli_Helper
from pauli_sdk.Modules import validating_engine as _Validating_Engine
from pauli_sdk.Modules import request_handler as _Request_Handler

# Development:
from General import config as _General_Config
from General import utilities as _Utilities
from General import constants as _Constants
from Processes import config as _Processes_Config

# ======================================================== MODULE CODE

cron_logger = _Utilities.get_logger('cron')
LOG_INDENT = _Constants.LOG_INDENT
PROCESS_HANDLER_CONFIG = _Processes_Config.process_handler

#  _   _       _ _     _       _
# | | | |     | (_)   | |     | |
# | | | | __ _| |_  __| | __ _| |_ ___
# | | | |/ _` | | |/ _` |/ _` | __/ _ \
# \ \_/ / (_| | | | (_| | (_| | ||  __/
#  \___/ \__,_|_|_|\__,_|\__,_|\__\___|

# Descriptions: functions to validate Forest-Cron calling data, availability an so on


def validate(process_name,
             mode=None,
Esempio n. 6
0
from pauli_sdk.Classes.response import Error
from pauli_sdk.Classes.response import Already_Handled_Exception

# Development:
from General import constants as _Constants
from General import utilities as _Utilities
from Processes.Initialization import config as _Initialization_config
INITIALIZATION_CONFIG = _Initialization_config.initialization
INITIALIZATION_LOGGING_CONFIG = INITIALIZATION_CONFIG['logging']

# ======================================================== CODE                                                                                                                                                                          

LOG_INDENT = _Constants.LOG_INDENT

# Cron logger (Main):
cron_logger = _Utilities.get_logger('cron')
initialization_logger = _Utilities.get_logger(INITIALIZATION_LOGGING_CONFIG['process_file_name'])

#  _                       _               
# | |                     (_)            _ 
# | |     ___   __ _  __ _ _ _ __   __ _(_)
# | |    / _ \ / _` |/ _` | | '_ \ / _` |  
# | |___| (_) | (_| | (_| | | | | | (_| |_ 
# \_____/\___/ \__, |\__, |_|_| |_|\__, (_)
#               __/ | __/ |         __/ |  
#              |___/ |___/         |___/   

# Dictionary to log initialization data:
def new_initialization_log(logger=None):
	try:
		initialization_log = {
Esempio n. 7
0
from General import constants as _Constants
from General import utilities as _Utilities
from General import firmware as _Firmware

from Processes.Initialization import config as _Initialization_config
from Processes.Initialization import locals as _Locals
INITIALIZATION_CONFIG = _Initialization_config.initialization
INITIALIZATION_LOGGING_CONFIG = INITIALIZATION_CONFIG['logging']

# ======================================================== CODE

LOG_INDENT = _Constants.LOG_INDENT
INITIALIZATION_PROCESS_NAME = 'INITIALIZATION'

# Cron logger (Main):
cron_logger = _Utilities.get_logger('cron')
initialization_logger = _Utilities.get_logger(
    INITIALIZATION_LOGGING_CONFIG['process_file_name'])

# Notes:
# cron_logger    -> log at cron main level execution
# initialization_logger     -> log at cron-initialization process level execution
# process_logger -> log at cron-init-n subprocess level execution (n subprocesses every one has its log file)


# Each initialization thread (i.e. subprocess) executes this function. Contains initialization process for a set of taxpayers
def excute_initialization(
    taxpayers, shared_variables
):  # Taxpayers are the ones splitted for this specific subprocess
    try:
        # Shared variables:
Esempio n. 8
0
process_handler = {
    'forest_mode':
    1,  #Choose 1 if it will act as a balancer or 2 if it will act as a final server (states are at constants.py)
    'server_index': 1,  #If forest_mode is 1 this data will be ignored
    'synchronization_layer_1': {
        'process_instance':
        _Synchronization_Layer_1.
        excute_synchronization_layer_1,  # Process instance that will be executed for each subprocess (thread) of this process
        'process_name':
        'synchronization_layer_1',
        'process_file_name':
        SL1_LOGGING_CONFIG['process_file_name'],
        'specific_process_logger':
        _Utilities.get_logger(
            SL1_LOGGING_CONFIG['process_file_name']
        ),  # Logger for this process (Note: each subprocess of this process will have its own logs but this is the main logger of this process)
        'cron_logger_starting_message':
        'SL1 start',  # Message to confirm the main logger (cron-logger) that process has started
        'threads':
        SL1_THREADS,  # Threads or servers (depending on the mode) in which this process will run
        'specific_shared_variables': {
            'current_table_row': Value('i',
                                       SL1_LOGGING_CONFIG['table_row_limit'])
        },
        'default_log':
        SL1_DEFAULT_LOG
    },
    'equalization': {
        'process_instance':
        _Equalization.equalize_dbs,
Esempio n. 9
0
from corebook_sdk import corebook_sdk as _Corebook_SDK
Corebook_SDK_Error = _Corebook_SDK.Error

# Development:
from General import constants as _Constants
from General import utilities as _Utilities
from Processes.Equalization import config as _Equalization_config
EQUALIZATION_CONFIG = _Equalization_config.equalization
EQUALIZATION_LOGGING_CONFIG = EQUALIZATION_CONFIG['logging']

# ======================================================== CODE                                                                                                                                                                          

LOG_INDENT = _Constants.LOG_INDENT

# Cron logger (Main):
cron_logger = _Utilities.get_logger('cron')
equalization_logger = _Utilities.get_logger(EQUALIZATION_LOGGING_CONFIG['process_file_name'])

#  _____                _                 _     ____________   
# /  __ \              | |               | |    |  _  \ ___ \_ 
# | /  \/ ___  _ __ ___| |__   ___   ___ | | __ | | | | |_/ (_)
# | |    / _ \| '__/ _ \ '_ \ / _ \ / _ \| |/ / | | | | ___ \  
# | \__/\ (_) | | |  __/ |_) | (_) | (_) |   <  | |/ /| |_/ /_ 
#  \____/\___/|_|  \___|_.__/ \___/ \___/|_|\_\ |___/ \____/(_) 

def get_cfdis_count_in_corebook_for_this_taxpayer_at_period(identifier,begin_date,end_date,logger=None):
	try:
		corebook_db = _Utilities.set_connection_to_corebook_db()
		db_Ticket = corebook_db['Ticket']
		db_User = corebook_db['User']
		# Get user:
Esempio n. 10
0
from pauli_sdk.Classes.response import Error
from pauli_sdk.Classes.response import Already_Handled_Exception

# Development:
from General import constants as _Constants
from General import utilities as _Utilities
from Processes.Synchronization_layer_1 import config as _SL1_config

# ======================================================== CODE

LOG_INDENT = _Constants.LOG_INDENT
SL1_CONFIG = _SL1_config.synchronization_layer_1
SL1_LOGGING_CONFIG = SL1_CONFIG['logging']

# Cron logger (Main):
cron_logger = _Utilities.get_logger('cron')
sl1_logger = _Utilities.get_logger(SL1_LOGGING_CONFIG['process_file_name'])

#  _                       _
# | |                     (_)            _
# | |     ___   __ _  __ _ _ _ __   __ _(_)
# | |    / _ \ / _` |/ _` | | '_ \ / _` |
# | |___| (_) | (_| | (_| | | | | | (_| |_
# \_____/\___/ \__, |\__, |_|_| |_|\__, (_)
#               __/ | __/ |         __/ |
#              |___/ |___/         |___/


# Dictionary to log synchronization layer 1 data:
def new_synchronization_layer_1_log(logger=None):
    try: