Serialize this policy for Monitor to pick up.

def set_flushing_policy(flushing_policy):
    """Serialize this policy for Monitor to pick up."""
    if "RAY_USE_NEW_GCS" not in os.environ:
        raise Exception(
            "set_flushing_policy() is only available when environment "
            "variable RAY_USE_NEW_GCS is present at both compile and run time."
        )
    ray.worker.global_worker.check_connected()
    redis_client = ray.worker.global_worker.redis_client

    serialized = pickle.dumps(flushing_policy)
    redis_client.set("gcs_flushing_policy", serialized)