Added two command line options to bin/swift-log-stats-collector

This commit is contained in:
Greg Lange
2011年03月30日 20:32:11 +00:00
parent 955e6fa81d
commit 0959eeb72a

View File

@@ -14,12 +14,21 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from optparse import OptionParser
from swift.stats.log_processor import LogProcessorDaemon
from swift.common.utils import parse_options
from swift.common.daemon import run_daemon
if __name__ == '__main__':
conf_file, options = parse_options()
parser = OptionParser(usage='Usage: %prog [options] <conf_file>')
parser.add_option('--lookback_hours', type='int', dest='lookback_hours',
help='Hours in the past to start looking for log files')
parser.add_option('--lookback_window', type='int', dest='lookback_window',
help='Hours past lookback_hours to stop looking for log files')
conf_file, options = parse_options(parser)
# currently the LogProcessorDaemon only supports run_once
options['once'] = True
run_daemon(LogProcessorDaemon, conf_file, section_name=None,

View File

@@ -236,6 +236,10 @@ class LogProcessorDaemon(Daemon):
self.worker_count = int(c.get('worker_count', '1'))
def run_once(self, *args, **kwargs):
for k in 'lookback_hours lookback_window'.split():
if kwargs[k] != None:
setattr(self, k, kwargs[k])
self.logger.info(_("Beginning log processing"))
start = time.time()
if self.lookback_hours == 0:
Reference in New Issue
openstack/swift
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.

The note is not visible to the blocked user.