Hashar has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/98007


Change subject: (WIP) beta: autoupdate should restart parsoid (WIP)
......................................................................

(WIP) beta: autoupdate should restart parsoid (WIP)

bug: 57233
Change-Id: Ie3f0a46d99a2e02b9a943bcd1d4a699a36631aee
---
M files/misc/beta/wmf-beta-autoupdate.py
1 file changed, 26 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/operations/puppet 
refs/changes/07/98007/1

diff --git a/files/misc/beta/wmf-beta-autoupdate.py 
b/files/misc/beta/wmf-beta-autoupdate.py
index 044c38f..5aea826 100755
--- a/files/misc/beta/wmf-beta-autoupdate.py
+++ b/files/misc/beta/wmf-beta-autoupdate.py
@@ -48,6 +48,9 @@
         logging.getLevelName(logging.ERROR))
 
     logger = logging.getLogger('main')
+
+    parsoid_pre = parsoid_head_ts()
+
     logger.info("Starting updating tasks...")
     exit_codes = [
         pull_mediawiki(),
@@ -56,6 +59,11 @@
         update_parsoid_deps(),
         update_l10n(),
     ]
+
+    parsoid_post = parsoid_head_ts()
+    if parsoid_post is not parsoid_pre:
+        logger.info("Restarting updated Parsoid code base")
+        exit_codes.append(restart_parsoid())
     logger.info("Executions completed %s", exit_codes)
 
     final_exit = 0
@@ -90,6 +98,18 @@
     return parser.parse_args()
 
 
+def git_head_ts(git_dir):
+    proc = subprocess.check_output(
+        ['git', '--git-dir', git_dir, 'log',
+         '--pretty=tformat:%ct', '-1', 'HEAD'])
+    return proc.rstrip('\n')
+
+
+def parsoid_head_ts():
+    """Returns timestamp of the HEAD committer date"""
+    return git_head_ts(os.path.join(PATH_MWEXT, 'Parsoid/.git'))
+
+
 def pull_mediawiki():
     """Updates MediaWiki core"""
     return runner(name='mwcore', path=PATH_MWCORE, cmd=['git', 'pull'])
@@ -113,6 +133,12 @@
         'npm', 'install', '--verbose', '--color', 'always'])
 
 
+def restart_parsoid():
+    logger = logging.getLogger(__name__)
+    logger.warn("restarting parsoid is not yet implemented")
+    return 0
+
+
 def update_l10n():
     """Localisation cache update"""
     return runner(name='mw-update-l10n', cmd=['mw-update-l10n'])

-- 
To view, visit https://gerrit.wikimedia.org/r/98007
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie3f0a46d99a2e02b9a943bcd1d4a699a36631aee
Gerrit-PatchSet: 1
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Hashar <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to