Gilles has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/335442 )

Change subject: Upgrade to 0.1.34
......................................................................

Upgrade to 0.1.34

Bug: T156913
Change-Id: I46408b0e381ff1c57a06e407fb44f9ed52b70a35
---
M debian/changelog
M tests/integration/test_proxy_loader.py
D tests/integration/thumbnails/300px--Shakinghands_high.OGG.jpg
M wikimedia_thumbor/loader/video/__init__.py
M wikimedia_thumbor/result_storage/swift/swift.py
M wikimedia_thumbor/shell_runner/__init__.py
6 files changed, 39 insertions(+), 40 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/operations/debs/python-thumbor-wikimedia 
refs/changes/42/335442/1

diff --git a/debian/changelog b/debian/changelog
index 1768f1f..f30cd26 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+python-thumbor-wikimedia (0.1.34-1) jessie-wikimedia; urgency=low
+
+  * New upstream release
+
+ -- Gilles Dubuc <[email protected]>  Wed, 1 Feb 2017 14:06:00 +0000
+
 python-thumbor-wikimedia (0.1.33-1) jessie-wikimedia; urgency=low
 
   * New upstream release
diff --git a/tests/integration/test_proxy_loader.py 
b/tests/integration/test_proxy_loader.py
index 235ec68..2fc012a 100644
--- a/tests/integration/test_proxy_loader.py
+++ b/tests/integration/test_proxy_loader.py
@@ -26,14 +26,6 @@
             1.0,
         )
 
-    def test_proxied_uppercase_ogg(self):
-        self.run_and_check_ssim_and_size(
-            
'thumbor/unsafe/300x/https://upload.wikimedia.org/wikipedia/commons/f/f2/Shakinghands_high.OGG',
-            '300px--Shakinghands_high.OGG.jpg',
-            0.96,
-            1.1
-        )
-
     def test_proxied_gif(self):
         self.run_and_check_ssim_and_size(
             
'thumbor/unsafe/300x/https://upload.wikimedia.org/wikipedia/commons/f/fb/Pacific-Electric-Red-Cars-Awaiting-Destruction.gif',
diff --git a/tests/integration/thumbnails/300px--Shakinghands_high.OGG.jpg 
b/tests/integration/thumbnails/300px--Shakinghands_high.OGG.jpg
deleted file mode 100644
index fbb6596..0000000
--- a/tests/integration/thumbnails/300px--Shakinghands_high.OGG.jpg
+++ /dev/null
Binary files differ
diff --git a/wikimedia_thumbor/loader/video/__init__.py 
b/wikimedia_thumbor/loader/video/__init__.py
index 3ff0458..b0657b0 100644
--- a/wikimedia_thumbor/loader/video/__init__.py
+++ b/wikimedia_thumbor/loader/video/__init__.py
@@ -110,6 +110,8 @@
         result = LoaderResult()
 
         _http_code_from_stderr(process, result)
+        process.stdout.close()
+        process.stderr.close()
 
         callback(result)
     else:
@@ -121,6 +123,9 @@
                 callback
             )
         )
+
+        process.stdout.close()
+        process.stderr.close()
 
 
 def _parse_time(context, url, callback, output):
@@ -202,6 +207,9 @@
         result.successful = True
         result.buffer = output_file.read()
 
+    process.stdout.close()
+    process.stderr.close()
+
     output_file.close()
 
     try:
diff --git a/wikimedia_thumbor/result_storage/swift/swift.py 
b/wikimedia_thumbor/result_storage/swift/swift.py
index ff6939e..2878221 100644
--- a/wikimedia_thumbor/result_storage/swift/swift.py
+++ b/wikimedia_thumbor/result_storage/swift/swift.py
@@ -19,23 +19,27 @@
 
 
 class Storage(BaseStorage):
-    def __init__(self, context):
-        super(Storage, self).__init__(context)
+    swiftconn = None
+
+    @property
+    def swift(self):
+        if Storage.swiftconn:
+            return Storage.swiftconn
 
         authurl = (
             self.context.config.SWIFT_HOST +
             self.context.config.SWIFT_AUTH_PATH
         )
 
-        # Doesn't actually connect, this happens lazily on the first
-        # get_object or put_object call
-        self.swift = client.Connection(
+        swiftconn = client.Connection(
             user=self.context.config.SWIFT_USER,
             key=self.context.config.SWIFT_KEY,
             authurl=authurl,
             timeout=self.context.config.SWIFT_CONNECTION_TIMEOUT,
             retries=self.context.config.SWIFT_RETRIES
         )
+
+        return Storage.swiftconn
 
     def uri(self):  # pragma: no cover
         return (
@@ -48,7 +52,7 @@
     # Coverage strangely reports lines lacking coverage in that function that
     # don't make sense
     def put(self, bytes):  # pragma: no cover
-        logger.debug('[Swift] put')
+        logger.debug('[SWIFT_STORAGE] put')
 
         if not hasattr(self.context, 'wikimedia_thumbnail_container'):
             return
@@ -75,13 +79,13 @@
             # headers, because the response has already been sent when saving
             # to Swift happens (which is the right thing to do).
         except Exception as e:
-            logger.error('[Swift] put exception: %r' % e)
+            logger.error('[SWIFT_STORAGE] put exception: %r' % e)
             # We cannnot let exceptions bubble up, because they would leave
             # the client's connection hanging
 
     @return_future
     def get(self, callback):
-        logger.debug('[Swift] get: %r %r' % (
+        logger.debug('[SWIFT_STORAGE] get: %r %r' % (
                 self.context.wikimedia_thumbnail_container,
                 self.context.wikimedia_thumbnail_save_path
             )
@@ -106,7 +110,7 @@
                 'Swift-Time', duration
             )
 
-            logger.debug('[Swift] found')
+            logger.debug('[SWIFT_STORAGE] found')
             callback(data)
         # We want this to be exhaustive because not catching an exception here
         # would result in the request hanging indefinitely
@@ -114,9 +118,9 @@
             logging.disable(logging.NOTSET)
             # No need to log this one, it's expected behavior when the
             # requested object isn't there
-            logger.debug('[Swift] missing')
+            logger.debug('[SWIFT_STORAGE] missing')
             callback(None)
         except Exception as e:
             logging.disable(logging.NOTSET)
-            logger.error('[Swift] get exception: %r' % e)
+            logger.error('[SWIFT_STORAGE] get exception: %r' % e)
             callback(None)
diff --git a/wikimedia_thumbor/shell_runner/__init__.py 
b/wikimedia_thumbor/shell_runner/__init__.py
index 523e543..9abb9bf 100644
--- a/wikimedia_thumbor/shell_runner/__init__.py
+++ b/wikimedia_thumbor/shell_runner/__init__.py
@@ -49,7 +49,7 @@
             tasks.write('%s\n' % pid)
 
     @classmethod
-    def popen(cls, command, context, stdin=None, env=None):
+    def popen(cls, command, context, env=None):
         wrapped_command = ShellRunner.wrap_command(
             command,
             context
@@ -62,32 +62,21 @@
         if env is not None:  # pragma: no cover
             combined_env.update(env)
 
-        if stdin is None:
-            proc = subprocess.Popen(
-                wrapped_command,
-                stdout=subprocess.PIPE,
-                stderr=subprocess.PIPE,
-                env=combined_env,
-                preexec_fn=partial(cls.preexec, context)
-            )
-        else:  # pragma: no cover
-            proc = subprocess.Popen(
-                wrapped_command,
-                stdout=subprocess.PIPE,
-                stdin=subprocess.PIPE,
-                stderr=subprocess.PIPE,
-                env=combined_env,
-                preexec_fn=partial(cls.preexec, context)
-            )
-            proc.stdin.write(stdin)
+        proc = subprocess.Popen(
+            wrapped_command,
+            stdout=subprocess.PIPE,
+            stderr=subprocess.PIPE,
+            env=combined_env,
+            preexec_fn=partial(cls.preexec, context)
+        )
 
         return proc
 
     @classmethod
-    def command(cls, command, context, stdin=None, env=None):
+    def command(cls, command, context, env=None):
         start = datetime.datetime.now()
 
-        proc = cls.popen(command, context, stdin, env)
+        proc = cls.popen(command, context, env)
 
         stdout, stderr = proc.communicate()
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I46408b0e381ff1c57a06e407fb44f9ed52b70a35
Gerrit-PatchSet: 1
Gerrit-Project: operations/debs/python-thumbor-wikimedia
Gerrit-Branch: master
Gerrit-Owner: Gilles <[email protected]>

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

Reply via email to