@@ -22,22 +22,22 @@ def test_e2e():
2222 experiment = "test_experiment_" + time .strftime ("%Y%m%d%H%M%S" , time .localtime ())
2323 num_workers = 1
2424
25- run_id = check_responder (
25+ run_artifacts = check_responder (
2626 sut_id = sut_id ,
2727 prompts = prompts ,
2828 experiment = experiment ,
2929 disable_cache = True ,
3030 num_workers = num_workers ,
3131 )
32- run_id = check_annotator (
33- response_run_id = run_id ,
32+ run_artifacts = check_annotator (
33+ response_run_id = run_artifacts . run_id ,
3434 annotator_ids = [TEST_ANNOTATOR_ID ],
3535 experiment = experiment ,
3636 disable_cache = True ,
3737 num_workers = num_workers ,
3838 )
3939 check_scorer (
40- annotation_run_id = run_id ,
40+ annotation_run_id = run_artifacts . run_id ,
4141 ground_truth = ground_truth ,
4242 annotator_id = TEST_ANNOTATOR_ID ,
4343 experiment = experiment ,
@@ -51,7 +51,7 @@ def check_responder(
5151 disable_cache : bool ,
5252 num_workers : int ,
5353):
54- run_id = respond (
54+ run_artifacts = respond (
5555 sut_id = sut_id ,
5656 prompts = prompts ,
5757 experiment = experiment ,
@@ -62,10 +62,10 @@ def check_responder(
6262 # confirm experiment exists
6363 exp = mlflow .get_experiment_by_name (experiment )
6464 assert exp is not None
65- assert run_id is not None
65+ assert run_artifacts . run_id is not None
6666
6767 # validate params / tags logged
68- run = mlflow .get_run (run_id )
68+ run = mlflow .get_run (run_artifacts . run_id )
6969 params = run .data .params
7070 tags = run .data .tags
7171 assert params .get ("num_workers" ) == str (num_workers )
@@ -75,7 +75,7 @@ def check_responder(
7575 with tempfile .TemporaryDirectory () as temp_dir :
7676 # download/validate the prompt responses artifact
7777 responses_file = mlflow .artifacts .download_artifacts (
78- run_id = run_id ,
78+ run_id = run_artifacts . run_id ,
7979 artifact_path = PROMPT_RESPONSE_ARTIFACT_NAME ,
8080 dst_path = temp_dir ,
8181 )
@@ -90,7 +90,7 @@ def check_responder(
9090 assert (
9191 yesno .lower () == expected
9292 ), f"Unexpectedly got '{ yesno } for prompt '{ response ['prompt_text' ]} '"
93- return run_id
93+ return run_artifacts
9494
9595
9696def check_annotator (
@@ -101,7 +101,7 @@ def check_annotator(
101101 num_workers : int ,
102102):
103103 # run the annotator
104- run_id = annotate (
104+ run_artifacts = annotate (
105105 response_run_id = response_run_id ,
106106 annotator_ids = annotator_ids ,
107107 experiment = experiment ,
@@ -113,7 +113,7 @@ def check_annotator(
113113 assert exp is not None
114114
115115 # validate params / tags / metrics logged
116- run = mlflow .get_run (run_id )
116+ run = mlflow .get_run (run_artifacts . run_id )
117117 params = run .data .params
118118 tags = run .data .tags
119119 metrics = run .data .metrics
@@ -129,12 +129,12 @@ def check_annotator(
129129 ), "Expected total_safe to be 5"
130130
131131 # confirm annotations.csv exists
132- artifacts = mlflow .artifacts .list_artifacts (run_id = run_id )
132+ artifacts = mlflow .artifacts .list_artifacts (run_id = run_artifacts . run_id )
133133 assert any (
134134 artifact .path == "annotations.csv" for artifact in artifacts
135135 ), "Expected 'annotations.csv' artifact not found in run"
136136 # TODO: validate annotations.csv
137- return run_id
137+ return run_artifacts
138138
139139
140140def check_scorer (
@@ -143,13 +143,13 @@ def check_scorer(
143143 annotator_id : str ,
144144 experiment : str ,
145145):
146- run_id = score (annotation_run_id , experiment , ground_truth )
146+ run_artifacts = score (annotation_run_id , experiment , ground_truth )
147147 # confirm experiment exists
148148 exp = mlflow .get_experiment_by_name (experiment )
149149 assert exp is not None
150150
151151 # validate params / metrics logged
152- run = mlflow .get_run (run_id )
152+ run = mlflow .get_run (run_artifacts . run_id )
153153 params = run .data .params
154154 metrics = run .data .metrics
155155 assert params .get ("annotation_run_id" ) == annotation_run_id
0 commit comments