def main():
    while True:
        task = socket.recv_json()

        # Convert the JSON dict we got into a Task object.
        try:
            task = to_task(task)
        except __HOLE__ as e:
            # sisyphus is only exposed to internal components within Galah.
            # This is a very serious error signifying a problem with Galah's
            # logic.
            logger.exception("Error converting request to Task object.")

            socket.send_json({
                "success": False,
                "error_string": str(e)
            })

            continue

        logger.info("Received request for task %s.", task.name)

        # Check if this is a recognized command.
        if task.name not in task_list.keys():
            # Same as above, this is a serious error signifying a problem with
            # Galah's logic.
            logger.error("Unknown task '%s'.", task.name)

            socket.send_json({
                "success": False,
                "error_string": "Unknown task '%s'" % task.name
            })

            continue

        # All is good, place the task in the queue
        task_queue.put(task)

        socket.send_json({"success": True})
dataset/ETHPy150Open ucrcsedept/galah/galah/sisyphus/sisyphus.py/main