-
Notifications
You must be signed in to change notification settings - Fork 166
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
--fileoutput
writes to stdout instead of file
#213
Comments
Hey, this should be fixed by #218. Can you please confirm it works as expected? |
Tried to run from branch with fix, but unfortunately got another error which do not reproduce on 1.6.0
I provide URL to prometheus using |
Can you try reinstalling the requirements with --upgrade and seeing if that
helps?
…On Mon, Mar 4, 2024, 08:55 theboringstuff ***@***.***> wrote:
Tried to run from branch with fix, but unfortunately got another error
which do not reproduce on 1.6.0
ERROR Failed to load pods for Deployment ###: 'CustomPrometheusConnect' object has no attribute 'safe_custom_query' loader.py:76
Traceback (most recent call last):
File "/home/stanislav/work/tmp/krr/krr-sources/robusta_krr/core/integrations/prometheus/loader.py", line 74, in load_pods
return await self.loader.load_pods(object, period)
File "/home/stanislav/work/tmp/krr/krr-sources/robusta_krr/core/integrations/prometheus/metrics_service/prometheus_metrics_service.py", line 183, in load_pods
replicasets = await self.query(
File "/home/stanislav/work/tmp/krr/krr-sources/robusta_krr/core/integrations/prometheus/metrics_service/prometheus_metrics_service.py", line 111, in query
return await loop.run_in_executor(self.executor, lambda: self.prometheus.safe_custom_query(query=query))
File "/usr/lib/python3.9/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
File "/home/stanislav/work/tmp/krr/krr-sources/robusta_krr/core/integrations/prometheus/metrics_service/prometheus_metrics_service.py", line 111, in <lambda>
return await loop.run_in_executor(self.executor, lambda: self.prometheus.safe_custom_query(query=query))
AttributeError: 'CustomPrometheusConnect' object has no attribute 'safe_custom_query'
I provide URL to prometheus using -p option
—
Reply to this email directly, view it on GitHub
<#213 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AADYUB2KJ3DDFKEJM7WPSFTYWQLFXAVCNFSM6AAAAABDZ6BPTGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNZVHA2TCNJUHE>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
Upgrading requirements helped with the above issue. But then I encountered two more:
|
Thanks for the update. Regarding (1) - that was fixed on master already. I've merged it into this branch now so you shouldn't need a change anymore. Yes, it would make more sense to print to both locations when |
@theboringstuff is this fixed in #231? |
Trying to test from branch, for some reason KRR is getting infinitely stuck after following line
It is not happening on 1.7.1 tag I am running command like
|
In addition to above, I am encountering strange issue on 1.7.1 with stdout:
In both cases I execute the same command, but the stdout is different. I suspect this is something with buffers flushing or something like that, because after I added |
What do you mean about running from go? Can you share all the flags you ran
it with?
…On Fri, Mar 15, 2024, 13:05 theboringstuff ***@***.***> wrote:
In addition to above, I am encountering issue on 1.7.1 with with stdout:
1. When I run KRR from bash, scans are shown in stdout in yaml format
2. When I run KRR from go, scan are not show in stdout in yaml format
In both cases I execute the same command, but the stdout is different. I
suspect this is something with buffers flushing or something like that,
because after I added logger.info("PRINTING") to runner.custom_print it
started working from both bash and go. This is confusing
—
Reply to this email directly, view it on GitHub
<#213 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AADYUBZEMSDZFVZOV2WZI5LYYLIXLAVCNFSM6AAAAABDZ6BPTGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSOJZGQZDGMRZGI>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
I mean running programmatically from go language using
Above command behave differently on different versions:
|
We're investigating a related problem. Will update. |
@theboringstuff does this still occur on the latest commit on master? Curious if it is related to #245 which we just fixed. |
Yes, on
The KRR completes successfully, but this |
@theboringstuff can you try reinstalling the dependencies with pip? This might be due to a dependency that we upgraded. |
Reinstalled KRR deps like this:
Still getting above issue |
Thanks, looking into it. |
This one is a new mechanism we added in latest versions to additionally check if there is enough data in prometheus or not. I did it such way so if it fails - we still try to do the scan (exactly like in your case). So, you can just ignore it as it does not affect results. But I will change that so the message is not that scary (maybe make it a warning?) |
Would be nice, because we have automated processing of KRR output and if it contains |
Is there a reason you process the output for ERRORs? I feel like CLI return codes from KRR's side should work for that |
We process both exit code and
So, in this case, if we do not check Maybe this particular case is no longer actual on main, but I feel that it still makes sense to check for In short, we process |
I still feel like we need to do required work from our side, so that you can use exitCodes only (maybe even it was done already) Thanks for explanation, @theboringstuff |
Describe the bug
It seems
--fileoutput
no longer works in 1.7.0 after #162Instead of writing to file, it writes to stdout twice. The reason is most probably recursive call to shadowed
print
To Reproduce
simple -f yaml --fileoutput <file>
Expected behavior
Recommendations are printed once in stdout and once in file
Are you interested in contributing a fix for this?
Yes
The text was updated successfully, but these errors were encountered: