Skip to content

Commit

Permalink
Merge pull request #143 from phenobarbital/queue-manager
Browse files Browse the repository at this point in the history
fixing logger name from some workers processes
  • Loading branch information
phenobarbital authored Jun 4, 2023
2 parents 564f5a1 + 6340390 commit 47c6b3f
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion qw/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def __init__(self, worker_list: list = None, timeout: int = 5):
except RuntimeError:
raise
## logger:
self.logger = logging.getLogger('QW:Client')
self.logger = logging.getLogger('QW.Client')
## check if we use network discovery or redis list:
if worker_list:
self._workers = worker_list
Expand Down
3 changes: 2 additions & 1 deletion qw/decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@


def dispatch(func: Callable) -> Any:
qw = QClient() ## calling Queue Worker
qw = QClient() # calling Queue Worker
print('FUNCTION is ', qw)

@wraps(func)
async def _wrap(*args, **kwargs):
result = await qw.queue(func, *args, **kwargs)
Expand Down
2 changes: 1 addition & 1 deletion qw/executor/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

class TaskExecutor:
def __init__(self, task, *args, **kwargs):
self.logger = logging.getLogger('QS.Executor')
self.logger = logging.getLogger('QW.Executor')
self.task = task
self.semaphore = asyncio.Semaphore(WORKER_CONCURRENCY_NUMBER)

Expand Down
2 changes: 1 addition & 1 deletion qw/process.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def __init__(self, args):
raise_nofile(value=NOFILES)
## Logger:
self.logger = logging.getLogger(
name='QW:WorkerProcess'
name='QW.WorkerProcess'
)
for i in range(args.workers):
try:
Expand Down
4 changes: 2 additions & 2 deletions qw/protocols.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def __init__(self):
raise QWException(
f"Error getting event loop: {ex}"
)
self.logger = logging.getLogger('QW:Discovery')
self.logger = logging.getLogger('QW.Discovery')
self.transport = None
super().__init__()

Expand Down Expand Up @@ -86,7 +86,7 @@ class QueueProtocol(asyncio.Protocol):
def __init__(self, queue: asyncio.Queue, name: str):
self.queue = queue
self.logger = logging.getLogger(
f'QW:QueueServer-{name}'
f'QW.QueueServer-{name}'
)
self.transport = None
self.loop = asyncio.get_event_loop()
Expand Down
2 changes: 1 addition & 1 deletion qw/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def __init__(
self._protocol = protocol
# logging:
self.logger = logging.getLogger(
f'QW:Server:{self._name}:{self._id}'
f'QW.Server:{self._name}.{self._id}'
)

@property
Expand Down
2 changes: 1 addition & 1 deletion qw/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
__description__ = ('QueueWorker is asynchronous Task Queue implementation '
'built on top of Asyncio.'
'Can you spawn distributed workers to run functions inside workers.')
__version__ = '1.8.0'
__version__ = '1.8.1'
__author__ = 'Jesus Lara'
__author_email__ = 'jesuslarag@gmail.com'
__license__ = 'MIT'
Expand Down

0 comments on commit 47c6b3f

Please sign in to comment.