-
Notifications
You must be signed in to change notification settings - Fork 16
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
Implement a benchmarking mode #252
Conversation
73b601a
to
3f95295
Compare
Also adds the `check_stop_trading_abci` to the `testenv` in `tox.ini`.
Pinned because of safety's reported vulnerability with id 64227. The new `tomte` version addresses this as its lockfile has set `jinja2 ==3.1.3`.
3f95295
to
ea9e901
Compare
Continues work on 128db35.
Continues work on 128db35.
This reverts commit 4c9e42e.
Fixes the issue with cross-period persisted keys not being available after a reset when using the benchmarking mode. This change should ideally be moved to the core to avoid hacking around here. Extending the `setup` method with this functionality can be the solution in valory-xyz/open-autonomy#2131.
Performs the change intended in 4c9e42e.
In order to run the mocked trader's version the following environment variables need to be set:
Other variables can also be set - you may find them under the benchmarking_mode - in order to change the behaviour of the mocked agent. Optionally, you may also set the All these environment variables can be set in the quickstart script to simplify the running process. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well done.
args: | ||
enabled: ${bool:false} | ||
native_balance: ${int:10000000000000000000} | ||
collateral_balance: ${int:10000000000000000000} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why int instead of float? I heard that the bet amounts can be very low and may include decimals
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are in WEI.
return | ||
|
||
add_headers = False | ||
results_path = self.params.store_path / self.benchmarking_mode.results_filename |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if you prefer to have a separate folder called "benchmarking_results" in order not to be mixed with other data you have in that store folder...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That would require changes in the quickstart. Let's keep it simple for now.
) | ||
results_text = tuple(str(res) for res in results) | ||
row = ",".join(results_text) + NEW_LINE | ||
results_file.write(row) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
where is the results_file.close()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not necessary, as a context manager is used.
@@ -204,9 +204,17 @@ def _prepare_safe_tx(self) -> Generator[None, None, Optional[str]]: | |||
|
|||
def async_act(self) -> Generator: | |||
"""Do the action.""" | |||
agent = self.context.agent_address |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dont you prefer to call the variable agent_address?
if mode.part_prefix_mode: | ||
fields[prediction_attribute] = row[field_part + mech_tool] | ||
else: | ||
fields[prediction_attribute] = row[mech_tool + field_part] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why this alternative? I thought the input files should be consistent with the format of the column names...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was developed before agreeing on the column names etc. It provides flexibility so that we do not need to perform code changes if the input format changes.
@@ -75,9 +75,13 @@ def async_act(self) -> Generator: | |||
"""Do the action.""" | |||
with self.context.benchmark_tool.measure(self.behaviour_id).local(): | |||
payload_content = None | |||
mocking_mode: Optional[bool] = self.benchmarking_mode.enabled |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is the mocking_mode only active for the benchmarking_mode? Then why not giving the same name?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤷♂️
(DecisionReceiveRound, DONE): BetPlacementRound | ||
(DecisionReceiveRound, MECH_RESPONSE_ERROR): BlacklistingRound | ||
(DecisionReceiveRound, NO_MAJORITY): DecisionReceiveRound | ||
(DecisionReceiveRound, ROUND_TIMEOUT): DecisionReceiveRound | ||
(DecisionReceiveRound, TIE): BlacklistingRound | ||
(DecisionReceiveRound, UNPROFITABLE): BlacklistingRound | ||
(DecisionRequestRound, DONE): FinishedDecisionRequestRound | ||
(DecisionRequestRound, NONE): ImpossibleRound |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So the NONE transition is not possible anymore?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was never possible, check the comment:
trader/packages/valory/skills/decision_maker_abci/rounds.py
Lines 207 to 208 in da93b1a
# this is here because of `autonomy analyse fsm-specs` falsely reporting it as missing from the transition | |
Event.NONE: ImpossibleRound, |
"confidence_field_part", kwargs, str | ||
) | ||
# this is the mode for the p and confidence parts | ||
# if the flag is `True`, then the field parts are used as prefixes, otherwise as suffixes |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I prefer to keep only one format, because I need to process this files also for the evaluation part and I prefer to be consistent with column names.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, it does not depend on the code here though, it depends on the input data.
No description provided.