Erosen has submitted this change and it was merged.

Change subject: fixes celery issues; celery tests now run and pass
......................................................................


fixes celery issues; celery tests now run and pass

Change-Id: I5a35bc541a3bff103a6c8076586b5f266c0597b3
---
M tests/__init__.py
M tests/test_metrics/test_namespace_edits.py
M tests/test_queue/test_queue_setup_teardown.py
M wikimetrics/configurables.py
M wikimetrics/run.py
5 files changed, 18 insertions(+), 17 deletions(-)

Approvals:
  Erosen: Verified; Looks good to me, approved



diff --git a/tests/__init__.py b/tests/__init__.py
index 498b468..3dbeb34 100644
--- a/tests/__init__.py
+++ b/tests/__init__.py
@@ -20,20 +20,20 @@
     return False
 
 
-#def setUp():
-    #celery_out = open(devnull, "w")
-    #celery_cmd = ['wikimetrics', 'celery']
-    #global celery_proc
-    #celery_proc = Popen(celery_cmd, stdout=celery_out, stderr=celery_out)
+def setUp():
+    celery_out = open(devnull, "w")
+    celery_cmd = ['wikimetrics', 'celery']
+    global celery_proc
+    celery_proc = Popen(celery_cmd, stdout=celery_out, stderr=celery_out)
     
-    ## wait until celery broker / worker is up
-    #tries = 0
-    #while(not celery_is_alive() and tries < 20):
-        #tries += 1
-        #sleep(0.5)
+    # wait until celery broker / worker is up
+    tries = 0
+    while(not celery_is_alive() and tries < 20):
+        tries += 1
+        sleep(0.5)
 
 
-#def tearDown():
-    #global celery_proc
-    #if celery_proc is not None:
-        #celery_proc.send_signal(SIGINT)
+def tearDown():
+    global celery_proc
+    if celery_proc is not None:
+        celery_proc.send_signal(SIGINT)
diff --git a/tests/test_metrics/test_namespace_edits.py 
b/tests/test_metrics/test_namespace_edits.py
index 2228bc6..3e2f6c1 100644
--- a/tests/test_metrics/test_namespace_edits.py
+++ b/tests/test_metrics/test_namespace_edits.py
@@ -30,7 +30,6 @@
 
 
 class NamesapceEditsFullTest(QueueDatabaseTest):
-    __test__ = False
     
     def test_namespace_edits(self):
         cohort = self.session.query(Cohort).filter_by(name='test').one()
diff --git a/tests/test_queue/test_queue_setup_teardown.py 
b/tests/test_queue/test_queue_setup_teardown.py
index 00b96b5..2dfe289 100644
--- a/tests/test_queue/test_queue_setup_teardown.py
+++ b/tests/test_queue/test_queue_setup_teardown.py
@@ -1,4 +1,3 @@
-__test__ = False
 from nose.tools import assert_not_equals
 from tests.fixtures import QueueTest
 from wikimetrics.models import MetricJob
diff --git a/wikimetrics/configurables.py b/wikimetrics/configurables.py
index 2e2a644..9b57bb3 100644
--- a/wikimetrics/configurables.py
+++ b/wikimetrics/configurables.py
@@ -62,6 +62,7 @@
 
 
 def config_celery(args):
+    logger.info('about to import celery')
     from celery import Celery
     
     # create and configure celery app
diff --git a/wikimetrics/run.py b/wikimetrics/run.py
index f60f0b2..fbe841f 100644
--- a/wikimetrics/run.py
+++ b/wikimetrics/run.py
@@ -1,5 +1,6 @@
 #!/usr/bin/python
 import argparse
+import sys
 import logging
 import pprint
 from .configurables import config_web, config_db, config_celery
@@ -24,7 +25,8 @@
     from .models import ConcatMetricsJob
     from .models import MultiProjectMetricJob
     from .models import MetricJob
-    queue.start()
+    print 'queue.tasks: {0}'.format(pprint.pformat(queue.tasks))
+    queue.start(argv=['celery', 'worker'])
 
 
 def setup_parser():

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I5a35bc541a3bff103a6c8076586b5f266c0597b3
Gerrit-PatchSet: 1
Gerrit-Project: analytics/wikimetrics
Gerrit-Branch: master
Gerrit-Owner: Erosen <[email protected]>
Gerrit-Reviewer: Erosen <[email protected]>

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

Reply via email to