Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@OliLay
Copy link
Collaborator

@OliLay OliLay commented Jul 18, 2022

This PR adds support for remote compilations inside a docker container specified by the client.
E2E tests for the docker compilation are executed by the CI only in the main branch due to longer runtime. (similar to schroot)

Instructions on how to use the feature can be found in the README.

Furthermore, the .pylintrc file is updated according to the latest available version from Google, and E2E tests were refactored a bit to reduce code duplication that would else have been added by introducing this feature.
During testing I noticed that reading the server logs is quite hard for clients simultaneously compiling. Therefore, I changed the logging on the server slightly (1-liner) so that one can match every log line to a certain client by including the thread name, which is different for every thread (and therefore client) that the server starts. This way we can analyze logs much better, especially for simultaneous requests.

@OliLay OliLay marked this pull request as ready for review July 19, 2022 13:54
@OliLay OliLay requested review from spirsch and wmann-celonis July 19, 2022 13:54
Copy link
Collaborator

@spirsch spirsch left a comment

Choose a reason for hiding this comment

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

Mostly minor things, so already approving. 👍

README.md Outdated
compiler=g++
timeout=60
compression=lzo
profile=jammy
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
profile=jammy
schroot_profile=jammy

README.md Outdated
$ sudo schroot -c jammy -- apt -y install build-essential
```
- Execute *schrooted* compilations by specifying `--profile=jammy` via the CLI or in the `client.conf` file
- Execute *schrooted* compilations by specifying `--schroot-profile=jammy` via the CLI or in the `client.conf` file
Copy link
Collaborator

Choose a reason for hiding this comment

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

A change I apparently missed in my PR a while ago:

Suggested change
- Execute *schrooted* compilations by specifying `--schroot-profile=jammy` via the CLI or in the `client.conf` file
- Execute *schrooted* compilations by specifying `--schroot-profile=jammy` via the CLI or in the `homcc.conf` file

Comment on lines +127 to +128
return f"""[{level_format}%(levelname)s{self.RESET}] %(asctime)s - %(threadName)s
- %(pathname)s:%(lineno)d:\n%(message)s"""
Copy link
Collaborator

Choose a reason for hiding this comment

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

Good idea to add thread information as well! 👍

Comment on lines +77 to +78
# schroot profiles
schroot_profiles: List[str] = load_schroot_profiles()
Copy link
Collaborator

Choose a reason for hiding this comment

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

Just a mention that I created CPL-7103 ticket to improve our current schroot profile loading (and parsing) in the future.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good idea, thanks for creating the ticket

def check_schroot_profile_argument(self, schroot_profile: Optional[str]) -> bool:
"""Checks whether the specified schroot profile requested by the client can be used.
It can not be used if the schroot profile with the given name is not set up on the server."""
if schroot_profile 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.

Suggested change
if schroot_profile is not None:
if schroot_profile is None:
return False

to reduce indention level like you did in check_docker_container_argument.


return True

def check_docker_container_argument(self, docker_container: Optional[str]):
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
def check_docker_container_argument(self, docker_container: Optional[str]):
def check_docker_container_argument(self, docker_container: Optional[str]) -> bool:


def pytest_addoption(parser: pytest.Parser):
parser.addoption(
"--runschroot", action="store", type=str, metavar="PROFILE", help="run e2e schroot tests with specified PROFILE"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Only for internal consistency:

Suggested change
"--runschroot", action="store", type=str, metavar="PROFILE", help="run e2e schroot tests with specified PROFILE"
"--runschroot", action="store", type=str, metavar="SCHROOT_PROFILE", help="run e2e schroot tests with specified PROFILE"

and in the marker documentation above and usage below (reason="specify --runschroot=SCHROOT_PROFILE)

Comment on lines 12 to 14
class TestIsValidContainer:
"""Tests the method that checks if a docker container is a valid (existing and running) container."""

Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
class TestIsValidContainer:
"""Tests the method that checks if a docker container is a valid (existing and running) container."""

can be removed.

Comment on lines 55 to 58
"--no-schroot-profile" if self.schroot_profile is None else f"--schroot-profile={self.schroot_profile}",
"--no-docker-container"
if self.docker_container is None
else f"--docker-container={self.docker_container}",
Copy link
Collaborator

Choose a reason for hiding this comment

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

We should probably extract these lines (like compression_arg above) to improve visual clarity.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good hint, this makes things more readable

Comment on lines 149 to 152
def cpp_end_to_end_no_linking(
self,
compiler: str,
unused_tcp_port: int,
compression: Compression = NoCompression(),
profile: Optional[str] = None,
basic_arguments: BasicClientArguments,
):
Copy link
Collaborator

Choose a reason for hiding this comment

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

Minor formatting to a single line here (and for cpp_end_to_end_preprocessor_side_effects).

    def cpp_end_to_end_no_linking(self, basic_arguments: BasicClientArguments):

@OliLay OliLay merged commit 00f0dd3 into main Jul 20, 2022
@OliLay OliLay deleted the CPL-6984-Dockerized-compilations branch July 20, 2022 12:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

4 participants