def get_rack_context(proxy_port=8088, client_version="1", api_version="v1"):

    try:
        resp = requests.get(META_URL)
        metadata = json.loads(resp.text)["meta"]
        proxy_url = 'http://%s:%d/%s' % (
            metadata["proxy_ip"], proxy_port, api_version)
        client = Client(client_version, rack_url=proxy_url)
        proxy_info = client.proxy.get(metadata["gid"])

        rack_ctx = type('', (object,), metadata)
        rack_ctx.ppid = getattr(rack_ctx, "ppid", "")
        rack_ctx.client = client
        rack_ctx.fs_endpoint = proxy_info.fs_endpoint
        rack_ctx.ipc_endpoint = proxy_info.ipc_endpoint
        rack_ctx.shm_endpoint = proxy_info.shm_endpoint

        try:
            # Check if this process is not recognized by RACK.
            rack_ctx.client.processes.get(rack_ctx.gid, rack_ctx.pid)
        except exceptions.NotFound:
            msg = "This process is not recognized by RACK"
            raise exceptions.InvalidProcessError(msg)

        if rack_ctx.ppid:
            LOG.debug("Messaging: send message to %s", rack_ctx.ppid)
            msg = _Messaging(rack_ctx)
            msg.send_msg(rack_ctx.ppid)
            while True:
                receive_msg = msg.receive_msg(
                    getattr(rack_ctx, "msg_limit_time", 180))
                if receive_msg and rack_ctx.ppid == receive_msg.get("pid"):
                    LOG.debug(
                        "Messaging: receive message from %s",
                        receive_msg.get("pid"))
                    break

    except Exception as e:
        msg = e.message % "Failed to initialize the process: %s."
        raise exceptions.ProcessInitError(msg)

    return rack_ctx
dataset/ETHPy150Open openstack/python-rackclient/rackclient/lib/initializing.py/get_rack_context/swapped operands of `%`