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

Adds minimal controller interface #193

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open

Conversation

dalonsoa
Copy link
Collaborator

Description

Adds a minimal code to interact with the Controller driver. This seems way simpler than the process manager - or I'm missing something.

I've added a script, as indicated in #160 , but when I run it using the drunc-lite profile - which I believe does not have the controller, anyway - I get the following error:

$ docker exec -it dune_processes-app-1 python scripts/talk_to_controller.py
Traceback (most recent call last):
  File "/usr/src/app/scripts/talk_to_controller.py", line 20, in <module>
    val = controller.get_status()
          ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/drunc/controller/controller_driver.py", line 33, in get_status
    return self.send_command('get_status', outformat = Status)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/drunc/utils/shell_utils.py", line 191, in send_command
    return self.handle_response(response, command, outformat)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/drunc/utils/shell_utils.py", line 110, in handle_response
    name = response.name,
           ^^^^^^^^^^^^^
AttributeError: 'UnaryUnaryCall' object has no attribute 'name'

And I cannot use the normal drunc profile because of the error reported in #187 . So, I'm not entirely sure at this point if things are actually working or what the output of get_status looks like.

Fixes #160

Type of change

  • Documentation (non-breaking change that adds or improves the documentation)
  • New feature (non-breaking change which adds functionality)
  • Optimization (non-breaking, back-end change that speeds up the code)
  • Bug fix (non-breaking change which fixes an issue)
  • Breaking change (whatever its nature)

Key checklist

  • All tests pass (eg. python -m pytest)
  • The documentation builds and looks OK (eg. python -m sphinx -b html docs docs/build)
  • Pre-commit hooks run successfully (eg. pre-commit run --all-files)

Further checks

  • Code is commented, particularly in hard-to-understand areas
  • Tests added or an issue has been opened to tackle that in the future. (Indicate issue here: # (issue))

@codecov-commenter
Copy link

codecov-commenter commented Oct 30, 2024

Codecov Report

Attention: Patch coverage is 80.00000% with 2 lines in your changes missing coverage. Please review.

Project coverage is 81.95%. Comparing base (37e9449) to head (11ac351).
Report is 12 commits behind head on main.

Files with missing lines Patch % Lines
controller/controller_interface.py 77.77% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #193      +/-   ##
==========================================
- Coverage   82.00%   81.95%   -0.05%     
==========================================
  Files          31       32       +1     
  Lines         400      410      +10     
==========================================
+ Hits          328      336       +8     
- Misses         72       74       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@cc-a
Copy link
Contributor

cc-a commented Oct 30, 2024

Thanks for this @dalonsoa. I hadn't clocked that the ControllerDriver doesn't use async method so that makes the interface a bit simpler indeed.

I've reproduced the same error as you report with the drunc-lite profile with the full drunc image so I think this is a potential bug with drunc. It may be because we're using a slightly older release of drunc. Could you please raise with the DUNE team?

Copy link
Contributor

@jamesturner246 jamesturner246 left a comment

Choose a reason for hiding this comment

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

drunc controller get status aside, the code looks fine. 👍

Copy link
Contributor

@Sahil590 Sahil590 left a comment

Choose a reason for hiding this comment

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

LGTM

@dalonsoa
Copy link
Collaborator Author

dalonsoa commented Nov 6, 2024

Needs #203, at least, to prove this works. So it might take a while to actually do anything.

Having said that, this code is, as far as I can tell, correct even if we cannot use it. Would it be a problem to merge the PR, so this interface is in place, if just as a placeholder, while we develop the rest of the functionality that depends on it, @cc-a ?

Copy link
Contributor

@AdrianDAlessandro AdrianDAlessandro left a comment

Choose a reason for hiding this comment

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

I tried reviewing this but cannot because of #209


mock = mocker.patch("controller.controller_interface.get_controller_driver")
get_controller_status()
mock.assert_called_once()
Copy link
Contributor

Choose a reason for hiding this comment

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

Being pedantic, we probably want to check that the get_status() method was called and not just get_controller_driver

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.

Controller interface infrastructure
6 participants