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

HITL: Add HTTP availability server #1794

Merged
merged 4 commits into from
Feb 7, 2024

Conversation

eundersander
Copy link
Contributor

@eundersander eundersander commented Feb 6, 2024

Motivation and Context

  • Add HTTP availability server required by Amazon Elastic Load Balancer health checks.
  • Refactor networking process main loop to use async/await more cleanly
  • Add HTML stub client for easier testing

How Has This Been Tested

Local testing and AWS testing with HTML stub client.

Types of changes

  • [HITL]

Checklist

  • My code follows the code style of this project.
  • I have updated the documentation if required.
  • I have read the CONTRIBUTING document.
  • I have completed my CLA (see CONTRIBUTING)
  • I have added tests to cover my changes if required.

@facebook-github-bot facebook-github-bot added the CLA Signed Do not delete this pull request or issue due to inactivity. label Feb 6, 2024
Copy link
Contributor Author

@eundersander eundersander left a comment

Choose a reason for hiding this comment

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

Some comments for reviewers

@@ -2,6 +2,10 @@

habitat_hitl:
window: ~
networking:
Copy link
Contributor Author

Choose a reason for hiding this comment

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

See comments in hitl_defaults.yaml.

threading.Event() if multiprocessing_config.use_dummy else None
)
# we don't support dummy multiprocessing at this time
assert not multiprocessing_config.use_dummy
Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's not worth the complexity of maintaining the dummy-multiprocessing version of all this.

Copy link
Contributor

Choose a reason for hiding this comment

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

Should we just remove it, and introduce it again if we need it?

start_server = websockets.serve(
network_mgr_lambda, "0.0.0.0", 8888, ssl=ssl_context

async def networking_main_async(interprocess_record):
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The big refactor here is that all our networking logic is now implemented with async/await. Reviewers should take some time to make sure they understand how networking_main_async and networking_main work.

Copy link
Contributor

@0mdc 0mdc left a comment

Choose a reason for hiding this comment

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

LGTM!

I tested the networking server, and it works as expected.

threading.Event() if multiprocessing_config.use_dummy else None
)
# we don't support dummy multiprocessing at this time
assert not multiprocessing_config.use_dummy
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we just remove it, and introduce it again if we need it?

# Handle SIGTERM. We should get this signal when we do networking_process.terminate(). See terminate_networking_process.
stop: asyncio.Future = asyncio.Future()
loop = asyncio.get_event_loop()
loop.add_signal_handler(signal.SIGTERM, stop.set_result, None)
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

@eundersander eundersander merged commit 128f7a3 into main Feb 7, 2024
4 checks passed
@eundersander eundersander deleted the eundersander/http_availability_server branch February 7, 2024 21:45
dannymcy pushed a commit to dannymcy/habitat-lab that referenced this pull request Jul 8, 2024
* add http availability server; refactor of networking process main loop

* add HTML stub client

* fixups after rebasing

* documentation polish
HHYHRHY pushed a commit to SgtVincent/habitat-lab that referenced this pull request Aug 31, 2024
* add http availability server; refactor of networking process main loop

* add HTML stub client

* fixups after rebasing

* documentation polish
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed Do not delete this pull request or issue due to inactivity.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants