def main(settings):
    # create my own identity
    identity = "worker:%s:%s" % (socket.gethostname(), os.getpid())

    ctx = zmq.Context()
    io_loop = IOLoop.instance()

    # initialize the logging subsystem
    log_pub = ctx.socket(zmq.PUB)
    log_pub.connect(settings.ZEROMQ_LOGGING)
    zmq_logging_handler = PUBHandler(log_pub)
    zmq_logging_handler.root_topic = "spyder.worker"
    logger = logging.getLogger()
    logger.addHandler(zmq_logging_handler)
    logger.setLevel(settings.LOG_LEVEL_WORKER)

    logger.info("process::Starting up another worker")

    mgmt = create_worker_management(settings, ctx, io_loop)

    logger.debug("process::Initializing fetcher, extractor and scoper")

    fetcher = create_worker_fetcher(settings, mgmt, ctx, zmq_logging_handler,
        io_loop)
    fetcher.start()
    extractor = create_worker_extractor(settings, mgmt, ctx,
        zmq_logging_handler, io_loop)
    extractor.start()

    def quit_worker(raw_msg):
        """
        When the worker should quit, stop the io_loop after 2 seconds.
        """
        msg = MgmtMessage(raw_msg)
        if ZMQ_SPYDER_MGMT_WORKER_QUIT == msg.data:
            logger.info("process::We have been asked to shutdown, do so")
            DelayedCallback(io_loop.stop, 2000, io_loop).start()
            ack = MgmtMessage(topic=ZMQ_SPYDER_MGMT_WORKER, identity=identity,
                    data=ZMQ_SPYDER_MGMT_WORKER_QUIT_ACK)
            mgmt._out_stream.send_multipart(ack.serialize())

    mgmt.add_callback(ZMQ_SPYDER_MGMT_WORKER, quit_worker)
    mgmt.start()

    # notify the master that we are online
    msg = MgmtMessage(topic=ZMQ_SPYDER_MGMT_WORKER, identity=identity,
            data=ZMQ_SPYDER_MGMT_WORKER_AVAIL)
    mgmt._out_stream.send_multipart(msg.serialize())

    def handle_shutdown_signal(_sig, _frame):
        """
        Called from the os when a shutdown signal is fired.
        """
        msg = MgmtMessage(data=ZMQ_SPYDER_MGMT_WORKER_QUIT)
        quit_worker(msg.serialize())
        # zmq 2.1 stops blocking calls, restart the ioloop
        io_loop.start()

    # handle kill signals
    signal.signal(signal.SIGINT, handle_shutdown_signal)
    signal.signal(signal.SIGTERM, handle_shutdown_signal)

    logger.info("process::waiting for action")
    # this will block until the worker quits
    try:
        io_loop.start()
    except ZMQError:
        logger.debug("Caught a ZMQError. Hopefully during shutdown")
        logger.debug(traceback.format_exc())

    for mod in [fetcher, extractor, mgmt]:
        mod.close()

    logger.info("process::Houston: Worker down")
    ctx.term()
The :meth:`main` method for worker processes.
dataset/ETHPy150Open retresco/Spyder/src/spyder/workerprocess.py/main