Skip to content

Commit

Permalink
Merge pull request #111 from valory-xyz/fix/policy
Browse files Browse the repository at this point in the history
Fix the mech tools' recover logic
  • Loading branch information
Adamantios authored Oct 24, 2023
2 parents c52e1ee + 7f1ea2f commit 3b11322
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 15 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": "bafybeig6ifzd7ro7g7z45lfh3zqwzsihg2fb7w4wywwd5glvfmhvqntecy",
"skill/valory/trader_abci/0.1.0": "bafybeieydypwnqrelkyabe76oz5auue6kfb2bi5xb5ovb6bjwxvx7xf4di",
"skill/valory/decision_maker_abci/0.1.0": "bafybeidrhscz3ihlij2lkl6eusn4skf2ruydxjowiiorzgszmoav4b7kae",
"skill/valory/trader_abci/0.1.0": "bafybeidgs3jvdkobqjorclcy4xlzlsywr6uklrzudfg3fa5qgvohl7d3pu",
"contract/valory/market_maker/0.1.0": "bafybeif4mm2s3gxtvp227yypkcnna5ftec7vajcftvtbdmqddh7nprah5m",
"agent/valory/trader/0.1.0": "bafybeihfanl3msr4kbqvzbb2huk347yfqnx4nf4bw6nevlpkmuwvz72w34",
"service/valory/trader/0.1.0": "bafybeigzai5dxiveztgedy2slpjhhflumah6axknojlhz5pqrodkfvjo4a",
"agent/valory/trader/0.1.0": "bafybeidu72c7bcvwtdy5rl25u2pnem2ma6ttaw5buvoyo4uzydbzdfv3ty",
"service/valory/trader/0.1.0": "bafybeibec7y24h6i7r4vxt2z5nwddnwlbn6ci25tn2iki2jt4jpdpxokbi",
"contract/valory/erc20/0.1.0": "bafybeibysifjwhlcn7nntsjkowdmja53ed6urfzypi6sxfc7chtheecvpi",
"skill/valory/tx_settlement_multiplexer_abci/0.1.0": "bafybeiaxdrwdbzz6n5iotjgl5v5q6p76eu7yvj342m5hozalpuocipy5ei",
"skill/valory/tx_settlement_multiplexer_abci/0.1.0": "bafybeibsb2ynewsziwikz53uetzcc3exxd7n4ey2x4blmb4gwdzggn2veu",
"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:bafybeiaxdrwdbzz6n5iotjgl5v5q6p76eu7yvj342m5hozalpuocipy5ei
- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeibsb2ynewsziwikz53uetzcc3exxd7n4ey2x4blmb4gwdzggn2veu
- valory/market_manager_abci:0.1.0:bafybeigmy3g2klkzdhttti2ouxf575ua5y7ajmh4a3yfpukeukqxjky47m
- valory/decision_maker_abci:0.1.0:bafybeig6ifzd7ro7g7z45lfh3zqwzsihg2fb7w4wywwd5glvfmhvqntecy
- valory/trader_abci:0.1.0:bafybeieydypwnqrelkyabe76oz5auue6kfb2bi5xb5ovb6bjwxvx7xf4di
- valory/decision_maker_abci:0.1.0:bafybeidrhscz3ihlij2lkl6eusn4skf2ruydxjowiiorzgszmoav4b7kae
- valory/trader_abci:0.1.0:bafybeidgs3jvdkobqjorclcy4xlzlsywr6uklrzudfg3fa5qgvohl7d3pu
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:bafybeihfanl3msr4kbqvzbb2huk347yfqnx4nf4bw6nevlpkmuwvz72w34
agent: valory/trader:0.1.0:bafybeidu72c7bcvwtdy5rl25u2pnem2ma6ttaw5buvoyo4uzydbzdfv3ty
number_of_agents: 4
deployment: {}
---
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,8 @@ def _set_policy(self) -> None:
if self.is_first_period:
self._policy = self._get_init_policy()
local_tools = self._try_recover_mech_tools()
if local_tools is None:
local_tools = self.mech_tools
else:
self._policy = self.synchronized_data.policy
local_tools = self.synchronized_data.available_mech_tools
Expand Down Expand Up @@ -236,7 +238,7 @@ def _try_recover_utilized_tools(self) -> Optional[Dict[str, Any]]:
self.context.logger.warning(f"Could not recover the tools: {e}.")
return None

def _try_recover_mech_tools(self) -> List[str]:
def _try_recover_mech_tools(self) -> Optional[List[str]]:
"""Try to recover the available tools from the tools store."""
try:
tools_path = self.params.policy_store_path / self.AVAILABLE_TOOLS_STORE
Expand All @@ -245,7 +247,7 @@ def _try_recover_mech_tools(self) -> List[str]:
return tools
except Exception as e:
self.context.logger.warning(f"Could not recover the tools: {e}.")
return []
return None

def _select_tool(self) -> Generator[None, None, Optional[int]]:
"""Select a Mech tool based on an e-greedy policy and return its index."""
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: bafybeiaoai4vsee7ndkl3bzmfgfize2vbc73un5hzplse7icmo5adqwory
behaviours/tool_selection.py: bafybeigfr2frkljrxyfxs5p3j42equzehgaqtkyuxk6eiujyudr6ajqakm
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:bafybeig6ifzd7ro7g7z45lfh3zqwzsihg2fb7w4wywwd5glvfmhvqntecy
- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeiaxdrwdbzz6n5iotjgl5v5q6p76eu7yvj342m5hozalpuocipy5ei
- valory/decision_maker_abci:0.1.0:bafybeidrhscz3ihlij2lkl6eusn4skf2ruydxjowiiorzgszmoav4b7kae
- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeibsb2ynewsziwikz53uetzcc3exxd7n4ey2x4blmb4gwdzggn2veu
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:bafybeig6ifzd7ro7g7z45lfh3zqwzsihg2fb7w4wywwd5glvfmhvqntecy
- valory/decision_maker_abci:0.1.0:bafybeidrhscz3ihlij2lkl6eusn4skf2ruydxjowiiorzgszmoav4b7kae
behaviours:
main:
args: {}
Expand Down

0 comments on commit 3b11322

Please sign in to comment.