feat: add python remote debug support#138
Conversation
Change-Id: Id1ab768dfaabb7868713ac238c8840406e2c98c0 GitOrigin-RevId: daf3412c40c0d2509e543470f02608b6c4761fe3
aa5a330 to
d73ddc9
Compare
|
Was a local build caching issue 🥲, works as expected. |
f6444d5 to
b948b44
Compare
|
Hi, Morgan. Thank you for the PR. I'm going to review it and provide some feedback. Viktor |
viktorl-dev
left a comment
There was a problem hiding this comment.
The PR looks good overall. Please address the comments above, and I think we'll be good to go.
| @option_enable_ssh | ||
| @option_ssh_port |
There was a problem hiding this comment.
I think it also makes sense to enable these 2 options for start and restart.
There was a problem hiding this comment.
I've pushed up some changes that aim to address this.
I assume this requires modifying load_from_config and EnvironmentConfig to respect the value of these variables.
There was a problem hiding this comment.
Sure, the changes look good to me 👍
|
Thanks your feedback @viktorl-dev. I've addressed all of the above points with the exception of adding I've added my questions on that point above 🙂. |
b907555 to
408d395
Compare
`install_and_run_sshd` previously failed as the base Airflow images do not include the default ubuntu package repositories. As such, the openssh-server package could not be found. Additionally, the ssh_host_keys generated by sshd are owned by root. This causes permission related failures since the container runs as user airflow.
Also add these arguments to `start` and `restart` commands
408d395 to
a2ea548
Compare
viktorl-dev
left a comment
There was a problem hiding this comment.
I've added a few more comments. A quick summary of next steps:
- Fixing these issues may cause some existing tests to break, so please verify them.
- Do you think we should add additional test cases for the new features?
| # By default, the container runs as the user `airflow` with UID 999. Set | ||
| # this env variable to "True" to make it run as the current host user. | ||
| "COMPOSER_CONTAINER_RUN_AS_HOST_USER": "False", | ||
| "COMPOSER_CONTAINER_ENABLE_SSHD": str(enable_ssh), |
There was a problem hiding this comment.
I'd suggest making the naming consistent: if we add an option named --enable-ssh, the corresponding environment variable should also be named COMPOSER_CONTAINER_ENABLE_SSH
| if "enable_ssh" in self.config: | ||
| self.enable_ssh = ( | ||
| enable_ssh | ||
| if enable_ssh is not None | ||
| else self.get_str_param("enable_ssh") | ||
| ) | ||
| self.ssh_port = ( | ||
| ssh_port | ||
| if ssh_port is not None | ||
| else self.parse_int_param("ssh_port", allowed_range=(0, 65536)) | ||
| ) | ||
| else: | ||
| self.enable_ssh = False | ||
| self.ssh_port = None |
There was a problem hiding this comment.
This looks a bit convoluted. I suggest refactoring it as follows:
self.enable_ssh = self.config.get("enable_ssh", constants.DEFAULT_ENABLE_SSH)
self.ssh_port = self.config.get("ssh_port", constants.DEFAULT_SSH_PORT)
if enable_ssh is not None:
self.enable_ssh = enable_ssh
if ssh_port is not None:
self.ssh_port = ssh_portSo you'd also need to add DEFAULT_ENABLE_SSH = False to constants.py
There was a problem hiding this comment.
I just realized I missed this part in my suggestion:
self.parse_int_param("ssh_port", allowed_range=(0, 65536))Could you please incorporate this.
P.S.: though it should be 65535 and not 65536. Yeah, I can see there are many places with the same wrong number. We'll handle this later on.
| self.database_engine == constants.DatabaseEngine.sqlite3 | ||
| ) | ||
| self.port: int = port if port is not None else 8080 | ||
| self.enable_ssh: bool = enable_ssh |
There was a problem hiding this comment.
I'd suggest setting it to the default value as well:
| self.enable_ssh: bool = enable_ssh | |
| self.enable_ssh: bool = enable_ssh if enable_ssh is not None else constants.DEFAULT_ENABLE_SSH |
|
@viktorl-dev I've made the required changes and confirmed that the existing tests continue to pass. |
|
I see periodic failures starting the database container: Unsure why this is occuring. |
| sudo chown -R airflow:airflow "$FAST_API_DIR" | ||
| fi | ||
|
|
||
| if [ "${COMPOSER_CONTAINER_ENABLE_SSHD}" = "True" ]; then |
There was a problem hiding this comment.
Here, a variable hasn't been renamed. What is more interesting is that all tests are green even with this "not yet renamed" variable. Could you please add a test case that specifically catches this issue?
This pull request is based on #53. The majority of the changes introduced have been cherry-picked unchanged from that branch.
Some changes to the original commits included in #53 were required to resolve conflicts and bring the original feature branch up-to-date with the current state of the development branch.
Resolves #51.
All tests passed successfully.