Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ci] test lint ci and lint tests dir #28

Merged
merged 15 commits into from
Dec 2, 2024
18 changes: 6 additions & 12 deletions .github/workflows/ray_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,15 @@ on:

jobs:
ray:
runs-on: self-host-gpu
strategy:
matrix:
python-version: ["3.12"]
runs-on: [self-hosted, gpu] # test if the enviroment is ready
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
with:
python-version: ${{ matrix.python-version }}
# - name: Install dependencies
# run: |
# python -m pip install --upgrade pip
# pip install yapf
# pip install toml==0.10.2
fetch-depth: 0
- name: Install the current repository
run: |
pip install -e .
- name: Running some ray test that only need 2 GPUs
run: |
cd tests/ray
pytest -s -x test_rvdz.py test_driverfunc_to_worker.py test_data_transfer.py test_colocated_workers.py test_check_worker_alive.py
9 changes: 7 additions & 2 deletions .github/workflows/yapf_format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,13 @@ jobs:
python-version: ["3.12"]
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
ref: ${{ github.head_ref }} # Checkout the branch associated with the pull request
# - name: checkout
# run: |
# commits=${{ github.event.pull_request.commits }}
# if [[ -n "$commits" ]]; then
# # Prepare enough depth for diffs with main
# git fetch --depth="$(( commits + 1 ))"
# fi
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
with:
Expand Down
2 changes: 1 addition & 1 deletion tests/ray/check_worker_alive/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def foo(self, wait_time):

# test single-node-no-partition
print(f"test single-node-no-partition")
resource_pool = RayResourcePool([8], use_gpu=True)
resource_pool = RayResourcePool([2], use_gpu=True)
class_with_args = RayClassWithInitArgs(cls=TestActor)

print("create worker group")
Expand Down
2 changes: 1 addition & 1 deletion tests/ray/test_data_transfer.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def do_nothing(self, data):
def test_data_transfer():
ray.init()
# construct resource pool
resource_pool = RayResourcePool([8])
resource_pool = RayResourcePool([2])
cls_with_init = RayClassWithInitArgs(cls=DummyWorker)
# construct worker group
wg = RayWorkerGroup(resource_pool, cls_with_init)
Expand Down
2 changes: 1 addition & 1 deletion tests/ray/test_driverfunc_to_worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def test():
# construct model
ray.init()

# create 8 workers, each hold a GPU
# create 2 workers, each hold a GPU
resource_pool = RayResourcePool([2], use_gpu=True, name_prefix='a')

class_with_args = RayClassWithInitArgs(cls=ModelActor)
Expand Down
6 changes: 3 additions & 3 deletions tests/ray/test_rvdz.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,14 @@ def test_rvdz():
ray.init()

group_name = "test_group"
world_size = 4
world_size = 2

workers = [TestWorker.options(num_gpus=1).remote(rank, world_size, group_name) for rank in range(world_size)]

[worker.init.remote() for worker in workers]
ray.get([worker.init.remote() for worker in workers])

ranks = ray.get([worker.test.remote() for worker in workers])

assert ranks == [0, 1, 2, 3], f"expecting [0, 1, 2, 3], got {ranks}"
assert ranks == [0, 1], f"expecting [0, 1], got {ranks}"

ray.shutdown()