Skip to content

Commit 0ec1b5f

Browse files
Merge pull request #1933 from fetchai/develop
Release v0.7.3
2 parents ad0562d + 69f4a17 commit 0ec1b5f

104 files changed

Lines changed: 2901 additions & 401 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

HISTORY.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,18 @@
11
# Release History
22

3+
## 0.7.3 (2020-11-12)
4+
5+
- Extends AW AEAs
6+
- Fixes overwriting of private key files on startup
7+
- Fixes behaviour bugs
8+
- Adds tests for tac participation skill
9+
- Adds development setup guide
10+
- Improves exception logging for easier debugging
11+
- Fixes mixed mode in upgrade command
12+
- Reduces verbosity of some CLI commands
13+
- Multiple docs updates based on user feedback
14+
- Multiple additional tests and test stability fixes
15+
316
## 0.7.2 (2020-11-09)
417

518
- Fixes some AW2 AEAs

Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,17 +78,17 @@ common_checks: security misc_checks lint static docs
7878

7979
.PHONY: test
8080
test:
81-
pytest -rfE --doctest-modules aea packages/fetchai/protocols packages/fetchai/connections packages/fetchai/skills/generic_buyer packages/fetchai/skills/generic_seller tests/ --cov-report=html --cov-report=xml --cov-report=term-missing --cov-report=term --cov=aea --cov=packages/fetchai/protocols --cov=packages/fetchai/connections --cov=packages/fetchai/skills/generic_buyer --cov-config=.coveragerc
81+
pytest -rfE --doctest-modules aea packages/fetchai/protocols packages/fetchai/connections packages/fetchai/skills/generic_buyer packages/fetchai/skills/generic_seller packages/fetchai/skills/tac_control packages/fetchai/skills/tac_control_contract packages/fetchai/skills/tac_participation tests/ --cov-report=html --cov-report=xml --cov-report=term-missing --cov-report=term --cov=aea --cov=packages/fetchai/protocols --cov=packages/fetchai/connections --cov=packages/fetchai/skills/generic_buyer --cov=packages/fetchai/skills/generic_seller --cov=packages/fetchai/skills/tac_control --cov=packages/fetchai/skills/tac_control_contract --cov=packages/fetchai/skills/tac_participation --cov-config=.coveragerc
8282
find . -name ".coverage*" -not -name ".coveragerc" -exec rm -fr "{}" \;
8383

8484
.PHONY: test-sub
8585
test-sub:
86-
pytest -rfE --doctest-modules aea packages/fetchai/connections packages/fetchai/protocols packages/fetchai/skills/generic_buyer packages/fetchai/skills/generic_seller tests/test_$(tdir) --cov=aea.$(dir) --cov-report=html --cov-report=xml --cov-report=term-missing --cov-report=term --cov-config=.coveragerc
86+
pytest -rfE --doctest-modules aea packages/fetchai/connections packages/fetchai/protocols packages/fetchai/skills/generic_buyer packages/fetchai/skills/generic_seller packages/fetchai/skills/tac_control packages/fetchai/skills/tac_control_contract packages/fetchai/skills/tac_participation tests/test_$(tdir) --cov=aea.$(dir) --cov-report=html --cov-report=xml --cov-report=term-missing --cov-report=term --cov-config=.coveragerc
8787
find . -name ".coverage*" -not -name ".coveragerc" -exec rm -fr "{}" \;
8888

8989
.PHONY: test-sub-p
9090
test-sub-p:
91-
pytest -rfE --doctest-modules aea packages/fetchai/connections packages/fetchai/protocols packages/fetchai/skills/generic_buyer packages/fetchai/skills/generic_seller tests/test_packages/test_$(tdir) --cov=packages.fetchai.$(dir) --cov-report=html --cov-report=xml --cov-report=term-missing --cov-report=term --cov-config=.coveragerc
91+
pytest -rfE --doctest-modules aea packages/fetchai/connections packages/fetchai/protocols packages/fetchai/skills/generic_buyer packages/fetchai/skills/generic_seller packages/fetchai/skills/tac_control packages/fetchai/skills/tac_control_contract packages/fetchai/skills/tac_participation tests/test_packages/test_$(tdir) --cov=packages.fetchai.$(dir) --cov-report=html --cov-report=xml --cov-report=term-missing --cov-report=term --cov-config=.coveragerc
9292
find . -name ".coverage*" -not -name ".coveragerc" -exec rm -fr "{}" \;
9393

9494

aea/__version__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
__title__ = "aea"
2323
__description__ = "Autonomous Economic Agent framework"
2424
__url__ = "https://github.com/fetchai/agents-aea.git"
25-
__version__ = "0.7.2"
25+
__version__ = "0.7.3"
2626
__author__ = "Fetch.AI Limited"
2727
__license__ = "Apache-2.0"
2828
__copyright__ = "2019 Fetch.AI Limited"

aea/aea.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,15 +45,14 @@
4545
from aea.crypto.ledger_apis import DEFAULT_CURRENCY_DENOMINATIONS
4646
from aea.crypto.wallet import Wallet
4747
from aea.decision_maker.base import DecisionMakerHandler
48-
from aea.exceptions import AEAException
48+
from aea.exceptions import AEAException, _StopRuntime
4949
from aea.helpers.exception_policy import ExceptionPolicyEnum
5050
from aea.helpers.logging import AgentLoggerAdapter, get_logger
5151
from aea.identity.base import Identity
5252
from aea.mail.base import Envelope
5353
from aea.protocols.base import Message, Protocol
5454
from aea.registries.filter import Filter
5555
from aea.registries.resources import Resources
56-
from aea.runtime import _StopRuntime
5756
from aea.skills.base import Behaviour, Handler
5857

5958

@@ -338,7 +337,7 @@ def handle_envelope(self, envelope: Envelope) -> None:
338337
return
339338

340339
for handler in handlers:
341-
handler.handle(msg)
340+
handler.handle_wrapper(msg)
342341

343342
def _setup_loggers(self):
344343
"""Set up logger with agent name."""
@@ -402,10 +401,14 @@ def exception_handler(self, exception: Exception, function: Callable) -> bool:
402401
:return: bool, propagate exception if True otherwise skip it.
403402
"""
404403
# docstyle: ignore # noqa: E800
405-
def log_exception(e, fn):
406-
self.logger.exception(f"<{e}> raised during `{fn}`")
404+
def log_exception(e, fn, is_debug: bool = False):
405+
if is_debug:
406+
self.logger.debug(f"<{e}> raised during `{fn}`")
407+
else:
408+
self.logger.exception(f"<{e}> raised during `{fn}`")
407409

408410
if self._skills_exception_policy == ExceptionPolicyEnum.propagate:
411+
log_exception(exception, function, is_debug=True)
409412
return True
410413

411414
if self._skills_exception_policy == ExceptionPolicyEnum.stop_and_exit:
@@ -434,7 +437,6 @@ def teardown(self) -> None:
434437
435438
:return: None
436439
"""
437-
self.logger.debug("Calling teardown method...")
438440
self.resources.teardown()
439441

440442
def get_task_result(self, task_id: int) -> AsyncResult:

aea/agent_loop.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ def __init__(
168168

169169
self._periodic_tasks: Dict[Callable, PeriodicCaller] = {}
170170

171-
def _periodic_task_exception_callback(
171+
def _periodic_task_exception_callback( # pylint: disable=unused-argument
172172
self, task_callable: Callable, exc: Exception
173173
) -> None:
174174
"""
@@ -179,9 +179,6 @@ def _periodic_task_exception_callback(
179179
180180
:return: None
181181
"""
182-
self.logger.exception(
183-
f"Loop: Exception: `{exc}` occured during `{task_callable}` processing"
184-
)
185182
self._exceptions.append(exc)
186183

187184
def _execution_control(

aea/cli/add.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
from aea.cli.utils.config import load_item_config
2929
from aea.cli.utils.context import Context
3030
from aea.cli.utils.decorators import check_aea_project, clean_after, pass_ctx
31+
from aea.cli.utils.loggers import logger
3132
from aea.cli.utils.package_utils import (
3233
copy_package_directory,
3334
find_item_in_distribution,
@@ -206,7 +207,7 @@ def fetch_item_mixed(
206207
ctx, item_type, item_public_id, dest_path
207208
)
208209
except click.ClickException:
209-
click.echo("Fetch from local registry failed, trying remote registry...")
210+
logger.debug("Fetch from local registry failed, trying remote registry...")
210211
# the following might raise exception, but we don't catch it this time
211212
package_path = fetch_package(
212213
item_type, public_id=item_public_id, cwd=ctx.cwd, dest=dest_path

aea/cli/fetch.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
from aea.cli.utils.config import try_to_load_agent_config
3232
from aea.cli.utils.context import Context
3333
from aea.cli.utils.decorators import clean_after
34+
from aea.cli.utils.loggers import logger
3435
from aea.cli.utils.package_utils import try_get_item_source_path
3536
from aea.configurations.base import DEFAULT_AEA_CONFIG_FILE, PublicId
3637
from aea.configurations.constants import DEFAULT_REGISTRY_PATH
@@ -166,5 +167,5 @@ def fetch_mixed(
166167
try:
167168
fetch_agent_locally(ctx, public_id, alias=alias, target_dir=target_dir)
168169
except click.ClickException:
169-
click.echo("Fetch from local registry failed, trying on remote registry...")
170+
logger.debug("Fetch from local registry failed, trying on remote registry...")
170171
fetch_agent(ctx, public_id, alias=alias, target_dir=target_dir)

aea/cli/registry/utils.py

Lines changed: 35 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -227,20 +227,52 @@ def get_package_meta(obj_type: str, public_id: PublicId) -> dict:
227227
return resp
228228

229229

230+
def get_latest_public_id_mixed(
231+
ctx: Context, item_type: str, item_public_id: PublicId,
232+
) -> PublicId:
233+
"""
234+
Get latest public id of the message, mixed mode.
235+
236+
That is, give priority to local registry, and fall back to remote registry
237+
in case of failure.
238+
239+
:param ctx: the CLI context.
240+
:param item_type: the item type.
241+
:param item_public_id: the item public id.
242+
:return: the path to the found package.
243+
"""
244+
try:
245+
_, item_config = find_item_locally(ctx, item_type, item_public_id)
246+
latest_item_public_id = item_config.public_id
247+
except click.ClickException:
248+
logger.debug(
249+
"Get latest public id from local registry failed, trying remote registry..."
250+
)
251+
# the following might raise exception, but we don't catch it this time
252+
package_meta = get_package_meta(item_type, item_public_id)
253+
latest_item_public_id = PublicId.from_str(package_meta["public_id"])
254+
return latest_item_public_id
255+
256+
230257
def get_latest_version_available_in_registry(
231258
ctx: Context, item_type: str, item_public_id: PublicId
232259
) -> PublicId:
233260
"""
234-
Get latest avalable package version public id.
261+
Get latest available package version public id.
235262
236263
:param ctx: Context object.
237264
:param item_type: the item type.
238265
:param item_public_id: the item public id.
239-
:return: PublicId
266+
:return: the latest public id.
240267
"""
241268
is_local = ctx.config.get("is_local")
269+
is_mixed = ctx.config.get("is_mixed")
242270
try:
243-
if is_local:
271+
if is_mixed:
272+
latest_item_public_id = get_latest_public_id_mixed(
273+
ctx, item_type, item_public_id
274+
)
275+
elif is_local:
244276
_, item_config = find_item_locally(ctx, item_type, item_public_id)
245277
latest_item_public_id = item_config.public_id
246278
else:

aea/cli/run.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333
from aea.cli.utils.context import Context
3434
from aea.cli.utils.decorators import check_aea_project
3535
from aea.configurations.base import PublicId
36-
from aea.exceptions import AEAPackageLoadingError
3736
from aea.helpers.base import load_env_file
3837

3938

@@ -129,7 +128,5 @@ def _build_aea(
129128
)
130129
aea = builder.build(connection_ids=connection_ids)
131130
return aea
132-
except AEAPackageLoadingError as e: # pragma: nocover
133-
raise click.ClickException("Package loading error: {}".format(str(e)))
134131
except Exception as e:
135132
raise click.ClickException(str(e))

aea/components/loader.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
from aea.configurations.base import ComponentConfiguration, ComponentType
2626
from aea.connections.base import Connection
2727
from aea.contracts.base import Contract
28-
from aea.exceptions import AEAPackageLoadingError, enforce
28+
from aea.exceptions import AEAInstantiationException, AEAPackageLoadingError, enforce
2929
from aea.protocols.base import Protocol
3030
from aea.skills.base import Skill
3131

@@ -59,6 +59,8 @@ def load_component_from_config( # type: ignore
5959
component_class = component_type_to_class(component_type)
6060
try:
6161
return component_class.from_config(*args, configuration=configuration, **kwargs) # type: ignore
62+
except AEAInstantiationException as e:
63+
raise e # pramga: nocover
6264
except ModuleNotFoundError as e:
6365
_handle_error_while_loading_component_module_not_found(configuration, e)
6466
except Exception as e: # pylint: disable=broad-except
@@ -133,7 +135,7 @@ def get_new_error_message_with_package_found() -> str:
133135
new_message = get_new_error_message_with_package_found()
134136

135137
raise AEAPackageLoadingError(
136-
"An error occurred while loading {} {}: No module named {}; {}".format(
138+
"Package loading error: An error occurred while loading {} {}: No module named {}; {}".format(
137139
str(configuration.component_type),
138140
configuration.public_id,
139141
import_path,
@@ -152,6 +154,6 @@ def _handle_error_while_loading_component_generic_error(
152154
"""
153155
raise Exception(
154156
"An error occurred while loading {} {}: {}".format(
155-
str(configuration.component_type), configuration.public_id, str(e)
157+
str(configuration.component_type), configuration.public_id, e
156158
)
157-
) from e
159+
)

0 commit comments

Comments
 (0)