Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions littleworkers.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import logging
import os
import subprocess
import time

Expand Down Expand Up @@ -101,7 +100,7 @@ def create_process(self, command):
Given a provided command (string or list), creates a new process
to execute the command.
"""
logging.debug("Starting process to handle command '%s'." % command)
logging.debug("Starting process to handle command '%s'.", command)
kwargs = self.process_kwargs(command)
return subprocess.Popen(command, **kwargs)

Expand All @@ -118,7 +117,7 @@ def add_to_pool(self, proc):
"""
Adds a process to the pool.
"""
logging.debug("Adding %s to the pool." % proc.pid)
logging.debug("Adding %s to the pool.", proc.pid)
self.pool[proc.pid] = proc

def remove_from_pool(self, pid):
Expand All @@ -129,7 +128,7 @@ def remove_from_pool(self, pid):
``Pool.debug = True``).
"""
try:
logging.debug("Removing %s from the pool" % pid)
logging.debug("Removing %s from the pool", pid)
del(self.pool[pid])
except KeyError:
if self.debug:
Expand All @@ -144,7 +143,7 @@ def inspect_pool(self):
"""
# Call ``len()`` just once.
pool_size = len(self.pool)
logging.debug("Current pool size: %s" % pool_size)
logging.debug("Current pool size: %s", pool_size)
return pool_size

def busy_wait(self):
Expand Down Expand Up @@ -185,7 +184,7 @@ def run(self, commands=None, callback=None):

# Go in reverse order so offsets never get screwed up.
for pid in self.pool.keys():
logging.debug("Checking status on %s" % self.pool[pid].pid)
logging.debug("Checking status on %s", self.pool[pid].pid)

if self.pool[pid].poll() >= 0:
if self.callback:
Expand Down