Repository navigation
Conversation
optimization_providers/base.py calls get_phase_stats_single from api/scenario_runner in the runner process, so phase stats caching reaches store_artifact and needs green-coding-redis-container to resolve on the host. lib/install_shared.sh writes that hosts entry, .devcontainer/on-start.sh only wrote the postgres name. In a codespace every measurement with optimizations enabled therefore logged "Error -2 connecting to green-coding-redis-container:6379. Name or service not known." and lost the phase stats cache write.
|
Thanks for the PR! Can you let me know:
If they have been manually activated: What do you want to find out with the optimizations in a codespace? Technically the codespace is a quite unreliable env in regards to performance guarantees. So many optimizations provide unreliable results. I want to better understand the use-case to decide if optimizations should be hard blocked and not even be possible to enable, or maybe enabled by default but warnings added. |
|
@ribalba Did you also encounter this when you recently overhauled the Codespace Implementation? |
|
Fetching optimizations only on request would fix the warning issue for me. But I still have to set |
|
Sounds good. We can make optimizations opt-in. Actually something we have discussed internally for a while. Do you have a date until you need this patch, so we can plan best when to prioritze this? |
|
The next training is scheduled for the 7th December (not sure yet if there are enough participants). Should we close this PR? |


In a GitHub Codespace, a measurement run with optimizations enabled writes this to
system_logs:Cause
optimization_providers/base.pycallsget_phase_stats_singlefromapi/scenario_runnerin the runner process instead of over HTTP, and that function ends withstore_artifact(ArtifactType.STATS, ...), which connects to the redis host fromconfig.yml:green-coding-redis-container:6379.On the host that name only resolves through
/etc/hosts.lib/install_shared.shwrites127.0.0.1 green-coding-postgres-container green-coding-redis-container,.devcontainer/on-start.shwrote the postgres name only. So in a codespace postgres resolves and redis does not: the error only shows up in codespaces, only on the optimizations path, and it survives container restarts.What is not the cause
Container networking and startup order, measured in the codespace while the errors were being logged:
getent hostsinsidegreen-coding-gunicorn-containerresolves bothgreen-coding-postgres-container(172.18.0.2) andgreen-coding-redis-container(172.18.0.4).green-metrics-tool_default.RestartCount=0, exit code 0, not OOM-killed; it started 90 ms before gunicorn and the last error was logged 81 s after that start.127.0.0.1:6379publish indocker/compose.ymlis host-only and is not used by this path.--skip-optimizationshides the error becauseoptimization_providers/base.pyis then never called.Change
on-start.shwrites the same hosts entry asinstall_shared.sh.Verification
Verified in a codespace with the hosts entry in place. The rows from before the fix stay in the table, so the check is that a run with optimizations enabled adds none:
The run finished at
12:16:42 UTC, the newest error row is12:55:44+01(=11:55:44 UTC), 21 minutes before it. Non-codespace installs were already fine: a local install has the combined line in/etc/hostsand both names resolve to127.0.0.1.Impact of the bug
Lost cache write plus one error row per run.
store_artifactcatches the exception, so the phase stats are still computed and returned and the optimizations still run.Created by pi (AI agent), reviewed by me.
Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.