jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/344814 )

Change subject: Use local ORES service when both ores and ores_services roles 
are enabled
......................................................................


Use local ORES service when both ores and ores_services roles are enabled

Enables 'damaging' score for which the local service will give random
results.

Depends on https://github.com/wiki-ai/ores/pull/199

Also fixes some unrelated copypaste errors in the ores role and adds some
missing dependencies.

Bug: T159105
Change-Id: I2ea694c745f2c3e2f636ee76f839393f89107633
---
M puppet/modules/ores/manifests/init.pp
M puppet/modules/role/manifests/ores.pp
M puppet/modules/role/manifests/ores_service.pp
M puppet/modules/wikilabels/manifests/init.pp
4 files changed, 53 insertions(+), 3 deletions(-)

Approvals:
  jenkins-bot: Verified
  Awight: Checked; Looks good to me, approved



diff --git a/puppet/modules/ores/manifests/init.pp 
b/puppet/modules/ores/manifests/init.pp
index cf84dde..fa37eb3 100644
--- a/puppet/modules/ores/manifests/init.pp
+++ b/puppet/modules/ores/manifests/init.pp
@@ -69,9 +69,10 @@
         ensure         => present,
         service_params => {
             require   => [
-                VirtualEnv::Package['wikilabels'],
+                VirtualEnv::Package['ores'],
+                Class['mediawiki::ready_service'],
                 Exec['pip_install_revscoring_dependencies_hack'],
-                Apache::Site['wikilabels'],
+                Apache::Site['ores'],
             ],
             subscribe => [
                 File[$cfg_file],
@@ -83,6 +84,7 @@
         service_params => {
             require   => [
                 VirtualEnv::Package['ores'],
+                Class['mediawiki::ready_service'],
                 Exec['pip_install_revscoring_dependencies_hack'],
                 Apache::Site['ores'],
             ],
diff --git a/puppet/modules/role/manifests/ores.pp 
b/puppet/modules/role/manifests/ores.pp
index 1bd7069..b51b052 100644
--- a/puppet/modules/role/manifests/ores.pp
+++ b/puppet/modules/role/manifests/ores.pp
@@ -27,6 +27,13 @@
     mediawiki::maintenance { 'check ORES model versions':
         command => '/usr/local/bin/mwscript 
extensions/ORES/maintenance/CheckModelVersions.php --wiki=wiki',
         unless  => '/usr/bin/mysql -e "select * from ores_model" wiki | 
/bin/grep -q "damaging"',
-        require => Mediawiki::Extension['ORES']
+        require => Mediawiki::Extension['ORES'],
     }
+
+    # Ensure that the maintenance script does not run before the API is alive,
+    # when ORES is installed locally via role::ores_service.
+    # This is pretty horrible but seems to be the only way of avoiding cycles.
+    Systemd::Service<| title == 'ores-wsgi' or title == 'ores-celery' |>
+    ->
+    Mediawiki::Maintenance['check ORES model versions']
 }
diff --git a/puppet/modules/role/manifests/ores_service.pp 
b/puppet/modules/role/manifests/ores_service.pp
index d223abf..f5d646b 100644
--- a/puppet/modules/role/manifests/ores_service.pp
+++ b/puppet/modules/role/manifests/ores_service.pp
@@ -5,6 +5,46 @@
     include ::ores
 
     $ores_hostname = $::ores::vhost_name
+
+    # when role::ores is also enabled, make it use the local service
+    mediawiki::settings { 'ORES service':
+        values   => {
+            wgOresBaseUrl           => "http://localhost:${::ores::port}/";,
+            wgOresWikiId            => 'wiki',
+            wgOresModels            => {
+                damaging  => true,
+                goodfaith => false,
+                reverted  => false,
+                wp10      => false,
+            },
+            # the mock scorer used by the local service cannot
+            # provide recall stats so dynamic threshold configuration
+            # would cause score fetches to silently fail. Use a
+            # constant dummy configuration instead.
+            wgOresFiltersThresholds => {
+                damaging => {
+                    likelygood    => {
+                        min => 0,
+                        max => 0.3,
+                    },
+                    maybebad      => {
+                        min => 0.2,
+                        max => 1,
+                    },
+                    likelybad     => {
+                        min => 0.5,
+                        max => 1,
+                    },
+                    verylikelybad => {
+                        min => 0.8,
+                        max => 1,
+                    },
+                },
+            },
+        },
+        priority => 20,
+    }
+
     mediawiki::import::text { 'VagrantRoleOresService':
         content => 
template('role/ores_service/VagrantRoleOresService.wiki.erb'),
     }
diff --git a/puppet/modules/wikilabels/manifests/init.pp 
b/puppet/modules/wikilabels/manifests/init.pp
index 8e73747..e5642f3 100644
--- a/puppet/modules/wikilabels/manifests/init.pp
+++ b/puppet/modules/wikilabels/manifests/init.pp
@@ -104,6 +104,7 @@
         service_params => {
             require   => [
                 VirtualEnv::Package['wikilabels'],
+                Class['mediawiki::ready_service'],
                 Exec['initialize wikilabels database'],
                 Apache::Site['wikilabels'],
             ],

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I2ea694c745f2c3e2f636ee76f839393f89107633
Gerrit-PatchSet: 10
Gerrit-Project: mediawiki/vagrant
Gerrit-Branch: master
Gerrit-Owner: Gergő Tisza <gti...@wikimedia.org>
Gerrit-Reviewer: Awight <awi...@wikimedia.org>
Gerrit-Reviewer: BryanDavis <bda...@wikimedia.org>
Gerrit-Reviewer: Dduvall <dduv...@wikimedia.org>
Gerrit-Reviewer: Ladsgroup <ladsgr...@gmail.com>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to