Skip to content

Commit

Permalink
Merge pull request #272 from valory-xyz/feat/better-logs
Browse files Browse the repository at this point in the history
Feat/better logs
  • Loading branch information
KahanMajmudar authored Nov 26, 2024
2 parents e117b91 + 3a1c1ce commit d273235
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 21 deletions.
10 changes: 5 additions & 5 deletions packages/packages.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@
"contract/valory/mech_marketplace/0.1.0": "bafybeigulghv7bvx4evl6kmogvv6gjxovyt22tkwlbdmeretmop2crdmem",
"connection/valory/websocket_client/0.1.0": "bafybeic4ag3gqc7kd3k2o3pucddj2odck5yrfbgmwh5veqny7zao5qayli",
"skill/valory/contract_subscription/0.1.0": "bafybeiefuemlp75obgpxrp6iuleb3hn6vcviwh5oetk5djbuprf4xsmgjy",
"skill/valory/mech_abci/0.1.0": "bafybeiesfwxmlidywoifnkhuvjlqaknr76lsqprbkzfxdpb4x5op5sgjfe",
"skill/valory/task_submission_abci/0.1.0": "bafybeigxi5we2lfaqhy2vlt7ktp7gnjx4k3e2poy4y33jmjhfyb5fzmqhq",
"skill/valory/mech_abci/0.1.0": "bafybeiaaysktq3d5eyl4g45w3qy7e7qlfpc4hiwkzls67geishe7rchrpa",
"skill/valory/task_submission_abci/0.1.0": "bafybeidqfcdgvhp5dkhxeuibv4avpkdhpdmrfwpxwmwkkpjxvs5o6m3aw4",
"skill/valory/task_execution/0.1.0": "bafybeibv46pbo2qntbensudrrkx7dlrnmvufvijpqzqyn3wrztxmr3s6pq",
"skill/valory/websocket_client/0.1.0": "bafybeif7rrvsu6z4evqkhblxj3u6wwv2eqou576hgkyoehxuj7cntw7o2m",
"skill/valory/subscription_abci/0.1.0": "bafybeifilanuxfvuypcccjku7nphurgp27i2iwncdmug3in6xuzfmslgaq",
"agent/valory/mech/0.1.0": "bafybeidwavbqnqvd7qudym2hryryitzpbr75hmfm4yncf2pw3yrdt2uyrm",
"service/valory/mech/0.1.0": "bafybeid2jdy7ez75gtll5d6lu6wqy6dzdh3bl7gxjgc33hpquftipv53rm",
"service/valory/mech_quickstart/0.1.0": "bafybeidawm5ni2nkojx3mytwjbkei6zge7pd6sfkonsgbg2yakhawfwe3u"
"agent/valory/mech/0.1.0": "bafybeif6pnr5gydwdhuxtw3y4yldaptgqidt5pl7syjs7rryqsc4lu33j4",
"service/valory/mech/0.1.0": "bafybeihjebdhmx4kaya4tme4d2k43vpuacq2tj4ayo73mwxgh3e7evqu34",
"service/valory/mech_quickstart/0.1.0": "bafybeic7nyt734ysd2agj352zlxhxxemi6laeevclvepzzlm53oqp3hwxi"
},
"third_party": {
"protocol/valory/default/1.0.0": "bafybeifqcqy5hfbnd7fjv4mqdjrtujh2vx3p2xhe33y67zoxa6ph7wdpaq",
Expand Down
10 changes: 5 additions & 5 deletions packages/valory/agents/mech/aea-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,12 @@ skills:
- valory/abstract_abci:0.1.0:bafybeieo7pe5wqjphs5izpz5aujjbubymlxub62b3rhx6yglu65ibalffu
- valory/abstract_round_abci:0.1.0:bafybeibiw4oqwqvo4jccwz5fb73iardzychgvcl66tceiildohoju2ikti
- valory/contract_subscription:0.1.0:bafybeiefuemlp75obgpxrp6iuleb3hn6vcviwh5oetk5djbuprf4xsmgjy
- valory/mech_abci:0.1.0:bafybeiesfwxmlidywoifnkhuvjlqaknr76lsqprbkzfxdpb4x5op5sgjfe
- valory/mech_abci:0.1.0:bafybeiaaysktq3d5eyl4g45w3qy7e7qlfpc4hiwkzls67geishe7rchrpa
- valory/registration_abci:0.1.0:bafybeib3n6vqkfbrcubcbliebjnuwyywdinxkbzt76n6gbn2kg7ace47dq
- valory/reset_pause_abci:0.1.0:bafybeihkj6lmaypspyxe5qqrjgnolyck62pyvqoylr24ab6ue4steqcw7e
- valory/subscription_abci:0.1.0:bafybeifilanuxfvuypcccjku7nphurgp27i2iwncdmug3in6xuzfmslgaq
- valory/task_execution:0.1.0:bafybeibv46pbo2qntbensudrrkx7dlrnmvufvijpqzqyn3wrztxmr3s6pq
- valory/task_submission_abci:0.1.0:bafybeigxi5we2lfaqhy2vlt7ktp7gnjx4k3e2poy4y33jmjhfyb5fzmqhq
- valory/task_submission_abci:0.1.0:bafybeidqfcdgvhp5dkhxeuibv4avpkdhpdmrfwpxwmwkkpjxvs5o6m3aw4
- valory/termination_abci:0.1.0:bafybeifi2uodnrjsrivj53g3sjutocmyusbx6mlsb6oanqdyt2mfbyvusy
- valory/transaction_settlement_abci:0.1.0:bafybeigh2vkt74jrad5gtsczrgqcuhcqe7jkgjy7jdw56yamlzwwnaymjy
- valory/websocket_client:0.1.0:bafybeif7rrvsu6z4evqkhblxj3u6wwv2eqou576hgkyoehxuj7cntw7o2m
Expand All @@ -60,7 +60,7 @@ logging_config:
disable_existing_loggers: false
formatters:
standard:
format: '[%(asctime)s] [%(levelname)s] %(message)s'
format: '[%(asctime)s] [%(levelname)s] [%(name)s] %(message)s'
handlers:
logfile:
class: logging.FileHandler
Expand Down Expand Up @@ -205,8 +205,8 @@ models:
"prediction-sentence-embedding-conservative":"bafybeihsyxhchqgtdwsd53z4a2lswt6ri4fre2yg2bpjo36kwboilsp7ai",
"prediction-sentence-embedding-bold":"bafybeihsyxhchqgtdwsd53z4a2lswt6ri4fre2yg2bpjo36kwboilsp7ai",
"prediction-online-sum-url-content":"bafybeial5a56vsowqu4suynnmv5pkt5iebkxtmpgrae57qzi7s6tg4vq6e"}}
api_keys: ${dict:{"openai":"dummy_api_key", "stabilityai":"dummy_api_key", "google_api_key":"dummy_api_key",
"google_engine_id":"dummy_api_key"}}
api_keys: ${dict:{"openai":["dummy_api_key"], "stabilityai":["dummy_api_key"],
"google_api_key":["dummy_api_key"], "google_engine_id":["dummy_api_key"]}}
polling_interval: ${float:30.0}
agent_index: ${int:0}
num_agents: ${int:4}
Expand Down
2 changes: 1 addition & 1 deletion packages/valory/services/mech/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: bafybeif7ia4jdlazy6745ke2k2x5yoqlwsgwr6sbztbgqtwvs3ndm2p7ba
fingerprint_ignore_patterns: []
agent: valory/mech:0.1.0:bafybeidwavbqnqvd7qudym2hryryitzpbr75hmfm4yncf2pw3yrdt2uyrm
agent: valory/mech:0.1.0:bafybeif6pnr5gydwdhuxtw3y4yldaptgqidt5pl7syjs7rryqsc4lu33j4
number_of_agents: 4
deployment:
agent:
Expand Down
2 changes: 1 addition & 1 deletion packages/valory/services/mech_quickstart/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: bafybeiaqaedhfzjxxdfxtygjulorvd4x2h3cbwtiw3xgbigjgsc6qfn7zy
fingerprint_ignore_patterns: []
agent: valory/mech:0.1.0:bafybeidwavbqnqvd7qudym2hryryitzpbr75hmfm4yncf2pw3yrdt2uyrm
agent: valory/mech:0.1.0:bafybeif6pnr5gydwdhuxtw3y4yldaptgqidt5pl7syjs7rryqsc4lu33j4
number_of_agents: 1
deployment:
agent:
Expand Down
2 changes: 1 addition & 1 deletion packages/valory/skills/mech_abci/skill.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ skills:
- valory/abstract_round_abci:0.1.0:bafybeibiw4oqwqvo4jccwz5fb73iardzychgvcl66tceiildohoju2ikti
- valory/registration_abci:0.1.0:bafybeib3n6vqkfbrcubcbliebjnuwyywdinxkbzt76n6gbn2kg7ace47dq
- valory/reset_pause_abci:0.1.0:bafybeihkj6lmaypspyxe5qqrjgnolyck62pyvqoylr24ab6ue4steqcw7e
- valory/task_submission_abci:0.1.0:bafybeigxi5we2lfaqhy2vlt7ktp7gnjx4k3e2poy4y33jmjhfyb5fzmqhq
- valory/task_submission_abci:0.1.0:bafybeidqfcdgvhp5dkhxeuibv4avpkdhpdmrfwpxwmwkkpjxvs5o6m3aw4
- valory/termination_abci:0.1.0:bafybeifi2uodnrjsrivj53g3sjutocmyusbx6mlsb6oanqdyt2mfbyvusy
- valory/transaction_settlement_abci:0.1.0:bafybeigh2vkt74jrad5gtsczrgqcuhcqe7jkgjy7jdw56yamlzwwnaymjy
- valory/subscription_abci:0.1.0:bafybeifilanuxfvuypcccjku7nphurgp27i2iwncdmug3in6xuzfmslgaq
Expand Down
14 changes: 7 additions & 7 deletions packages/valory/skills/task_submission_abci/behaviours.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
import time
from abc import ABC
from copy import deepcopy
from typing import Any, Dict, Generator, List, Optional, Set, Type, cast
from typing import Any, Dict, Generator, List, Optional, Set, Tuple, Type, cast

from aea.helpers.cid import CID, to_v1
from multibase import multibase
Expand Down Expand Up @@ -215,19 +215,19 @@ def get_done_tasks(self, timeout: float) -> Generator[None, None, List[Dict]]:

def handle_submitted_tasks(self) -> None:
"""Handle tasks that have been already submitted before (in a prev. period)."""
status = self.check_last_tx_status()
(status, tx_hash) = self.check_last_tx_status()
self.context.logger.info(f"Last tx status is: {status}")
if status:
submitted_tasks = cast(
List[Dict[str, Any]], self.synchronized_data.done_tasks
)
self.context.logger.info(
f"Tasks {submitted_tasks} has already been submitted. "
f"Tasks {submitted_tasks} has already been submitted. The corresponding tx_hash is: {tx_hash}"
f"Removing them from the list of tasks to be processed."
)
self.remove_tasks(submitted_tasks)

def check_last_tx_status(self) -> bool:
def check_last_tx_status(self) -> Tuple[bool, str]:
"""Check if the tx in the last round was successful or not"""
# Try to fetch the final tx hash from the sync db
# If the value exists and is not None, we return True, else False
Expand All @@ -238,12 +238,12 @@ def check_last_tx_status(self) -> bool:
self.set_tx(final_tx_hash)
except Exception as e:
self.context.logger.error(e)
return False
return (False, "")
else:
if final_tx_hash is not None:
return True
return (True, final_tx_hash)
else:
return False
return (False, "")


class DeliverBehaviour(TaskExecutionBaseBehaviour, ABC):
Expand Down
2 changes: 1 addition & 1 deletion packages/valory/skills/task_submission_abci/skill.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ license: Apache-2.0
aea_version: '>=1.0.0, <2.0.0'
fingerprint:
__init__.py: bafybeiholqak7ltw6bbmn2c5tn3j7xgzkdlfzp3kcskiqsvmxoih6m4muq
behaviours.py: bafybeib6gtwgaodrwuam5wpm2sgdo3h2j5czfm37ct6ndupapq6jrw5sli
behaviours.py: bafybeial5w6zhx2lmu2ef7ewp36qjp7ke6ydsln2untkftgigeegw6txne
dialogues.py: bafybeibmac3m5u5h6ucoyjr4dazay72dyga656wvjl6z6saapluvjo54ne
fsm_specification.yaml: bafybeidtmsmpunr3t77pshd3k2s6dd6hlvhze6inu3gj7xyvlg4wi3tnuu
handlers.py: bafybeibe5n7my2vd2wlwo73sbma65epjqc7kxgtittewlylcmvnmoxtxzq
Expand Down

0 comments on commit d273235

Please sign in to comment.