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

Fix stearming synthetic #390

Merged
merged 1 commit into from
Jan 31, 2025
Merged

Fix stearming synthetic #390

merged 1 commit into from
Jan 31, 2025

Conversation

mpnowacki-reef
Copy link
Contributor

No description provided.

@mpnowacki-reef mpnowacki-reef force-pushed the fix-stearming-synthetic branch from 8634f0e to 36911b6 Compare January 30, 2025 23:44
Copy link

github-actions bot commented Jan 30, 2025

Validator test report

160 tests  ±0   158 ✅ ±0   42s ⏱️ ±0s
  1 suites ±0     2 💤 ±0 
  1 files   ±0     0 ❌ ±0 

Results for commit 9203142. ± Comparison against base commit 940f094.

This pull request removes 2 and adds 2 tests. Note that renamed tests count towards both.
compute_horde_validator.validator.tests.test_synthetic_jobs.test_multiple_miners ‑ test_all_streaming_succeed
compute_horde_validator.validator.tests.test_utils ‑ test_execute_synthetic_job[futures_result3-COMPLETED-0.8-expected_system_event3]
compute_horde_validator.validator.tests.test_synthetic_jobs.test_multiple_miners ‑ test_some_streaming_succeed
compute_horde_validator.validator.tests.test_utils ‑ test_execute_synthetic_job[futures_result3-COMPLETED-1-expected_system_event3]

♻️ This comment has been updated with latest results.

@mpnowacki-reef mpnowacki-reef force-pushed the fix-stearming-synthetic branch from 42adb29 to 872572a Compare January 31, 2025 00:19
@mpnowacki-reef mpnowacki-reef force-pushed the fix-stearming-synthetic branch from 872572a to 9203142 Compare January 31, 2025 00:22
miner.pk,
SyntheticJob.Status.FAILED,
0,
re.compile("took too long: time_took_sec=.*"),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand this is because of the "sleepy request" in the prep method?
I'd move that setup to this test, if possible, IMO it'll be easier to understand.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you mean to place the body of the prep method inside of the test method? I'm thinking maybe the per miner configuration should be more explicit and be sth like

[
Miner(hotkey=..., ws_messages='all', http_responses='ok'),
Miner(hotkey=..., ws_messages='up_until_ready', http_responses='ok'),
Miner(hotkey=..., ws_messages='all', http_responses='timeout'),
...
]

which would make it even more readable and would avoid the reader to have bind associate a miner it's http mock config via port numbers and other nonsense. WDYT?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I didn't necessarily mean all of it, but the "sleepy request" part.
It's that I had to go to the fixture to see how many uuids there are, then calculate the port number and then go to that function to see why job uuid[-2] is supposed to time out – having the setup in the test would make this easier, I think.

Your suggestion from this comment is even better, of course, if you think it's worth to spend time doing that.

except Exception as e:
msg = f"Failed to execute streaming job {job_uuid} on {url}: {e}"
logger.debug(msg)
else:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think early returns are easier to follow than try/except/else, if they're possible. I think we can do that in this case – we don't need to move further and request to /terminate the job that hasn't been successfully started, right?

Same for below

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think we do need to terminate, or at least try

# TODO: caching
val = await aget_config("DYNAMIC_SYNTHETIC_STREAMING_JOB_READY_TIMEOUT")
return float(val) if val is not None else None


class LlmPromptsSyntheticJobGenerator(LlmPromptsJobGenerator):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note, maybe out of scope: the naming of these classes is not clear to me (BaseSyntheticJobGenerator -> LlmPromptsJobGenerator -> LlmPromptsSyntheticJobGenerator). Could the last one be called something with "streaming" instead, maybe?

@@ -37,6 +48,7 @@ def __init__(
self.s3_output_bucket = settings.S3_BUCKET_NAME_ANSWERS

self.prompt_answers: dict[str, str] = {}
self.streaming_processing_time: float | None = None
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this can be moved to the subclass, it'd be cleaner this way

return True

def verify_correctness(self, msg: V0JobFinishedRequest) -> tuple[bool, str]:
return True, "mock"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think verify can be removed from this class now, and the TimeTookScoreMockSyntheticJobGenerator class and factory seem to no longer be not needed at all

@mpnowacki-reef mpnowacki-reef merged commit cf8a911 into master Jan 31, 2025
23 checks passed
@mpnowacki-reef mpnowacki-reef deleted the fix-stearming-synthetic branch January 31, 2025 12:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants