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

add MinerConfig support for ePIC UMC #84

Merged
merged 3 commits into from
Dec 23, 2023
Merged

Conversation

jpcomps
Copy link
Collaborator

@jpcomps jpcomps commented Dec 23, 2023

Part 1 of 2. Partially closes #80 but currently only handles the get_config side. Want to break this up into two parts + prepare for changes in the pipeline for further configuration options.

Let me know if this tracks with the current methodology, then can continue with the send_config side.

Copy link
Collaborator

@b-rowan b-rowan left a comment

Choose a reason for hiding this comment

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

Not bad so far, some small things. I may need to think harder about the temperature page, there might be a nice way to do that, but if you cant find one I'll sit down and see what I can do.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe wrap all this in a try: except LookupError: instead of using get?


@classmethod
def from_epic(cls, api_pool: dict) -> "Pool":
return cls(url=api_pool["pool"].replace("stratum+tcp://", ""), user=api_pool["login"], password=api_pool["password"])
Copy link
Collaborator

Choose a reason for hiding this comment

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

Don't replace the prefix here, want to keep everything for the URL.

Might be possible at a later point to split the URL into its components, but not really worth doing yet.

Copy link
Collaborator

Choose a reason for hiding this comment

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

This hasn't been formatted properly, make sure to poetry install --with dev and pre-commit install. You can also manually install black and run it from the root of the project with black ..

Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe wrap in a try: except LookupError: here instead of using get, would rather return default if it fails to parse any of the keys.

hot_temp = web_conf["Misc"]["Shutdown Temp"]
dangerous_temp = web_conf["Misc"]["Shutdown Temp"]

if web_conf["Fans"]["Fan Mode"].get("Auto") is not None:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Not sure about this one, but it may also benefit from a try: except LookupError:.

target_temp = web_conf["Fans"]["Fan Mode"]["Auto"]["Target Temperature"]

if web_conf.get("Misc") is not None:
return cls(
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 there might be a better way to write this, if you're using get. These are some of the only values in the config that are allowed to be None, so maybe with using get and checks for lookup error there's some nicer way to write it.

@b-rowan b-rowan self-assigned this Dec 23, 2023
@jpcomps
Copy link
Collaborator Author

jpcomps commented Dec 23, 2023

I see why try, except works better. I believe it can now catch all situations and always return at worst the default. If this seems ok we can merge this as part 1, I will add the additional changes once your changes are merged.

@b-rowan b-rowan merged commit 936474e into UpstreamData:master Dec 23, 2023
2 checks passed
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.

implement MinerConfig scheme for ePIC UMC
2 participants