Skip to content

Commit

Permalink
Merge pull request #110 from valory-xyz/fix/policy
Browse files Browse the repository at this point in the history
Fix tools' loading logic
  • Loading branch information
Adamantios authored Oct 20, 2023
2 parents 3a10217 + acee69d commit c52e1ee
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 19 deletions.
10 changes: 5 additions & 5 deletions packages/packages.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"dev": {
"skill/valory/market_manager_abci/0.1.0": "bafybeigmy3g2klkzdhttti2ouxf575ua5y7ajmh4a3yfpukeukqxjky47m",
"skill/valory/decision_maker_abci/0.1.0": "bafybeifnprgtifiuztmvics57fljowhtj7j5ffph5cwdc2sxh5milcjmze",
"skill/valory/trader_abci/0.1.0": "bafybeigihuarm5766mojeeyipw7exkskotag2lsqba24z5jmihiqckri54",
"skill/valory/decision_maker_abci/0.1.0": "bafybeig6ifzd7ro7g7z45lfh3zqwzsihg2fb7w4wywwd5glvfmhvqntecy",
"skill/valory/trader_abci/0.1.0": "bafybeieydypwnqrelkyabe76oz5auue6kfb2bi5xb5ovb6bjwxvx7xf4di",
"contract/valory/market_maker/0.1.0": "bafybeif4mm2s3gxtvp227yypkcnna5ftec7vajcftvtbdmqddh7nprah5m",
"agent/valory/trader/0.1.0": "bafybeia65a6el4zwoblik53k6nqxby6mbuylccdfwegta5jpphcnzy2exi",
"service/valory/trader/0.1.0": "bafybeif77evw6h4ex7vkneqmnafdv4v7l43bl7yrtgo5smq5grrl7hloiu",
"agent/valory/trader/0.1.0": "bafybeihfanl3msr4kbqvzbb2huk347yfqnx4nf4bw6nevlpkmuwvz72w34",
"service/valory/trader/0.1.0": "bafybeigzai5dxiveztgedy2slpjhhflumah6axknojlhz5pqrodkfvjo4a",
"contract/valory/erc20/0.1.0": "bafybeibysifjwhlcn7nntsjkowdmja53ed6urfzypi6sxfc7chtheecvpi",
"skill/valory/tx_settlement_multiplexer_abci/0.1.0": "bafybeib5zblszm5h5gcdxjl55wumda2diztbiti6d67vhy46wduhyvs34e",
"skill/valory/tx_settlement_multiplexer_abci/0.1.0": "bafybeiaxdrwdbzz6n5iotjgl5v5q6p76eu7yvj342m5hozalpuocipy5ei",
"contract/valory/mech/0.1.0": "bafybeifaavuqr2bz7nypapjwkufc5c6vwxm5ifucmtd3w7sh42tne35nga",
"contract/valory/realitio/0.1.0": "bafybeic3wihpzz4deguslpzlnsgrlrabclq3njwuagyaiiv6rzqujfrs6e",
"contract/valory/realitio_proxy/0.1.0": "bafybeidx37xzjjmapwacedgzhum6grfzhp5vhouz4zu3pvpgdy5pgb2fr4",
Expand Down
6 changes: 3 additions & 3 deletions packages/valory/agents/trader/aea-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ skills:
- valory/reset_pause_abci:0.1.0:bafybeicpxn2khtaesuf4cq6ypwdmdmonlqroj2q2i6cxvpizc2y4cw66pe
- valory/termination_abci:0.1.0:bafybeieqm46zuccaagnko3qlw6p3nvoohdrfgvpmw467r5lyil2dqrzjsy
- valory/transaction_settlement_abci:0.1.0:bafybeia6cdxdlqrcwk2maw25fo7dafzd2p3rs7syropvufophk2pitzbwy
- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeib5zblszm5h5gcdxjl55wumda2diztbiti6d67vhy46wduhyvs34e
- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeiaxdrwdbzz6n5iotjgl5v5q6p76eu7yvj342m5hozalpuocipy5ei
- valory/market_manager_abci:0.1.0:bafybeigmy3g2klkzdhttti2ouxf575ua5y7ajmh4a3yfpukeukqxjky47m
- valory/decision_maker_abci:0.1.0:bafybeifnprgtifiuztmvics57fljowhtj7j5ffph5cwdc2sxh5milcjmze
- valory/trader_abci:0.1.0:bafybeigihuarm5766mojeeyipw7exkskotag2lsqba24z5jmihiqckri54
- valory/decision_maker_abci:0.1.0:bafybeig6ifzd7ro7g7z45lfh3zqwzsihg2fb7w4wywwd5glvfmhvqntecy
- valory/trader_abci:0.1.0:bafybeieydypwnqrelkyabe76oz5auue6kfb2bi5xb5ovb6bjwxvx7xf4di
default_ledger: ethereum
required_ledgers:
- ethereum
Expand Down
2 changes: 1 addition & 1 deletion packages/valory/services/trader/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ license: Apache-2.0
fingerprint:
README.md: bafybeigtuothskwyvrhfosps2bu6suauycolj67dpuxqvnicdrdu7yhtvq
fingerprint_ignore_patterns: []
agent: valory/trader:0.1.0:bafybeia65a6el4zwoblik53k6nqxby6mbuylccdfwegta5jpphcnzy2exi
agent: valory/trader:0.1.0:bafybeihfanl3msr4kbqvzbb2huk347yfqnx4nf4bw6nevlpkmuwvz72w34
number_of_agents: 4
deployment: {}
---
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,10 +176,8 @@ def _get_tools(
):
yield from self.wait_for_condition_with_sleep(step)

def _adjust_policy_tools(self) -> None:
def _adjust_policy_tools(self, local: List[str]) -> None:
"""Add or remove tools from the policy to match the remote tools."""
local = self.synchronized_data.available_mech_tools

# remove tools if they are not available anymore
# process the indices in reverse order to avoid index shifting when removing the unavailable tools later
reversed_idx = range(len(local) - 1, -1, -1)
Expand All @@ -196,11 +194,12 @@ def _set_policy(self) -> None:
"""Set the E Greedy Policy."""
if self.is_first_period:
self._policy = self._get_init_policy()
recovered_tools = self._try_recover_mech_tools()
self.mech_tools = list(set(self.mech_tools + recovered_tools))
local_tools = self._try_recover_mech_tools()
else:
self._policy = self.synchronized_data.policy
self._adjust_policy_tools()
local_tools = self.synchronized_data.available_mech_tools

self._adjust_policy_tools(local_tools)

def _get_init_policy(self) -> EGreedyPolicy:
"""Get the initial policy"""
Expand Down
2 changes: 1 addition & 1 deletion packages/valory/skills/decision_maker_abci/skill.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ fingerprint:
behaviours/reedem.py: bafybeiccrnttqwf5vuf3lr55k5c6tsqsrekoypoag5gntyimjhbmuokkga
behaviours/round_behaviour.py: bafybeig4tdktyu6hapoqymnxh2bgpds547st6a44heue657wkctwe4gjvm
behaviours/sampling.py: bafybeiadikynvkaofbko72jc45xthhmmjfmlkpgramormhxwk5u47rnwdu
behaviours/tool_selection.py: bafybeigbxgm6rl6jnexxzjhb7thsdaqr56wfhxpve25yxlr7eyswf6lsey
behaviours/tool_selection.py: bafybeiaoai4vsee7ndkl3bzmfgfize2vbc73un5hzplse7icmo5adqwory
dialogues.py: bafybeigpwuzku3we7axmxeamg7vn656maww6emuztau5pg3ebsoquyfdqm
fsm_specification.yaml: bafybeifnob3ceim2mj7lqagtnpwqjqqxs5eg3oiwc73gwm6x5i2dvvlcya
handlers.py: bafybeihj33szgrcxnpd73s4nvluyxwwsvhjum2cuq3ilhhe6vfola3k7vy
Expand Down
4 changes: 2 additions & 2 deletions packages/valory/skills/trader_abci/skill.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ skills:
- valory/transaction_settlement_abci:0.1.0:bafybeia6cdxdlqrcwk2maw25fo7dafzd2p3rs7syropvufophk2pitzbwy
- valory/termination_abci:0.1.0:bafybeieqm46zuccaagnko3qlw6p3nvoohdrfgvpmw467r5lyil2dqrzjsy
- valory/market_manager_abci:0.1.0:bafybeigmy3g2klkzdhttti2ouxf575ua5y7ajmh4a3yfpukeukqxjky47m
- valory/decision_maker_abci:0.1.0:bafybeifnprgtifiuztmvics57fljowhtj7j5ffph5cwdc2sxh5milcjmze
- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeib5zblszm5h5gcdxjl55wumda2diztbiti6d67vhy46wduhyvs34e
- valory/decision_maker_abci:0.1.0:bafybeig6ifzd7ro7g7z45lfh3zqwzsihg2fb7w4wywwd5glvfmhvqntecy
- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeiaxdrwdbzz6n5iotjgl5v5q6p76eu7yvj342m5hozalpuocipy5ei
behaviours:
main:
args: {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ contracts: []
protocols: []
skills:
- valory/abstract_round_abci:0.1.0:bafybeid7neqpxxe4ualp23gxgrtpf6r5u3myr2mmc4uvwameyqshfdoydq
- valory/decision_maker_abci:0.1.0:bafybeifnprgtifiuztmvics57fljowhtj7j5ffph5cwdc2sxh5milcjmze
- valory/decision_maker_abci:0.1.0:bafybeig6ifzd7ro7g7z45lfh3zqwzsihg2fb7w4wywwd5glvfmhvqntecy
behaviours:
main:
args: {}
Expand Down

0 comments on commit c52e1ee

Please sign in to comment.