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

Rename adapter -> controller #31

Merged
merged 7 commits into from
Apr 22, 2024
Merged

Rename adapter -> controller #31

merged 7 commits into from
Apr 22, 2024

Conversation

jamienoss
Copy link
Member

@jamienoss jamienoss commented Apr 9, 2024

Resolves #25

  • Renames all instances of adapter -> controller and similar.
  • Renames all instances of react -> control and similar
  • Last commit adds a few layers/hooks for easier customization of the control execution without needing to always customize the core control func/algorithm. This should facilitate in easier sharing of control code.

I had thought about adding context manager funcs, but it didn't quite make sense for this. The only example I could think of is when running multiple controls, i.e., when doing one thing, you then want to do another, but 🤷 .

with thermostat:
  monitor_results()

#or 
with thermostat:
  do_other_stuff_requiring_constant_temp()

However, the above examples require concurrency...

@jamienoss jamienoss self-assigned this Apr 9, 2024
@jamienoss jamienoss added this to the Complete backend framework milestone Apr 9, 2024
@jamienoss jamienoss marked this pull request as ready for review April 9, 2024 14:38
@jamienoss jamienoss requested a review from a team as a code owner April 9, 2024 14:38
@jamienoss jamienoss requested a review from amitschang April 9, 2024 14:38
Copy link
Member

@amitschang amitschang left a comment

Choose a reason for hiding this comment

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

couple comments inline

@@ -10,7 +10,7 @@
DEFAULT_HISTORY = HistoryServer


class AdapterDescriptor(pydantic.BaseModel):
class ControllerDescriptor(pydantic.BaseModel):
Copy link
Member

Choose a reason for hiding this comment

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

I know this was already in place and was confusing before, but since this is more generic than controller (it is used for controller and hardware), maybe should be DriverDescriptor, or PluginDescriptor or something. If we don't change here I can make an issue to track that.

Copy link
Member Author

Choose a reason for hiding this comment

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

@amitschang I think this would be better if just nuked and replaced with evolver.base.BaseConfig, sound good to you?

Copy link
Member Author

@jamienoss jamienoss Apr 22, 2024

Choose a reason for hiding this comment

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

I won't change in this PR though, there's a much-needed refactor to incorporate the construction pattern from #37 and this can get addressed then.

""" Hook for customization post-control execution, see self.run(). """
pass

def run(self, *args, **kwargs):
Copy link
Member

Choose a reason for hiding this comment

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

could you add a test or two for this, especially the return mutation to be sure we capture the desired mechanism?

Copy link
Member Author

Choose a reason for hiding this comment

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

Wasn't really sure what you were expecting here but I at least added some very rudimentary tests for you.

@jamienoss jamienoss mentioned this pull request Apr 16, 2024
Signed-off-by: James Noss <jnoss@jhu.edu>
Signed-off-by: James Noss <jnoss@jhu.edu>
Signed-off-by: James Noss <jnoss@jhu.edu>
Signed-off-by: James Noss <jnoss@jhu.edu>
Signed-off-by: James Noss <jnoss@jhu.edu>
@jamienoss jamienoss force-pushed the rename-adapter branch 2 times, most recently from 384332b to e756926 Compare April 22, 2024 14:44
Signed-off-by: James Noss <jnoss@jhu.edu>
Signed-off-by: James Noss <jnoss@jhu.edu>
@jamienoss jamienoss requested a review from amitschang April 22, 2024 15:25
@jamienoss jamienoss merged commit ba9f2cc into main Apr 22, 2024
6 checks passed
@jamienoss jamienoss deleted the rename-adapter branch April 24, 2024 20:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Rename adapter
2 participants