Skip to content

Commit

Permalink
[Python] Enable and apply pylint
Browse files Browse the repository at this point in the history
  • Loading branch information
kygx-legend committed Feb 14, 2017
1 parent 0e6d8c2 commit c20cb6f
Show file tree
Hide file tree
Showing 27 changed files with 852 additions and 372 deletions.
10 changes: 9 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ sudo: required

dist: trusty

language: python # workaround for not setting CC/CXX with default value
language: python

addons:
apt:
Expand All @@ -26,6 +26,7 @@ before_install:
- sudo apt-get -y install libboost-{chrono,program-options,date-time,thread,system,filesystem,regex,serialization}1.58{-dev,.0}

install:
# For c++ dependencies
- mkdir tmp
- cd tmp
- git clone https://github.com/zeromq/cppzmq
Expand All @@ -35,11 +36,18 @@ install:
- cd ../..
- rm -rf tmp

# For python dependencies
- pip install pylint
- pip install zmq
- pip install cloudpickle
- pip install msgpack

before_script:
- export PYHUSKY_ROOT=.
- export CLANG_FORMAT=clang-format-3.8
- ./scripts/lint.py
- ./scripts/clang-format.py -o check
- ./scripts/pylint.py

matrix:
include:
Expand Down
25 changes: 14 additions & 11 deletions python/pyhusky/backend/globalvar.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,18 @@
# See the License for the specific language governing permissions and
# limitations under the License.

import sys
import zmq

class OperationParam:
class OperationParam(object):
data_str = "data"
url_str = "url"
lambda_str = "lambda"
list_str = "list_name"

class GlobalVar:
def __init__(self):
pass

class GlobalVar(object):
actiontype = "action"
transformationtype = "transformation"
loadtype = "load"
Expand All @@ -32,7 +34,13 @@ class GlobalVar:
name_to_prefunc = dict()
name_to_postfunc = dict()

class GlobalSocket:
def __init__(self):
pass

class GlobalSocket(object):
def __init__(self):
pass

# pipe_from_cpp
# pipe_to_cpp
@staticmethod
Expand All @@ -51,18 +59,15 @@ def send(content):
def recv():
return GlobalSocket.pipe_from_cpp.recv()

# N2N
import threading

class GlobalN2NSocket:
class GlobalN2NSocket(object):
@staticmethod
def init_socket():
ctx = zmq.Context()
comm_port = int(GlobalSocket.recv()) + 1
GlobalN2NSocket.puller = ctx.socket(zmq.PULL)
GlobalN2NSocket.puller.bind("tcp://0.0.0.0:" + str(comm_port + GlobalVar.local_id))
GlobalN2NSocket.pushers = []
for i in xrange(int(GlobalSocket.recv())):
for _ in xrange(int(GlobalSocket.recv())):
host = "tcp://" + GlobalSocket.recv() + ":"
for j in xrange(int(GlobalSocket.recv())):
sock = ctx.socket(zmq.PUSH)
Expand All @@ -76,5 +81,3 @@ def send(dst, msg):
@staticmethod
def recv():
return GlobalN2NSocket.puller.recv()

# N2N
Loading

0 comments on commit c20cb6f

Please sign in to comment.