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

Mqtt fixes #222

Merged
merged 6 commits into from
Oct 31, 2023
Merged

Mqtt fixes #222

merged 6 commits into from
Oct 31, 2023

Conversation

maurerle
Copy link
Member

This includes fixes to running the MQTT container with docker for a distributed simulation.

For distributed simulations, one can start
python examples/distributed_world_manager.py in one terminal and run
python examples/distributed_world_agent.py in another one.

A registry of which agents are available (and must be online before simulation can start) and a central yaml config are still needed.
So this is an early fix set, which should not change anything to existing behavior

this allows to just use a different simulation body
@codecov
Copy link

codecov bot commented Oct 23, 2023

Codecov Report

Attention: 3 lines in your changes are missing coverage. Please review.

Comparison is base (606c335) 78.03% compared to head (7482680) 78.10%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #222      +/-   ##
==========================================
+ Coverage   78.03%   78.10%   +0.07%     
==========================================
  Files          40       40              
  Lines        4198     4198              
==========================================
+ Hits         3276     3279       +3     
+ Misses        922      919       -3     
Flag Coverage Δ
pytest 78.10% <66.66%> (+0.07%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
assume/common/outputs.py 49.49% <100.00%> (+<0.01%) ⬆️
assume/markets/base_market.py 87.63% <ø> (ø)
assume/world.py 82.35% <57.14%> (+1.77%) ⬆️

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@kim-mskw
Copy link
Contributor

I hardly get what is happening here. Nice though if it works. I am looking forward to next development meeting :)

@@ -397,7 +397,10 @@ async def clear_market(self, market_products: list[MarketProduct]):

for meta in market_meta:
logger.debug(
f'clearing price for {self.marketconfig.name} is {meta["price"]:.2f}, volume: {meta["demand_volume"]}'
"clearing price for %s is %.2f, volume: %f",
self.marketconfig.name,
Copy link
Member

Choose a reason for hiding this comment

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

can we please stick to one format for strings? In the whole code we are using f"{}" format. it would be confusing to have it different in some places.

Copy link
Member Author

Choose a reason for hiding this comment

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

I had this view too for quite a while.
But unfortunately, formatting with f-strings is evaluated every time - even if the logger is set to warning (so the price is formatted even if the line is not printed).
Using it with the % notation does only execute the formatting when loglevel is set to debug.

But I would not like to switch to the %s notation on all other places.. 🤷
So I think we can't really do anything but to use the %s format in logger situations and format strings everywhere else

Copy link
Member

Choose a reason for hiding this comment

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

hmm, good to know, let's keep it this way

@maurerle
Copy link
Member Author

Weird that get_sum_reward did not have a length and I needed to handle that case?
This does not occur on my device though.

@nick-harder nick-harder merged commit e537ad6 into main Oct 31, 2023
3 of 4 checks passed
@nick-harder nick-harder deleted the mqtt_fixes branch October 31, 2023 15:31
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.

3 participants