Commit 95456ff6 authored by Vincent Pelletier's avatar Vincent Pelletier

Assortment of pyflakes warnings fixes.


git-svn-id: https://svn.erp5.org/repos/neo/branches/prototype3@888 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent 4525ef98
...@@ -16,17 +16,16 @@ ...@@ -16,17 +16,16 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
import logging import logging
from time import time
from neo.config import ConfigurationManager from neo.config import ConfigurationManager
from neo.protocol import MASTER_NODE_TYPE from neo.protocol import MASTER_NODE_TYPE
from neo.node import NodeManager, MasterNode from neo.node import NodeManager, MasterNode
from neo.event import EventManager from neo.event import EventManager
from neo.connection import ListeningConnection, ClientConnection from neo.connection import ListeningConnection
from neo.exception import PrimaryFailure from neo.exception import PrimaryFailure
from neo.admin.handler import MasterMonitoringEventHandler, AdminEventHandler, \ from neo.admin.handler import MasterMonitoringEventHandler, AdminEventHandler, \
MasterEventHandler, MasterRequestEventHandler MasterEventHandler, MasterRequestEventHandler
from neo.connector import getConnectorHandler, ConnectorConnectionClosedException from neo.connector import getConnectorHandler
from neo.bootstrap import BootstrapManager from neo.bootstrap import BootstrapManager
from neo.pt import PartitionTable from neo.pt import PartitionTable
from neo import protocol from neo import protocol
......
...@@ -22,8 +22,6 @@ from neo.protocol import MASTER_NODE_TYPE, STORAGE_NODE_TYPE, CLIENT_NODE_TYPE, ...@@ -22,8 +22,6 @@ from neo.protocol import MASTER_NODE_TYPE, STORAGE_NODE_TYPE, CLIENT_NODE_TYPE,
ADMIN_NODE_TYPE, TEMPORARILY_DOWN_STATE ADMIN_NODE_TYPE, TEMPORARILY_DOWN_STATE
from neo.node import MasterNode, StorageNode, ClientNode, AdminNode from neo.node import MasterNode, StorageNode, ClientNode, AdminNode
from neo import protocol from neo import protocol
from neo.protocol import UnexpectedPacketError
from neo.pt import PartitionTable
from neo.exception import PrimaryFailure from neo.exception import PrimaryFailure
from neo.util import dump from neo.util import dump
......
...@@ -21,7 +21,6 @@ from time import sleep ...@@ -21,7 +21,6 @@ from time import sleep
from neo.handler import EventHandler from neo.handler import EventHandler
from neo.node import MasterNode from neo.node import MasterNode
from neo import protocol from neo import protocol
from neo.pt import PartitionTable
from neo.util import dump from neo.util import dump
from neo.connection import ClientConnection from neo.connection import ClientConnection
......
...@@ -16,7 +16,6 @@ ...@@ -16,7 +16,6 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
from ZODB import BaseStorage, ConflictResolution, POSException from ZODB import BaseStorage, ConflictResolution, POSException
import logging
from neo.client.app import Application from neo.client.app import Application
from neo.client.exception import NEOStorageConflictError, NEOStorageNotFoundError from neo.client.exception import NEOStorageConflictError, NEOStorageNotFoundError
......
...@@ -123,16 +123,17 @@ class PrimaryNotificationsHandler(BaseHandler): ...@@ -123,16 +123,17 @@ class PrimaryNotificationsHandler(BaseHandler):
def connectionClosed(self, conn): def connectionClosed(self, conn):
app = self.app app = self.app
if app.master_conn is not None: logging.critical("connection to primary master node closed")
assert conn is app.master_conn conn.lock()
logging.critical("connection to primary master node closed") try:
conn.lock() conn.close()
try: finally:
app.master_conn.close() conn.release()
finally: if app.master_conn is conn:
conn.release()
app.master_conn = None app.master_conn = None
app.primary_master_node = None app.primary_master_node = None
else:
logging.warn('app.master_conn is %s, but we are closing %s', app.master_conn, conn)
super(PrimaryNotificationsHandler, self).connectionClosed(conn) super(PrimaryNotificationsHandler, self).connectionClosed(conn)
def timeoutExpired(self, conn): def timeoutExpired(self, conn):
......
...@@ -24,6 +24,10 @@ __all__ = ['Lock', 'RLock'] ...@@ -24,6 +24,10 @@ __all__ = ['Lock', 'RLock']
VERBOSE_LOCKING = False VERBOSE_LOCKING = False
if VERBOSE_LOCKING: if VERBOSE_LOCKING:
import traceback
import sys
import os
class LockUser(object): class LockUser(object):
def __init__(self, level=0): def __init__(self, level=0):
self.ident = currentThread().getName() self.ident = currentThread().getName()
......
...@@ -18,11 +18,7 @@ ...@@ -18,11 +18,7 @@
import logging import logging
from neo import protocol from neo import protocol
from neo.protocol import CLIENT_NODE_TYPE, \ from neo.protocol import HIDDEN_STATE
RUNNING_STATE, BROKEN_STATE, TEMPORARILY_DOWN_STATE, \
UP_TO_DATE_STATE, FEEDING_STATE, DISCARDED_STATE, \
STORAGE_NODE_TYPE, ADMIN_NODE_TYPE, OUT_OF_DATE_STATE, \
HIDDEN_STATE, INTERNAL_ERROR_CODE
from neo.master.handlers import BaseServiceHandler from neo.master.handlers import BaseServiceHandler
from neo.protocol import UnexpectedPacketError from neo.protocol import UnexpectedPacketError
from neo.util import dump from neo.util import dump
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
import logging import logging
from neo import protocol from neo import protocol
from neo.protocol import RUNNING_STATE, BROKEN_STATE, \ from neo.protocol import RUNNING_STATE, \
TEMPORARILY_DOWN_STATE, CLIENT_NODE_TYPE, ADMIN_NODE_TYPE TEMPORARILY_DOWN_STATE, CLIENT_NODE_TYPE, ADMIN_NODE_TYPE
from neo.master.handlers import MasterHandler from neo.master.handlers import MasterHandler
from neo.protocol import UnexpectedPacketError from neo.protocol import UnexpectedPacketError
......
...@@ -18,11 +18,10 @@ ...@@ -18,11 +18,10 @@
import logging import logging
from neo import protocol from neo import protocol
from neo.protocol import CLIENT_NODE_TYPE, \ from neo.protocol import CLIENT_NODE_TYPE, RUNNING_STATE, \
RUNNING_STATE, BROKEN_STATE, TEMPORARILY_DOWN_STATE, \
UP_TO_DATE_STATE, FEEDING_STATE, DISCARDED_STATE, \ UP_TO_DATE_STATE, FEEDING_STATE, DISCARDED_STATE, \
STORAGE_NODE_TYPE, ADMIN_NODE_TYPE, OUT_OF_DATE_STATE, \ STORAGE_NODE_TYPE, OUT_OF_DATE_STATE, \
HIDDEN_STATE, INTERNAL_ERROR_CODE INTERNAL_ERROR_CODE
from neo.master.handlers import BaseServiceHandler from neo.master.handlers import BaseServiceHandler
from neo.protocol import UnexpectedPacketError from neo.protocol import UnexpectedPacketError
from neo.exception import OperationFailure from neo.exception import OperationFailure
......
...@@ -17,8 +17,7 @@ ...@@ -17,8 +17,7 @@
import logging import logging
from neo.protocol import CLIENT_NODE_TYPE, RUNNING_STATE, BROKEN_STATE, \ from neo.protocol import CLIENT_NODE_TYPE, RUNNING_STATE, ADMIN_NODE_TYPE
TEMPORARILY_DOWN_STATE, ADMIN_NODE_TYPE
from neo.master.handlers import MasterHandler from neo.master.handlers import MasterHandler
from neo.exception import VerificationFailure from neo.exception import VerificationFailure
from neo.util import dump from neo.util import dump
......
...@@ -16,7 +16,6 @@ ...@@ -16,7 +16,6 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
import neo.pt import neo.pt
from neo import protocol
from struct import pack, unpack from struct import pack, unpack
from neo.protocol import OUT_OF_DATE_STATE, FEEDING_STATE, \ from neo.protocol import OUT_OF_DATE_STATE, FEEDING_STATE, \
DISCARDED_STATE, RUNNING_STATE, BROKEN_STATE DISCARDED_STATE, RUNNING_STATE, BROKEN_STATE
......
...@@ -20,7 +20,6 @@ import logging ...@@ -20,7 +20,6 @@ import logging
from neo.protocol import node_types, node_states from neo.protocol import node_types, node_states
from neo.event import EventManager from neo.event import EventManager
from neo.connection import ClientConnection from neo.connection import ClientConnection
from neo.exception import OperationFailure
from neo.neoctl.handler import CommandEventHandler from neo.neoctl.handler import CommandEventHandler
from neo.connector import getConnectorHandler from neo.connector import getConnectorHandler
from neo.util import bin from neo.util import bin
......
...@@ -18,7 +18,6 @@ ...@@ -18,7 +18,6 @@
from time import time from time import time
import logging import logging
from neo import protocol
from neo.protocol import RUNNING_STATE, TEMPORARILY_DOWN_STATE, DOWN_STATE, \ from neo.protocol import RUNNING_STATE, TEMPORARILY_DOWN_STATE, DOWN_STATE, \
BROKEN_STATE, PENDING_STATE, HIDDEN_STATE, MASTER_NODE_TYPE, \ BROKEN_STATE, PENDING_STATE, HIDDEN_STATE, MASTER_NODE_TYPE, \
STORAGE_NODE_TYPE, CLIENT_NODE_TYPE, ADMIN_NODE_TYPE, \ STORAGE_NODE_TYPE, CLIENT_NODE_TYPE, ADMIN_NODE_TYPE, \
......
...@@ -17,7 +17,6 @@ ...@@ -17,7 +17,6 @@
import logging import logging
from neo import protocol
from neo.protocol import UP_TO_DATE_STATE, OUT_OF_DATE_STATE, FEEDING_STATE, \ from neo.protocol import UP_TO_DATE_STATE, OUT_OF_DATE_STATE, FEEDING_STATE, \
DISCARDED_STATE, RUNNING_STATE, TEMPORARILY_DOWN_STATE, DOWN_STATE, \ DISCARDED_STATE, RUNNING_STATE, TEMPORARILY_DOWN_STATE, DOWN_STATE, \
BROKEN_STATE, VALID_CELL_STATE_LIST, HIDDEN_STATE, PENDING_STATE BROKEN_STATE, VALID_CELL_STATE_LIST, HIDDEN_STATE, PENDING_STATE
......
...@@ -17,8 +17,6 @@ ...@@ -17,8 +17,6 @@
import logging import logging
import sys import sys
from time import time
from struct import unpack
from collections import deque from collections import deque
from neo.config import ConfigurationManager from neo.config import ConfigurationManager
...@@ -28,7 +26,7 @@ from neo.protocol import TEMPORARILY_DOWN_STATE, \ ...@@ -28,7 +26,7 @@ from neo.protocol import TEMPORARILY_DOWN_STATE, \
from neo.node import NodeManager, MasterNode, StorageNode from neo.node import NodeManager, MasterNode, StorageNode
from neo.event import EventManager from neo.event import EventManager
from neo.storage.mysqldb import MySQLDatabaseManager from neo.storage.mysqldb import MySQLDatabaseManager
from neo.connection import ListeningConnection, ClientConnection from neo.connection import ListeningConnection
from neo.exception import OperationFailure, PrimaryFailure from neo.exception import OperationFailure, PrimaryFailure
from neo.storage import handlers from neo.storage import handlers
from neo.storage.replicator import Replicator from neo.storage.replicator import Replicator
......
...@@ -19,8 +19,7 @@ import logging ...@@ -19,8 +19,7 @@ import logging
from neo.handler import EventHandler from neo.handler import EventHandler
from neo import protocol from neo import protocol
from neo.protocol import Packet, UnexpectedPacketError, \ from neo.protocol import RUNNING_STATE, BROKEN_STATE, \
RUNNING_STATE, BROKEN_STATE, \
MASTER_NODE_TYPE, STORAGE_NODE_TYPE, CLIENT_NODE_TYPE, \ MASTER_NODE_TYPE, STORAGE_NODE_TYPE, CLIENT_NODE_TYPE, \
DOWN_STATE, TEMPORARILY_DOWN_STATE, HIDDEN_STATE DOWN_STATE, TEMPORARILY_DOWN_STATE, HIDDEN_STATE
from neo.util import dump from neo.util import dump
......
...@@ -19,8 +19,6 @@ import logging ...@@ -19,8 +19,6 @@ import logging
from neo import protocol from neo import protocol
from neo.storage.handlers import BaseClientAndStorageOperationHandler from neo.storage.handlers import BaseClientAndStorageOperationHandler
from neo.protocol import INVALID_PARTITION, \
TEMPORARILY_DOWN_STATE, DISCARDED_STATE, OUT_OF_DATE_STATE
from neo.util import dump from neo.util import dump
......
...@@ -18,13 +18,11 @@ ...@@ -18,13 +18,11 @@
import logging import logging
from neo.storage.handlers import BaseMasterHandler from neo.storage.handlers import BaseMasterHandler
from neo.protocol import Packet, \ from neo.protocol import BROKEN_STATE, \
RUNNING_STATE, BROKEN_STATE, \ MASTER_NODE_TYPE, STORAGE_NODE_TYPE, \
MASTER_NODE_TYPE, STORAGE_NODE_TYPE, CLIENT_NODE_TYPE, \
DOWN_STATE, TEMPORARILY_DOWN_STATE, HIDDEN_STATE, \ DOWN_STATE, TEMPORARILY_DOWN_STATE, HIDDEN_STATE, \
DISCARDED_STATE, OUT_OF_DATE_STATE, UnexpectedPacketError DISCARDED_STATE, OUT_OF_DATE_STATE, UnexpectedPacketError
from neo.node import StorageNode from neo.node import StorageNode
from neo.connection import ClientConnection
from neo import decorators from neo import decorators
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
import logging import logging
from neo.storage.handlers import BaseStorageHandler from neo.storage.handlers import BaseStorageHandler
from neo.protocol import BROKEN_STATE, STORAGE_NODE_TYPE, CLIENT_NODE_TYPE from neo.protocol import BROKEN_STATE, STORAGE_NODE_TYPE
from neo import protocol from neo import protocol
from neo.util import dump from neo.util import dump
from neo.node import ClientNode from neo.node import ClientNode
...@@ -54,7 +54,7 @@ class IdentificationHandler(BaseStorageHandler): ...@@ -54,7 +54,7 @@ class IdentificationHandler(BaseStorageHandler):
from neo.storage.handlers.storage import StorageOperationHandler from neo.storage.handlers.storage import StorageOperationHandler
handler = StorageOperationHandler handler = StorageOperationHandler
else: else:
raise protocol.protocolError('reject non-client-or-storage node') raise protocol.ProtocolError('reject non-client-or-storage node')
if node is None: if node is None:
logging.error('reject an unknown node %s', dump(uuid)) logging.error('reject an unknown node %s', dump(uuid))
raise protocol.NotReadyError raise protocol.NotReadyError
......
...@@ -20,9 +20,8 @@ import logging ...@@ -20,9 +20,8 @@ import logging
from neo import protocol from neo import protocol
from neo.storage.handlers import BaseMasterHandler from neo.storage.handlers import BaseMasterHandler
from neo.protocol import TEMPORARILY_DOWN_STATE, DISCARDED_STATE, OUT_OF_DATE_STATE from neo.protocol import TEMPORARILY_DOWN_STATE, DISCARDED_STATE, OUT_OF_DATE_STATE
from neo.util import dump
from neo.node import StorageNode from neo.node import StorageNode
from neo.exception import PrimaryFailure, OperationFailure from neo.exception import OperationFailure
class MasterOperationHandler(BaseMasterHandler): class MasterOperationHandler(BaseMasterHandler):
......
...@@ -15,12 +15,9 @@ ...@@ -15,12 +15,9 @@
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
import logging
from neo import protocol from neo import protocol
from neo.storage.handlers import BaseClientAndStorageOperationHandler from neo.storage.handlers import BaseClientAndStorageOperationHandler
class StorageOperationHandler(BaseClientAndStorageOperationHandler): class StorageOperationHandler(BaseClientAndStorageOperationHandler):
def connectionCompleted(self, conn): def connectionCompleted(self, conn):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment