mirror of
https://github.com/vale981/ray
synced 2025-03-06 10:31:39 -05:00

Adds a unit-tested and restructured ray_release package for running release tests. Relevant changes in behavior: Per default, Buildkite will wait for the wheels of the current commit to be available. Alternatively, users can a) specify a different commit hash, b) a wheels URL (which we will also wait for to be available) or c) specify a branch (or user/branch combination), in which case the latest available wheels will be used (e.g. if master is passed, behavior matches old default behavior). The main subpackages are: Cluster manager: Creates cluster envs/computes, starts cluster, terminates cluster Command runner: Runs commands, e.g. as client command or sdk command File manager: Uploads/downloads files to/from session Reporter: Reports results (e.g. to database) Much of the code base is unit tested, but there are probably some pieces missing. Example build (waited for wheels to be built): https://buildkite.com/ray-project/kf-dev/builds/51#_ Wheel build: https://buildkite.com/ray-project/ray-builders-branch/builds/6023
52 lines
1.1 KiB
Python
52 lines
1.1 KiB
Python
from collections import Counter
|
|
from typing import Any
|
|
|
|
UNIT_TEST_PROJECT_ID = "prj_HqxHjwtn2uRtzR3DW6AmBYZh"
|
|
|
|
UNIT_TEST_CLOUD_ID = "cld_4F7k8814aZzGG8TNUGPKnc"
|
|
|
|
|
|
class UnitTestError(RuntimeError):
|
|
pass
|
|
|
|
|
|
def fail_always(*a, **kw):
|
|
raise UnitTestError()
|
|
|
|
|
|
def fail_once(result: Any):
|
|
class _Failer:
|
|
def __init__(self):
|
|
self.failed = False
|
|
|
|
def __call__(self, *args, **kwargs):
|
|
if not self.failed:
|
|
self.failed = True
|
|
raise UnitTestError()
|
|
return result
|
|
|
|
return _Failer()
|
|
|
|
|
|
class APIDict(dict):
|
|
__slots__ = ()
|
|
__getattr__ = dict.__getitem__
|
|
__setattr__ = dict.__setattr__
|
|
|
|
|
|
class MockSDK:
|
|
def __init__(self):
|
|
self.returns = {}
|
|
self.call_counter = Counter()
|
|
|
|
def reset(self):
|
|
self.returns = {}
|
|
self.call_counter = Counter()
|
|
|
|
def __getattr__(self, item):
|
|
self.call_counter[item] += 1
|
|
result = self.returns.get(item)
|
|
if callable(result):
|
|
return result
|
|
else:
|
|
return lambda *a, **kw: result
|