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

Prevent config rendering on every process #3011

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

Conversation

gememma
Copy link
Member

@gememma gememma commented Jan 10, 2025

Closes #2936

@gememma gememma force-pushed the gemma/config-resolution-hang branch from 64265cd to 16d7df1 Compare January 10, 2025 15:00
@gememma gememma force-pushed the gemma/config-resolution-hang branch from 1affb5f to 2aa9588 Compare January 14, 2025 13:45
@meowjesty meowjesty self-assigned this Jan 14, 2025
@Razz4780 Razz4780 requested a review from DmitryDodzin January 14, 2025 14:43
Copy link
Member

@meowjesty meowjesty left a comment

Choose a reason for hiding this comment

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

Just some small stuff.

So if we save the config to an env var, we don't get the templating breaking on get_env secondary calls? Since we only do it once, is that what this PR is solving?

mirrord/config/Cargo.toml Show resolved Hide resolved
mirrord/config/src/feature/network/incoming.rs Outdated Show resolved Hide resolved
mirrord/config/src/lib.rs Outdated Show resolved Hide resolved
mirrord/config/src/lib.rs Outdated Show resolved Hide resolved
mirrord/config/src/lib.rs Outdated Show resolved Hide resolved
mirrord/config/src/lib.rs Outdated Show resolved Hide resolved
mirrord/config/src/lib.rs Outdated Show resolved Hide resolved
mirrord/config/src/lib.rs Outdated Show resolved Hide resolved
mirrord/config/src/lib.rs Outdated Show resolved Hide resolved
mirrord/cli/src/execution.rs Outdated Show resolved Hide resolved
@gememma
Copy link
Member Author

gememma commented Jan 14, 2025

So if we save the config to an env var, we don't get the templating breaking on get_env secondary calls? Since we only do it once, is that what this PR is solving?

@meowjesty That's correct - the config template variables get resolved when the config file is rendered by Tera, which previously happened on every process. This causes an issue when a process tries to, for example, call get_env() to render the config but the process doesnt have access to the same env as previous ones - doing the get_env() call only once will solve this :) plus I think this way is more sensible in terms of reducing pointless recalculation and having fewer sources of truth

Copy link
Member

@DmitryDodzin DmitryDodzin left a comment

Choose a reason for hiding this comment

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

I would check mirrord container due to changes to MIRRORD_CONNECT_TCP_ENV in exec, it should work but I would double check

mirrord/config/src/agent.rs Outdated Show resolved Hide resolved
MIRRORD_CONNECT_TCP_ENV.to_string(),
format!("127.0.0.1:{}", address.port()),
);
let mut config = config.clone();
Copy link
Member

Choose a reason for hiding this comment

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

Im a bit worried for container feature behaviour where we split up the env variables for sidecar and main container relying on MIRRORD_CONNECT_TCP_ENV as env value

Copy link
Member Author

@gememma gememma Jan 15, 2025

Choose a reason for hiding this comment

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

shouldnt it get passed through by the config anyway? the only time the env var is accessed is when a new config is created so the value should already be in there, right? you're right, there are definitely issues with config calculation - i think the container command relies pretty heavily on the config being re-calculated a few times, so it may have to be done manually

mirrord/config/src/lib.rs Show resolved Hide resolved
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.

mirrord + vscode + templating seems to get ide to hang
3 participants