Commit db8450ca authored by Vincent Pelletier's avatar Vincent Pelletier

Fix (some) pyflakes warnings in master and admin node code.


git-svn-id: https://svn.erp5.org/repos/neo/branches/prototype3@779 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent 122585cf
......@@ -16,20 +16,16 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
import logging
import os
from time import time
from struct import unpack
from collections import deque
from neo.config import ConfigurationManager
from neo.protocol import TEMPORARILY_DOWN_STATE, DOWN_STATE, BROKEN_STATE, \
INVALID_UUID, INVALID_PTID, partition_cell_states, MASTER_NODE_TYPE
from neo.node import NodeManager, MasterNode, StorageNode, ClientNode, AdminNode
from neo.protocol import INVALID_UUID, INVALID_PTID, MASTER_NODE_TYPE
from neo.node import NodeManager, MasterNode
from neo.event import EventManager
from neo.connection import ListeningConnection, ClientConnection
from neo.exception import OperationFailure, PrimaryFailure
from neo.exception import PrimaryFailure
from neo.admin.handler import MasterMonitoringEventHandler, AdminEventHandler, \
MasterBootstrapEventHandler, MasterRequestEventHandler, MasterEventHandler
MasterBootstrapEventHandler, MasterRequestEventHandler
from neo.connector import getConnectorHandler
from neo import protocol
......@@ -192,7 +188,7 @@ class Application(object):
pass
row_list.append((offset, row))
except IndexError:
p = protocot.protocolError('invalid partition table offset')
p = protocol.protocolError('invalid partition table offset')
conn.notify(p)
return
p = protocol.answerPartitionList(self.ptid, row_list)
......
......@@ -18,17 +18,16 @@
import logging
from neo.handler import EventHandler
from neo.protocol import INVALID_UUID, RUNNING_STATE, BROKEN_STATE, \
from neo.protocol import INVALID_UUID, \
MASTER_NODE_TYPE, STORAGE_NODE_TYPE, CLIENT_NODE_TYPE, \
ADMIN_NODE_TYPE, DISCARDED_STATE, TEMPORARILY_DOWN_STATE, DOWN_STATE
from neo.node import MasterNode, StorageNode, ClientNode
from neo.connection import ClientConnection
ADMIN_NODE_TYPE, TEMPORARILY_DOWN_STATE
from neo.node import MasterNode, StorageNode, ClientNode, AdminNode
from neo import protocol
from neo.protocol import Packet, UnexpectedPacketError
from neo.protocol import UnexpectedPacketError
from neo.pt import PartitionTable
from neo.exception import PrimaryFailure
from neo.util import dump
from neo import decorators, handler
from neo import decorators
class BaseEventHandler(EventHandler):
......
......@@ -22,9 +22,9 @@ from struct import pack, unpack
from neo.config import ConfigurationManager
from neo import protocol
from neo.protocol import Packet, \
RUNNING_STATE, TEMPORARILY_DOWN_STATE, DOWN_STATE, BROKEN_STATE, \
PENDING_STATE, INVALID_UUID, INVALID_OID, INVALID_TID, INVALID_PTID, \
from neo.protocol import \
RUNNING_STATE, TEMPORARILY_DOWN_STATE, DOWN_STATE, \
INVALID_UUID, INVALID_OID, INVALID_TID, INVALID_PTID, \
CLIENT_NODE_TYPE, MASTER_NODE_TYPE, STORAGE_NODE_TYPE, \
UUID_NAMESPACES, ADMIN_NODE_TYPE, BOOTING
from neo.node import NodeManager, MasterNode, StorageNode, ClientNode, AdminNode
......@@ -39,10 +39,10 @@ from neo.master.recovery import RecoveryEventHandler
from neo.master.verification import VerificationEventHandler
from neo.master.service import ClientServiceEventHandler, StorageServiceEventHandler
from neo.master.secondary import PrimaryMasterEventHandler, SecondaryMasterEventHandler
from neo.master.shutdown import ShutdownEventHandler
from neo.master.pt import PartitionTable
from neo.util import dump
from neo.connector import getConnectorHandler
from neo.master import ENABLE_PENDING_NODES
class Application(object):
"""The master node application."""
......@@ -828,7 +828,7 @@ class Application(object):
while 1:
self.em.poll(1)
if len(self.finishing_transaction_dict) == 0:
if self.cluster_state == RUNNING:
if self.cluster_state == protocol.RUNNING:
sys.exit("Application has been asked to shut down")
else:
# no more transaction, ask clients to shutdown
......
......@@ -20,13 +20,11 @@ import logging
from neo import protocol
from neo.protocol import MASTER_NODE_TYPE, \
RUNNING_STATE, BROKEN_STATE, TEMPORARILY_DOWN_STATE, \
DOWN_STATE, ADMIN_NODE_TYPE
DOWN_STATE
from neo.master.handler import MasterEventHandler
from neo.connection import ClientConnection
from neo.exception import ElectionFailure
from neo.protocol import Packet, UnexpectedPacketError, INVALID_UUID
from neo.node import MasterNode, StorageNode, ClientNode
from neo import decorators
from neo.protocol import INVALID_UUID
from neo.node import MasterNode
class ElectionEventHandler(MasterEventHandler):
"""This class deals with events for a primary master election."""
......
......@@ -19,9 +19,7 @@ import logging
from neo import protocol
from neo.handler import EventHandler
from neo.protocol import INVALID_UUID, BROKEN_STATE, ADMIN_NODE_TYPE
from neo import protocol
from neo import util
from neo.protocol import INVALID_UUID, BROKEN_STATE
class MasterEventHandler(EventHandler):
"""This class implements a generic part of the event handlers."""
......
......@@ -15,8 +15,6 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
import logging
import neo.pt
from neo import protocol
from struct import pack, unpack
......
......@@ -18,13 +18,11 @@
import logging
from neo import protocol
from neo.protocol import MASTER_NODE_TYPE, \
RUNNING_STATE, BROKEN_STATE, TEMPORARILY_DOWN_STATE, DOWN_STATE, \
STORAGE_NODE_TYPE, CLIENT_NODE_TYPE, ADMIN_NODE_TYPE
from neo.protocol import RUNNING_STATE, BROKEN_STATE, \
TEMPORARILY_DOWN_STATE, CLIENT_NODE_TYPE, ADMIN_NODE_TYPE
from neo.master.handler import MasterEventHandler
from neo.exception import ElectionFailure
from neo.protocol import Packet, UnexpectedPacketError, INVALID_UUID, INVALID_PTID
from neo.node import ClientNode, StorageNode, MasterNode, AdminNode
from neo.protocol import UnexpectedPacketError, INVALID_UUID, INVALID_PTID
from neo.node import StorageNode
from neo.util import dump
class RecoveryEventHandler(MasterEventHandler):
......
......@@ -17,13 +17,11 @@
import logging
from neo import protocol
from neo.protocol import MASTER_NODE_TYPE, \
RUNNING_STATE, BROKEN_STATE, TEMPORARILY_DOWN_STATE, \
DOWN_STATE, ADMIN_NODE_TYPE
RUNNING_STATE, BROKEN_STATE, DOWN_STATE
from neo.master.handler import MasterEventHandler
from neo.exception import ElectionFailure, PrimaryFailure
from neo.protocol import Packet, UnexpectedPacketError, INVALID_UUID
from neo.protocol import UnexpectedPacketError, INVALID_UUID
from neo.node import MasterNode
class SecondaryMasterEventHandler(MasterEventHandler):
......
......@@ -19,10 +19,10 @@ import logging
from neo import protocol
from neo.protocol import CLIENT_NODE_TYPE, \
RUNNING_STATE, BROKEN_STATE, TEMPORARILY_DOWN_STATE, DOWN_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, PENDING_STATE, INVALID_UUID
HIDDEN_STATE, INVALID_UUID, INTERNAL_ERROR_CODE
from neo.master.handler import MasterEventHandler
from neo.protocol import UnexpectedPacketError
from neo.exception import OperationFailure
......
......@@ -17,8 +17,11 @@
import logging
from neo import protocol
from eno.protocol import CLIENT_NODE_TYPE, ADMIN_NODE_TYPE, INVALID_UUID, \
RUNNING_STATE, STORAGE_NODE_TYPE, TEMPORARILY_DOWN_STATE, STOPPING
from neo.master.service import ServiceEventHandler
from neo.protocol import BOOTING
from neo import decorators
from neo.util import dump
class ShutdownEventHandler(ServiceEventHandler):
"""This class deals with events for a shutting down phase."""
......@@ -34,8 +37,8 @@ class ShutdownEventHandler(ServiceEventHandler):
logging.error('reject any new demand for primary master')
raise protocol.ProtocolError('cluster is shutting down')
@identification_required
@restrict_node_types(CLIENT_NODE_TYPE)
@decorators.identification_required
@decorators.restrict_node_types(CLIENT_NODE_TYPE)
def handleAskNewTID(self, conn, packet):
logging.error('reject any new demand for new tid')
raise protocol.ProtocolError('cluster is shutting down')
......
......@@ -17,15 +17,12 @@
import logging
from neo import protocol
from neo.protocol import MASTER_NODE_TYPE, STORAGE_NODE_TYPE, CLIENT_NODE_TYPE, \
RUNNING_STATE, BROKEN_STATE, TEMPORARILY_DOWN_STATE, DOWN_STATE, \
PENDING_STATE, ADMIN_NODE_TYPE
from neo.protocol import CLIENT_NODE_TYPE, RUNNING_STATE, BROKEN_STATE, \
TEMPORARILY_DOWN_STATE, ADMIN_NODE_TYPE
from neo.master.handler import MasterEventHandler
from neo.exception import VerificationFailure, ElectionFailure
from neo.protocol import Packet, UnexpectedPacketError, INVALID_UUID
from neo.exception import VerificationFailure
from neo.protocol import INVALID_UUID
from neo.util import dump
from neo.node import ClientNode, StorageNode, MasterNode, AdminNode
class VerificationEventHandler(MasterEventHandler):
"""This class deals with events for a verification phase."""
......
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