Skip to content

Commit

Permalink
enhancement(#4909): Chaning logging directory name
Browse files Browse the repository at this point in the history
  • Loading branch information
pro-akim committed Feb 7, 2024
1 parent e40a2c9 commit 5767f63
Show file tree
Hide file tree
Showing 12 changed files with 3 additions and 36 deletions.
5 changes: 0 additions & 5 deletions deployability/modules/allocation/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@
import os
import sys

project_root = os.path.abspath(os.path.join(os.path.dirname(__file__), '../..'))
sys.path.append(project_root)

from modules.allocation import Allocator
from modules.allocation.generic.models import InputPayload

Expand All @@ -21,10 +18,8 @@ def parse_arguments():
parser.add_argument("--working-dir", required=False, default='/tmp/wazuh-qa')
return parser.parse_args()


def main():
Allocator.run(InputPayload(**vars(parse_arguments())))


if __name__ == "__main__":
main()
3 changes: 0 additions & 3 deletions deployability/modules/provision/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@

# ---------------- Vars ------------------------

project_root = os.path.abspath(os.path.join(os.path.dirname(__file__), '../..'))
sys.path.append(project_root)

from modules.provision import Provision, models

# ---------------- Methods ---------------------
Expand Down
10 changes: 0 additions & 10 deletions deployability/modules/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,6 @@ def get_version():
version = data['version']
return version

scripts_list = [
'models=workflow_engine.models:main',
'schema_validator=workflow_engine.schema_validator:main',
'task=workflow_engine.task:main',
'workflow_processor=workflow_engine.workflow_processor:main',
'main=workflow_engine.main:main',
'logging=workflow_engine.logging.logger:main'
]

package_data_list = get_files_from_directory("workflow_engine")

setup(
Expand All @@ -44,7 +35,6 @@ def get_version():
packages=['workflow_engine'],
package_dir={'workflow_engine': 'workflow_engine'},
package_data={'workflow_engine': package_data_list},
entry_points={'console_scripts': scripts_list},
include_package_data=True,
zip_safe=False
)
3 changes: 0 additions & 3 deletions deployability/modules/testing/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@
import sys
import os

project_root = os.path.abspath(os.path.join(os.path.dirname(__file__), '../..'))
sys.path.append(project_root)

from modules.testing import Tester, InputPayload

def parse_arguments():
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import logging
import threading


class ThreadIDFilter(logging.Filter):
"""
A filter that uppercases the name of the log record.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

import yaml


def _load_config() -> None:
"""
Loads the logging configuration from 'config.yaml' file.
Expand Down
3 changes: 0 additions & 3 deletions deployability/modules/workflow_engine/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@
import sys
import argparse

project_root = os.path.abspath(os.path.join(os.path.dirname(__file__), '../..'))
sys.path.append(project_root)

from workflow_engine.workflow_processor import WorkflowProcessor
from workflow_engine.models import InputPayload

Expand Down
3 changes: 1 addition & 2 deletions deployability/modules/workflow_engine/schema_validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
from pathlib import Path
from ruamel.yaml import YAML

from workflow_engine.logging.logger import logger

from workflow_engine.logger.logger import logger

class SchemaValidator:
"""
Expand Down
7 changes: 1 addition & 6 deletions deployability/modules/workflow_engine/task.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@
import time

from abc import ABC, abstractmethod
from workflow_engine.logging.logger import logger

from workflow_engine.logger.logger import logger

class Task(ABC):
"""Abstract base class for tasks."""
Expand All @@ -17,8 +16,6 @@ class Task(ABC):
def execute(self) -> None:
"""Execute the task."""
pass


class ProcessTask(Task):
"""Task for executing a process."""

Expand Down Expand Up @@ -73,7 +70,6 @@ def execute(self):
message = self.task_parameters.get('message', 'No message provided')
logger.info("%s: %s", message, self.task_name, extra={'tag': self.task_name})


class DummyRandomTask(Task):
def __init__(self, task_name, task_parameters):
self.task_name = task_name
Expand All @@ -88,7 +84,6 @@ def execute(self):

time.sleep(sleep_time)


TASKS_HANDLERS = {
'process': ProcessTask,
'dummy': DummyTask,
Expand Down
3 changes: 1 addition & 2 deletions deployability/modules/workflow_engine/workflow_processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,10 @@
from pathlib import Path
from itertools import product

from workflow_engine.logging.logger import logger
from workflow_engine.logger.logger import logger
from workflow_engine.schema_validator import SchemaValidator
from workflow_engine.task import Task, TASKS_HANDLERS


class WorkflowFile:
"""Class for loading and processing a workflow file."""
schema_path = Path(__file__).parent / 'schemas' / 'schema_v1.json'
Expand Down

0 comments on commit 5767f63

Please sign in to comment.