Gehel has uploaded a new change for review.

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

Change subject: maps - make sure tilerator notification does not run 
concurrently
......................................................................

maps - make sure tilerator notification does not run concurrently

Tilerator notification does not have an internal mechanism to ensure
that notifications are not running concurrently. This mechanism needs
to be external at the moment, so let's implement it with a simple flock.

Change-Id: Id433e773708035abcaa500084db2a0ee7f46b067
---
M modules/tilerator/manifests/ui.pp
M modules/tilerator/templates/notify-tilerator.erb
2 files changed, 15 insertions(+), 10 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/operations/puppet 
refs/changes/03/315703/1

diff --git a/modules/tilerator/manifests/ui.pp 
b/modules/tilerator/manifests/ui.pp
index 77241e7..dbcbe48 100644
--- a/modules/tilerator/manifests/ui.pp
+++ b/modules/tilerator/manifests/ui.pp
@@ -59,6 +59,9 @@
 #   if tile is empty, make sure we don't store it, if it was there before
 #   used in Tilerator notification
 #
+# [*osmosis_dir*]
+#   directory in which osmosis keeps its state
+#
 class tilerator::ui(
     $port           = 6535,
     $conf_sources   = 'sources.prod.yaml',
@@ -69,6 +72,7 @@
     $generator_id   = 'gen',
     $storage_id     = 'v3',
     $delete_empty   = true,
+    $osmosis_dir    = '/srv/osmosis',
     $expire_dir     = '/srv/osm_expire/',
 ) {
     $statefile = "${statefile_dir}/expire.state"
diff --git a/modules/tilerator/templates/notify-tilerator.erb 
b/modules/tilerator/templates/notify-tilerator.erb
index cece890..13b5e40 100644
--- a/modules/tilerator/templates/notify-tilerator.erb
+++ b/modules/tilerator/templates/notify-tilerator.erb
@@ -1,17 +1,18 @@
 #!/bin/bash
 
-/usr/bin/nodejs /srv/deployment/tilerator/deploy/src/scripts/tileshell.js \
-    --config /etc/tileratorui/config.yaml \
-    -j.fromZoom <%= @from_zoom %> \
-    -j.beforeZoom <%= @before_zoom %> \
-    -j.generatorId <%= @generator_id %> \
-    -j.storageId <%= @storage_id %> \
+/usr/bin/flock -xn <%= @osmosis_dir %>/replicate-osm.lck \
+    /usr/bin/nodejs /srv/deployment/tilerator/deploy/src/scripts/tileshell.js \
+        --config /etc/tileratorui/config.yaml \
+        -j.fromZoom <%= @from_zoom %> \
+        -j.beforeZoom <%= @before_zoom %> \
+        -j.generatorId <%= @generator_id %> \
+        -j.storageId <%= @storage_id %> \
 <%- if @delete_empty -%>
-    -j.deleteEmpty \
+        -j.deleteEmpty \
 <%- end -%>
-    -j.expdirpath <%= @expire_dir %> \
-    -j.expmask 'expire\.list\.*' \
-    -j.statefile <%= @statefile %>
+        -j.expdirpath <%= @expire_dir %> \
+        -j.expmask 'expire\.list\.*' \
+        -j.statefile <%= @statefile %>
 
 notification_code=$?
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id433e773708035abcaa500084db2a0ee7f46b067
Gerrit-PatchSet: 1
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Gehel <gleder...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to