From fe1d07742e85a3f7f7fdb43f2fa95e36e884fcdb Mon Sep 17 00:00:00 2001 From: t3eHawk Date: Mon, 12 Dec 2022 05:25:33 +0300 Subject: [PATCH] Set version 0.1.1 --- pydin/__init__.py | 2 +- pydin/api.py | 132 +++++++++++++++++++++++++++------------------- 2 files changed, 78 insertions(+), 56 deletions(-) diff --git a/pydin/__init__.py b/pydin/__init__.py index 22cf2e4..e6ad003 100644 --- a/pydin/__init__.py +++ b/pydin/__init__.py @@ -13,7 +13,7 @@ from .vars import run_id, task_id, step_id, process_id -__version__ = '0.1.0' +__version__ = '0.1.1' __status__ = 'Development' __author__ = 'Timur Faradzhov' diff --git a/pydin/api.py b/pydin/api.py index 8b903fb..87764f3 100644 --- a/pydin/api.py +++ b/pydin/api.py @@ -53,27 +53,31 @@ def create_scheduler(self, name=None, desc=None, path=None): logger.debug(f'File {dest} created') else: raise Exception(f'file {dest} already exists!') - config_path = os.path.join(root, 'pydin.ini') config_local = configparser.ConfigParser() - config_dict = {'SCHEDULER': {'scheduler_name': name or '', - 'scheduler_desc': desc or '', - 'chargers_number': '5', - 'executors_number': '20', - 'refresh_interval': '300', - 'rerun_delay': '14400', - 'rerun_interval': '3600', - 'wakeup_interval': '60' - }, - 'LOGGING': {'console': 'True', - 'file': 'True', - 'info': 'True', - 'debug': 'False', - 'error': 'True', - 'warning': 'True', - 'critical': 'True', - 'alarming': 'False', - 'maxsize': '10485760', - 'maxdays': '1'}} + config_path = os.path.join(root, 'pydin.ini') + config_dict = { + 'SCHEDULER': { + 'scheduler_name': name or '', + 'scheduler_desc': desc or '', + 'chargers_number': '5', + 'executors_number': '20', + 'refresh_interval': '300', + 'rerun_delay': '14400', + 'rerun_interval': '3600', + 'wakeup_interval': '60' + }, + 'LOGGING': { + 'console': 'True', + 'file': 'True', + 'info': 'True', + 'debug': 'False', + 'error': 'True', + 'warning': 'True', + 'critical': 'True', + 'alarming': 'False', + 'maxsize': '10485760', + 'maxdays': '1'} + } config_local.read_dict(config_dict) with open(config_path, 'w') as fh: config_local.write(fh, space_around_delimiters=False) @@ -209,18 +213,24 @@ def create_job(self, name=None, desc=None, mday=None, wday=None, config_path = os.path.join(folder, 'pydin.ini') config_local = configparser.ConfigParser() - config_dict = {'JOB': {}, - 'LOGGING': {'console': 'True', - 'file': 'True', - 'info': 'True', - 'debug': 'False', - 'error': 'True', - 'warning': 'True', - 'critical': 'True', - 'alarming': 'True', - 'maxsize': '10485760', - 'maxdays': '1'}, - 'EMAIL': {'toggle': 'True'}} + config_dict = { + 'JOB': {}, + 'LOGGING': { + 'console': 'True', + 'file': 'True', + 'info': 'True', + 'debug': 'False', + 'error': 'True', + 'warning': 'True', + 'critical': 'True', + 'alarming': 'True', + 'maxsize': '10485760', + 'maxdays': '1' + }, + 'EMAIL': { + 'toggle': 'True' + } + } config_local.read_dict(config_dict) with open(config_path, 'w') as fh: config_local.write(fh, space_around_delimiters=False) @@ -444,29 +454,41 @@ def create_config(self): raise Exception(f'file {config_path} already exists!') else: config_parser = configparser.ConfigParser() - config_dict = {'GENERAL': {'debug': '', - 'editor': '', - 'owner': ''}, - 'DATABASE': {'vendor': '', - 'driver': '', - 'path': '', - 'host': '', - 'port': '', - 'sid': '', - 'service': '', - 'user': '', - 'password': ''}, - 'EMAIL': {'toggle': '', - 'host': '', - 'port': '', - 'tls': '', - 'address': '', - 'user': '', - 'password': ''}, - 'API': {'host': '', - 'port': '', - 'token': ''}, - 'ENVIRONMENTS': {'python': sys.executable}} + config_dict = { + 'GENERAL': { + 'debug': '', + 'editor': '', + 'owner': '' + }, + 'DATABASE': { + 'vendor': '', + 'driver': '', + 'path': '', + 'host': '', + 'port': '', + 'sid': '', + 'service': '', + 'user': '', + 'password': '' + }, + 'EMAIL': { + 'toggle': '', + 'host': '', + 'port': '', + 'tls': '', + 'address': '', + 'user': '', + 'password': '' + }, + 'API': { + 'host': '', + 'port': '', + 'token': '' + }, + 'ENVIRONMENTS': { + 'python': sys.executable + } + } config_parser.read_dict(config_dict) with open(config_path, 'w') as fh: config_parser.write(fh, space_around_delimiters=False)