<commit_before>import numpy as np
import time

import ray
from ray.test_utils import wait_for_condition

MB = 1024 * 1024


def object_store_memory(a, delta=MB):
    b = ray.available_resources()["object_store_memory"]
    return abs(a - b) < delta


@ray.remote(memory=100 * MB)
class Actor:
    def __init__(self):
        pass

    def ping(self):
        return "ok"


def test_memory_request():
    try:
        ray.init(num_cpus=1, _memory=200 * MB)
        # fits first 2
        a = Actor.remote()
        b = Actor.remote()<commit_msg>[Test] Fix memory scheduling flaky test (#14980)<commit_after>import numpy as np
import time

import ray
from ray.test_utils import wait_for_condition

MB = 1024 * 1024


def object_store_memory(a, delta=MB):
    b = ray.available_resources().get("object_store_memory", 0)
    return abs(a - b) < delta


@ray.remote(memory=100 * MB)
class Actor:
    def __init__(self):
        pass

    def ping(self):
        return "ok"


def test_memory_request():
    try:
        ray.init(num_cpus=1, _memory=200 * MB)
        # fits first 2
        a = Actor.remote()
        b = Actor.remote()
{'fraction_non_alphanumeric': 0.1088495575221239, 'fraction_numerical': 0.033628318584070796, 'mean_word_length': 2.88659793814433, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7047712', 'n_tokens_mistral': 420, 'n_tokens_neox': 369, 'n_words': 102}