# Path: pylm/servers.py
# class Master(ServerTemplate, BaseMaster):
#     """
#     Standalone master server, intended to send workload to workers.
# 
#     :param name: Name of the server
#     :param pull_address: Valid address for the pull service
#     :param pub_address: Valid address for the pub service
#     :param worker_pull_address: Valid address for the pull-from-workers service
#     :param worker_push_address: Valid address for the push-to-workers service
#     :param db_address: Valid address to bind the Cache service
#     :param pipelined: The output connects to a Pipeline or a Hub.
#     :param cache: Key-value embeddable database. Pick from one of the
#         supported ones
#     :param log_level: Logging level
# 
#     """
#     def __init__(self, name: str, pull_address: str, pub_address: str,
#                  worker_pull_address: str, worker_push_address: str,
#                  db_address: str, pipelined: bool=False,
#                  cache: object = DictDB(), log_level: int = logging.INFO):
#         super(Master, self).__init__(logging_level=log_level)
#         self.name = name
#         self.cache = cache
#         self.pipelined = pipelined
# 
#         self.register_inbound(
#             PullService, 'Pull', pull_address, route='WorkerPush')
#         self.register_inbound(
#             WorkerPullService, 'WorkerPull', worker_pull_address, route='Pub')
#         self.register_outbound(
#             WorkerPushService, 'WorkerPush', worker_push_address)
#         self.register_outbound(
#             PubService, 'Pub', pub_address, log='to_sink',
#             pipelined=pipelined, server=self.name)
#         self.register_bypass(
#             CacheService, 'Cache', db_address)
#         self.preset_cache(name=name,
#                           db_address=db_address,
#                           pull_address=pull_address,
#                           pub_address=pub_address,
#                           worker_pull_address=worker_pull_address,
#                           worker_push_address=worker_push_address)
# 
#         # Monkey patches the scatter and gather functions to the
#         # scatter function of Push and Pull parts respectively.
#         self.inbound_components['Pull'].scatter = self.scatter
#         self.outbound_components['Pub'].scatter = self.gather
#         self.outbound_components['Pub'].handle_stream = self.handle_stream


from pylm.servers import Master

server = Master(name='server',
                pull_address='tcp://127.0.0.1:5555',
                pub_address='tcp://127.0.0.1:5556',
                worker_pull_address='tcp://127.0.0.1:5557',
                worker_push_address='tcp://127.0.0.1:5558',

# Path: pylm/servers.py
# class Master(ServerTemplate, BaseMaster):
#     """
#     Standalone master server, intended to send workload to workers.
# 
#     :param name: Name of the server
#     :param pull_address: Valid address for the pull service
#     :param pub_address: Valid address for the pub service
#     :param worker_pull_address: Valid address for the pull-from-workers service
#     :param worker_push_address: Valid address for the push-to-workers service
#     :param db_address: Valid address to bind the Cache service
#     :param pipelined: The output connects to a Pipeline or a Hub.
#     :param cache: Key-value embeddable database. Pick from one of the
#         supported ones
#     :param log_level: Logging level
# 
#     """
#     def __init__(self, name: str, pull_address: str, pub_address: str,
#                  worker_pull_address: str, worker_push_address: str,
#                  db_address: str, pipelined: bool=False,
#                  cache: object = DictDB(), log_level: int = logging.INFO):
#         super(Master, self).__init__(logging_level=log_level)
#         self.name = name
#         self.cache = cache
#         self.pipelined = pipelined
# 
#         self.register_inbound(
#             PullService, 'Pull', pull_address, route='WorkerPush')
#         self.register_inbound(
#             WorkerPullService, 'WorkerPull', worker_pull_address, route='Pub')
#         self.register_outbound(
#             WorkerPushService, 'WorkerPush', worker_push_address)
#         self.register_outbound(
#             PubService, 'Pub', pub_address, log='to_sink',
#             pipelined=pipelined, server=self.name)
#         self.register_bypass(
#             CacheService, 'Cache', db_address)
#         self.preset_cache(name=name,
#                           db_address=db_address,
#                           pull_address=pull_address,
#                           pub_address=pub_address,
#                           worker_pull_address=worker_pull_address,
#                           worker_push_address=worker_push_address)
# 
#         # Monkey patches the scatter and gather functions to the
#         # scatter function of Push and Pull parts respectively.
#         self.inbound_components['Pull'].scatter = self.scatter
#         self.outbound_components['Pub'].scatter = self.gather
#         self.outbound_components['Pub'].handle_stream = self.handle_stream


# Path: examples/cache/master.py
from pylm.servers import Master


server = Master(name='server',
                pull_address='tcp://127.0.0.1:5555',
                pub_address='tcp://127.0.0.1:5556',
                worker_pull_address='tcp://127.0.0.1:5557',
                worker_push_address='tcp://127.0.0.1:5558',

                db_address='tcp://127.0.0.1:5559')