Chad has uploaded a new change for review.
https://gerrit.wikimedia.org/r/239112
Change subject: Convert tasks.* to use context logger
......................................................................
Convert tasks.* to use context logger
Also undoes I13c6c02b since that's not entirely right
Change-Id: If9ce5f211b23c22fedda36e4d047c1e3eccfe1fd
---
M scap/tasks.py
1 file changed, 15 insertions(+), 15 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/tools/scap
refs/changes/12/239112/1
diff --git a/scap/tasks.py b/scap/tasks.py
index e0f1b66..9454fb1 100644
--- a/scap/tasks.py
+++ b/scap/tasks.py
@@ -9,9 +9,9 @@
import glob
import itertools
import json
-import logging
import multiprocessing
import os
+import scap.log
import shutil
import socket
import subprocess
@@ -79,7 +79,7 @@
def check_valid_syntax(*paths):
"""Run php -l in parallel on `paths`; raise CalledProcessError if nonzero
exit."""
- logger = logging.getLogger('check_php_syntax')
+ logger = scap.log.ctxLogger('check_php_syntax')
quoted_paths = ["'%s'" % x for x in paths]
cmd = (
"find %s -name '*.php' -or -name '*.inc' -or -name '*.phtml' "
@@ -114,7 +114,7 @@
:param source_tree: Source tree to read file from: 'deploy' or 'stage'
:param cfg: Dict of global configuration values
"""
- logger = logging.getLogger('compile_wikiversions')
+ logger = scap.log.ctxLogger('compile_wikiversions')
working_dir = cfg['%s_dir' % source_tree]
@@ -206,7 +206,7 @@
:param trust_mtime: Trust file modification time?
:param mute: Disable progress indicator
"""
- logger = logging.getLogger('merge_cdb_updates')
+ logger = scap.log.ctxLogger('merge_cdb_updates')
cache_dir = os.path.realpath(directory)
upstream_dir = os.path.join(cache_dir, 'upstream')
@@ -290,7 +290,7 @@
``<dirname>/***``.
:param sync_from: List of rsync servers to fetch from.
"""
- logger = logging.getLogger('sync_common')
+ logger = scap.log.ctxLogger('sync_common')
if not os.path.isdir(cfg['deploy_dir']):
raise Exception((
@@ -357,7 +357,7 @@
:param cdb_file: L10n CDB database
:param trust_mtime: Trust file modification time?
"""
- logger = logging.getLogger('update_l10n_cdb')
+ logger = scap.log.ctxLogger('update_l10n_cdb')
md5_path = os.path.join(cache_dir, 'upstream', '%s.MD5' % cdb_file)
if not os.path.exists(md5_path):
@@ -420,7 +420,7 @@
return update_l10n_cdb(*args)
except:
# Log detailed error; multiprocessing will truncate the stack trace
- logging.getLogger('update_l10n_cdb_wrapper').exception(
+ scap.log.ctxLogger('update_l10n_cdb_wrapper').exception(
'Failure processing %s', args)
raise
@@ -436,7 +436,7 @@
:param force: Whether to pass --force
:param quiet: Whether to pass --quiet
"""
- logger = logging.getLogger('update_localization_cache')
+ logger = scap.log.ctxLogger('update_localization_cache')
with utils.sudo_temp_dir('www-data', 'scap_l10n_') as temp_dir:
# Seed the temporary directory with the current CDB and/or PHP files.
@@ -483,7 +483,7 @@
:param verbose: Provide verbose output
:param cfg: Global configuration
"""
- logger = logging.getLogger('update_localization_cache')
+ logger = scap.log.ctxLogger('update_localization_cache')
# Calculate the number of parallel threads
# Leave a couple of cores free for other stuff
@@ -611,7 +611,7 @@
def git_checkout(location, rev, submodules=False, user="mwdeploy"):
"""Checkout a git repo sha at a location as a user
"""
- logger = logging.getLogger('git_checkout')
+ logger = scap.log.ctxLogger('git_checkout')
with utils.cd(location):
logger.debug(
'Checking out rev: {} at location: {}'.format(rev, location))
@@ -626,7 +626,7 @@
def git_update_server_info(has_submodules=False, location=os.getcwd()):
"""runs git update-server-info and tags submodules"""
- logger = logging.getLogger('git_update_server_info')
+ logger = scap.log.ctxLogger('git_update_server_info')
with utils.cd(location):
cmd = '/usr/bin/git update-server-info'
@@ -645,7 +645,7 @@
:param deploy_info: current deploy info to write to file as JSON
:param (optional) location: git directory location (default cwd)
"""
- logger = logging.getLogger('git_deploy_file')
+ logger = scap.log.ctxLogger('git_deploy_file')
with utils.cd(location):
deploy_file = os.path.join(location, '.git', 'DEPLOY_HEAD')
@@ -675,15 +675,15 @@
def restart_service(service, user='mwdeploy'):
- logger = logging.getLogger('service_restart')
+ logger = scap.log.ctxLogger('service_restart')
logger.debug('Restarting service {}'.format(service))
cmd_format = 'sudo /usr/sbin/service {} {}'
- utils.sudo_check_call(user, cmd_format.format(service, 'restart'), logger)
+ utils.sudo_check_call(user, cmd_format.format(service, 'restart'))
def check_port(port_number):
- logger = logging.getLogger('port_check')
+ logger = scap.log.ctxLogger('port_check')
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
# Try this a few times while we wait for the service to come up
--
To view, visit https://gerrit.wikimedia.org/r/239112
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: If9ce5f211b23c22fedda36e4d047c1e3eccfe1fd
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/tools/scap
Gerrit-Branch: master
Gerrit-Owner: Chad <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits