2929from ray_release .file_manager .job_file_manager import JobFileManager
3030from ray_release .job_manager .anyscale_job_manager import AnyscaleJobManager
3131from ray_release .logger import logger
32+ from ray_release .reporter .artifacts import DEFAULT_ARTIFACTS_DIR
3233from ray_release .util import (
3334 AZURE_CLOUD_STORAGE ,
3435 AZURE_STORAGE_CONTAINER ,
@@ -63,6 +64,24 @@ def _get_env_str(env: Dict[str, str]) -> str:
6364
6465
6566class AnyscaleJobRunner (CommandRunner ):
67+ # the directory for runners to dump files to (on buildkite runner instances).
68+ # Write to this directory. run_release_tests.sh will ensure that the content
69+ # shows up under buildkite job's "Artifacts" UI tab.
70+ _DEFAULT_ARTIFACTS_DIR = DEFAULT_ARTIFACTS_DIR
71+
72+ # the artifact file name put under s3 bucket root.
73+ # AnyscalejobWrapper will upload user generated artifact to this path
74+ # and AnyscaleJobRunner will then download from there.
75+ _USER_GENERATED_ARTIFACT = "user_generated_artifact"
76+
77+ # the path where result json will be written to on both head node
78+ # as well as the relative path where result json will be uploaded to on s3.
79+ _RESULT_OUTPUT_JSON = "/tmp/release_test_out.json"
80+
81+ # the path where output json will be written to on both head node
82+ # as well as the relative path where metrics json will be uploaded to on s3.
83+ _METRICS_OUTPUT_JSON = "/tmp/metrics_test_out.json"
84+
6685 def __init__ (
6786 self ,
6887 cluster_manager : ClusterManager ,
@@ -223,17 +242,22 @@ def _handle_command_output(
223242 f"with error:\n { error } \n "
224243 )
225244
226- @property
227- def command_env (self ):
228- env = super ().command_env
229- # Make sure we don't buffer stdout so we don't lose any logs.
230- env ["PYTHONUNBUFFERED" ] = "1"
231- return env
245+ def _get_full_command_env (self , env : Optional [Dict [str , str ]] = None ):
246+ full_env = {
247+ "TEST_OUTPUT_JSON" : self ._RESULT_OUTPUT_JSON ,
248+ "METRICS_OUTPUT_JSON" : self ._METRICS_OUTPUT_JSON ,
249+ "USER_GENERATED_ARTIFACT" : self ._USER_GENERATED_ARTIFACT ,
250+ "BUILDKITE_BRANCH" : os .environ .get ("BUILDKITE_BRANCH" , "" ),
251+ "PYTHONUNBUFFERED" : "1" ,
252+ }
253+ if env :
254+ full_env .update (env )
255+ return full_env
232256
233257 def run_command (
234258 self ,
235259 command : str ,
236- env : Optional [Dict ] = None ,
260+ env : Optional [Dict [ str , str ] ] = None ,
237261 timeout : float = 3600.0 ,
238262 raise_on_timeout : bool = True ,
239263 ) -> float :
@@ -242,7 +266,7 @@ def run_command(
242266 # Convert the prepare commands, envs and timeouts into shell-compliant
243267 # strings that can be passed to the wrapper script
244268 for prepare_command , prepare_env , prepare_timeout in self .prepare_commands :
245- prepare_env = self .get_full_command_env (prepare_env )
269+ prepare_env = self ._get_full_command_env (prepare_env )
246270 env_str = _get_env_str (prepare_env )
247271 prepare_command_strs .append (f"{ env_str } { prepare_command } " )
248272 prepare_command_timeouts .append (prepare_timeout )
@@ -254,7 +278,7 @@ def run_command(
254278 shlex .quote (str (x )) for x in prepare_command_timeouts
255279 )
256280
257- full_env = self .get_full_command_env (env )
281+ full_env = self ._get_full_command_env (env )
258282
259283 no_raise_on_timeout_str = (
260284 " --test-no-raise-on-timeout" if not raise_on_timeout else ""
0 commit comments