Skip to content

Commit

Permalink
Port pantsd/ to python3 (#6136)
Browse files Browse the repository at this point in the history
  • Loading branch information
ghthor authored and jsirois committed Jul 21, 2018
1 parent f31e54b commit 7ad0298
Show file tree
Hide file tree
Showing 14 changed files with 22 additions and 6 deletions.
4 changes: 4 additions & 0 deletions src/python/pants/pantsd/BUILD
Expand Up @@ -5,6 +5,7 @@ python_library(
name = 'process_manager',
sources = ['process_manager.py'],
dependencies = [
'3rdparty/python:future',
'3rdparty/python:psutil',
'src/python/pants/base:build_environment',
'src/python/pants/process',
Expand All @@ -28,6 +29,7 @@ python_library(
name = 'watchman',
sources = ['watchman.py'],
dependencies = [
'3rdparty/python:future',
'src/python/pants/util:dirutil',
'src/python/pants/util:retry',
':process_manager',
Expand All @@ -39,6 +41,7 @@ python_library(
name = 'watchman_launcher',
sources = ['watchman_launcher.py'],
dependencies = [
'3rdparty/python:future',
':watchman',
'src/python/pants/binaries',
'src/python/pants/util:memo',
Expand All @@ -57,6 +60,7 @@ python_library(
name = 'pants_daemon',
sources = ['pants_daemon.py'],
dependencies = [
'3rdparty/python:future',
'3rdparty/python:setproctitle',
'src/python/pants/base:build_environment',
'src/python/pants/base:exiter',
Expand Down
1 change: 1 addition & 0 deletions src/python/pants/pantsd/pants_daemon.py
Expand Up @@ -8,6 +8,7 @@
import os
import sys
import threading
from builtins import object
from contextlib import contextmanager

from setproctitle import setproctitle as set_process_title
Expand Down
1 change: 1 addition & 0 deletions src/python/pants/pantsd/process_manager.py
Expand Up @@ -9,6 +9,7 @@
import signal
import time
import traceback
from builtins import object, str
from contextlib import contextmanager

import psutil
Expand Down
2 changes: 2 additions & 0 deletions src/python/pants/pantsd/service/BUILD
Expand Up @@ -32,6 +32,7 @@ python_library(
name = 'scheduler_service',
sources = ['scheduler_service.py'],
dependencies = [
'3rdparty/python:future',
'3rdparty/python/twitter/commons:twitter.common.dirutil',
':pants_service'
]
Expand All @@ -41,6 +42,7 @@ python_library(
name = 'store_gc_service',
sources = ['store_gc_service.py'],
dependencies = [
'3rdparty/python:future',
':pants_service',
]
)
2 changes: 1 addition & 1 deletion src/python/pants/pantsd/service/fs_event_service.py
Expand Up @@ -130,7 +130,7 @@ def run(self):

futures = {}
id_counter = 0
subscriptions = self._handlers.values()
subscriptions = list(self._handlers.values())

# Setup subscriptions and begin the main event firing loop.
for handler_name, event_data in self._watchman.subscribed(self._build_root, subscriptions):
Expand Down
6 changes: 3 additions & 3 deletions src/python/pants/pantsd/service/scheduler_service.py
Expand Up @@ -6,7 +6,7 @@

import logging
import os
import Queue
import queue
import threading

from twitter.common.dirutil import Fileset
Expand Down Expand Up @@ -52,7 +52,7 @@ def __init__(

self._scheduler = legacy_graph_scheduler.scheduler
self._logger = logging.getLogger(__name__)
self._event_queue = Queue.Queue(maxsize=self.QUEUE_SIZE)
self._event_queue = queue.Queue(maxsize=self.QUEUE_SIZE)
self._watchman_is_running = threading.Event()
self._invalidating_files = set()

Expand Down Expand Up @@ -125,7 +125,7 @@ def _process_event_queue(self):
"""File event notification queue processor."""
try:
event = self._event_queue.get(timeout=1)
except Queue.Empty:
except queue.Empty:
return

try:
Expand Down
1 change: 1 addition & 0 deletions src/python/pants/pantsd/watchman.py
Expand Up @@ -8,6 +8,7 @@
import json
import logging
import os
from builtins import str
from collections import namedtuple

from pants.pantsd.process_manager import ProcessManager
Expand Down
1 change: 1 addition & 0 deletions src/python/pants/pantsd/watchman_launcher.py
Expand Up @@ -5,6 +5,7 @@
from __future__ import absolute_import, division, print_function, unicode_literals

import logging
from builtins import object

from pants.binaries.binary_util import BinaryToolFetcher, BinaryUtil
from pants.pantsd.watchman import Watchman
Expand Down
1 change: 1 addition & 0 deletions tests/python/pants_test/pantsd/BUILD
Expand Up @@ -45,6 +45,7 @@ python_tests(
sources = ['test_pailgun_server.py'],
coverage = ['pants.pantsd.pailgun_server'],
dependencies = [
'3rdparty/python:future',
':test_deps',
'src/python/pants/pantsd:pailgun_server'
]
Expand Down
2 changes: 2 additions & 0 deletions tests/python/pants_test/pantsd/service/BUILD
Expand Up @@ -16,6 +16,7 @@ python_tests(
sources = ['test_fs_event_service.py'],
coverage = ['pants.pantsd.service.fs_event_service'],
dependencies = [
'3rdparty/python:future',
'tests/python/pants_test/pantsd:test_deps',
'src/python/pants/pantsd/service:fs_event_service'
]
Expand All @@ -26,6 +27,7 @@ python_tests(
sources = ['test_pailgun_service.py'],
coverage = ['pants.pantsd.service.pailgun_service'],
dependencies = [
'3rdparty/python:future',
'tests/python/pants_test/pantsd:test_deps',
'src/python/pants/pantsd/service:pailgun_service'
]
Expand Down
Expand Up @@ -4,6 +4,7 @@

from __future__ import absolute_import, division, print_function, unicode_literals

from builtins import object
from collections import namedtuple
from contextlib import contextmanager

Expand Down
Expand Up @@ -5,6 +5,7 @@
from __future__ import absolute_import, division, print_function, unicode_literals

import unittest
from builtins import object

import mock

Expand Down
4 changes: 2 additions & 2 deletions tests/python/pants_test/pantsd/test_pailgun_server.py
Expand Up @@ -8,7 +8,7 @@
import threading
import unittest
from contextlib import contextmanager
from SocketServer import TCPServer
from socketserver import TCPServer

import mock

Expand Down Expand Up @@ -81,7 +81,7 @@ def test_handle_error(self):
self.handler.handle_error()
last_chunk_type, last_payload = list(NailgunProtocol.iter_chunks(self.client_sock))[-1]
self.assertEquals(last_chunk_type, ChunkType.EXIT)
self.assertEquals(bytes(last_payload), '1')
self.assertEquals(last_payload, '1')

@mock.patch.object(PailgunHandler, '_run_pants', **PATCH_OPTS)
def test_handle_request(self, mock_run_pants):
Expand Down
1 change: 1 addition & 0 deletions tests/python/pants_test/pantsd/test_pantsd_integration.py
Expand Up @@ -10,6 +10,7 @@
import signal
import threading
import time
from builtins import range, zip
from concurrent.futures import ThreadPoolExecutor
from contextlib import contextmanager

Expand Down

0 comments on commit 7ad0298

Please sign in to comment.