Skip to content

Commit ce418be

Browse files
Merge pull request #1753 from fetchai/develop
Release 0.6.1
2 parents ec99bc7 + b6b237a commit ce418be

272 files changed

Lines changed: 8727 additions & 2447 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.

.github/workflows/workflow.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ jobs:
298298
pip install tox
299299
sudo apt-get install -y protobuf-compiler
300300
- name: Run all tests
301-
run: tox -e py3.7-cov -- --ignore=tests/test_docs --ignore=tests/test_examples --ignore=tests/test_packages/test_contracts --ignore=tests/test_packages/test_protocols --ignore=tests/test_packages/test_skills -m 'not unstable'
301+
run: tox -e py3.7-cov -- --ignore=tests/test_docs --ignore=tests/test_examples --ignore=tests/test_packages/test_contracts --ignore=tests/test_packages/test_skills -m 'not unstable'
302302
continue-on-error: true
303303
- name: Upload coverage to Codecov
304304
uses: codecov/codecov-action@v1

HISTORY.md

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

3+
## 0.6.1 (2020-09-17)
4+
5+
- Adds a standalone script to deploy an ACN node
6+
- Adds filtering of out-dated addresses in DHT lookups
7+
- Updates multiple developer scripts
8+
- Increases code coverage of all protocols to 100%
9+
- Fixes a disconnection issue of the multiplexer
10+
- Extends soef connection to support additional registration commands and search responses
11+
- Extends oef_search protocol to include success performative and agent info in search response
12+
- Adds README.mds to all skills
13+
- Adds configurable exception policy handling for multiplexer
14+
- Fixes support for http headers in http server connection
15+
- Adds additional consistency checks on addresses in dialogues
16+
- Exposes decision maker address on skill context
17+
- Adds comprehensive benchmark scripts
18+
- Multiple docs updates including additional explanations of soef usage
19+
- Multiple additional tests and test stability fixes
20+
321
## 0.6.0 (2020-09-01)
422

523
- Makes FetchAICrypto default again

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.6.0"
25+
__version__ = "0.6.1"
2626
__author__ = "Fetch.AI Limited"
2727
__license__ = "Apache-2.0"
2828
__copyright__ = "2019 Fetch.AI Limited"

aea/aea.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ def __init__(
8181
DecisionMakerHandler
8282
] = DefaultDecisionMakerHandler,
8383
skill_exception_policy: ExceptionPolicyEnum = ExceptionPolicyEnum.propagate,
84+
connection_exception_policy: ExceptionPolicyEnum = ExceptionPolicyEnum.propagate,
8485
loop_mode: Optional[str] = None,
8586
runtime_mode: Optional[str] = None,
8687
default_connection: Optional[PublicId] = None,
@@ -111,6 +112,10 @@ def __init__(
111112
112113
:return: None
113114
"""
115+
116+
self._skills_exception_policy = skill_exception_policy
117+
self._connection_exception_policy = connection_exception_policy
118+
114119
super().__init__(
115120
identity=identity,
116121
connections=[],
@@ -119,6 +124,7 @@ def __init__(
119124
loop_mode=loop_mode,
120125
runtime_mode=runtime_mode,
121126
)
127+
122128
aea_logger = AgentLoggerAdapter(
123129
logger=logging.getLogger(__name__), agent_name=identity.name
124130
)
@@ -140,6 +146,7 @@ def __init__(
140146
default_connection,
141147
default_routing if default_routing is not None else {},
142148
search_service_address,
149+
decision_maker_handler.self_address,
143150
**kwargs,
144151
)
145152
self._execution_timeout = execution_timeout
@@ -149,8 +156,6 @@ def __init__(
149156
self.resources, self.runtime.decision_maker.message_out_queue
150157
)
151158

152-
self._skills_exception_policy = skill_exception_policy
153-
154159
self._setup_loggers()
155160

156161
@property

aea/aea_builder.py

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,7 @@ class AEABuilder:
287287
DecisionMakerHandler
288288
] = DefaultDecisionMakerHandler
289289
DEFAULT_SKILL_EXCEPTION_POLICY = ExceptionPolicyEnum.propagate
290+
DEFAULT_CONNECTION_EXCEPTION_POLICY = ExceptionPolicyEnum.propagate
290291
DEFAULT_LOOP_MODE = "async"
291292
DEFAULT_RUNTIME_MODE = "threaded"
292293
DEFAULT_SEARCH_SERVICE_ADDRESS = "fetchai/soef:*"
@@ -350,6 +351,7 @@ def _reset(self, is_full_reset: bool = False) -> None:
350351
self._max_reactions: Optional[int] = None
351352
self._decision_maker_handler_class: Optional[Type[DecisionMakerHandler]] = None
352353
self._skill_exception_policy: Optional[ExceptionPolicyEnum] = None
354+
self._connection_exception_policy: Optional[ExceptionPolicyEnum] = None
353355
self._default_routing: Dict[PublicId, PublicId] = {}
354356
self._loop_mode: Optional[str] = None
355357
self._runtime_mode: Optional[str] = None
@@ -440,6 +442,19 @@ def set_skill_exception_policy(
440442
self._skill_exception_policy = skill_exception_policy
441443
return self
442444

445+
def set_connection_exception_policy(
446+
self, connection_exception_policy: Optional[ExceptionPolicyEnum]
447+
) -> "AEABuilder": # pragma: nocover
448+
"""
449+
Set skill exception policy.
450+
451+
:param skill_exception_policy: the policy
452+
453+
:return: self
454+
"""
455+
self._connection_exception_policy = connection_exception_policy
456+
return self
457+
443458
def set_default_routing(
444459
self, default_routing: Dict[PublicId, PublicId]
445460
) -> "AEABuilder":
@@ -877,6 +892,7 @@ def build(self, connection_ids: Optional[Collection[PublicId]] = None,) -> AEA:
877892
max_reactions=self._get_max_reactions(),
878893
decision_maker_handler_class=self._get_decision_maker_handler_class(),
879894
skill_exception_policy=self._get_skill_exception_policy(),
895+
connection_exception_policy=self._get_connection_exception_policy(),
880896
default_routing=self._get_default_routing(),
881897
default_connection=self._get_default_connection(),
882898
loop_mode=self._get_loop_mode(),
@@ -947,6 +963,18 @@ def _get_skill_exception_policy(self) -> ExceptionPolicyEnum:
947963
else self.DEFAULT_SKILL_EXCEPTION_POLICY
948964
)
949965

966+
def _get_connection_exception_policy(self) -> ExceptionPolicyEnum:
967+
"""
968+
Return the skill exception policy.
969+
970+
:return: the skill exception policy.
971+
"""
972+
return (
973+
self._connection_exception_policy
974+
if self._connection_exception_policy is not None
975+
else self.DEFAULT_CONNECTION_EXCEPTION_POLICY
976+
)
977+
950978
def _get_default_routing(self) -> Dict[PublicId, PublicId]:
951979
"""
952980
Return the default routing.
@@ -1139,6 +1167,10 @@ def set_from_configuration(
11391167
self.set_skill_exception_policy(
11401168
ExceptionPolicyEnum(agent_configuration.skill_exception_policy)
11411169
)
1170+
if agent_configuration.connection_exception_policy is not None:
1171+
self.set_connection_exception_policy(
1172+
ExceptionPolicyEnum(agent_configuration.connection_exception_policy)
1173+
)
11421174
self.set_default_routing(agent_configuration.default_routing)
11431175
self.set_loop_mode(agent_configuration.loop_mode)
11441176
self.set_runtime_mode(agent_configuration.runtime_mode)

aea/cli/registry/settings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"""Settings for operating Registry with CLI."""
2020

2121

22-
REGISTRY_API_URL = "https://agents-registry.prod.fetch-ai.com"
22+
REGISTRY_API_URL = "https://agents-registry.prod.fetch-ai.com/api/v1"
2323
# we ignore issue B105 because this is not an hard-coded authentication token,
2424
# but the name of the field in the configuration file.
2525
AUTH_TOKEN_KEY = "auth_token" # nosec

aea/cli/search.py

Lines changed: 45 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
import os
2323
from pathlib import Path
24-
from typing import Dict, List, cast
24+
from typing import Dict, List, Tuple, cast
2525

2626
import click
2727

@@ -62,47 +62,52 @@ def search(click_context, local):
6262

6363
@search.command()
6464
@click.option("--query", default="", help="Query string to search Connections by name.")
65+
@click.option("--page", type=int, default=1, help="Page number to display.")
6566
@pass_ctx
66-
def connections(ctx: Context, query):
67+
def connections(ctx: Context, query, page):
6768
"""Search for Connections."""
6869
item_type = "connection"
69-
_output_search_results(item_type, search_items(ctx, item_type, query))
70+
_output_search_results(item_type, *search_items(ctx, item_type, query, page), page)
7071

7172

7273
@search.command()
7374
@click.option("--query", default="", help="Query string to search Contracts by name.")
75+
@click.option("--page", type=int, default=1, help="Page number to display.")
7476
@pass_ctx
75-
def contracts(ctx: Context, query):
77+
def contracts(ctx: Context, query, page):
7678
"""Search for Contracts."""
7779
item_type = "contract"
78-
_output_search_results(item_type, search_items(ctx, item_type, query))
80+
_output_search_results(item_type, *search_items(ctx, item_type, query, page), page)
7981

8082

8183
@search.command()
8284
@click.option("--query", default="", help="Query string to search Protocols by name.")
85+
@click.option("--page", type=int, default=1, help="Page number to display.")
8386
@pass_ctx
84-
def protocols(ctx: Context, query):
87+
def protocols(ctx: Context, query, page):
8588
"""Search for Protocols."""
8689
item_type = "protocol"
87-
_output_search_results(item_type, search_items(ctx, item_type, query))
90+
_output_search_results(item_type, *search_items(ctx, item_type, query, page), page)
8891

8992

9093
@search.command()
9194
@click.option("--query", default="", help="Query string to search Skills by name.")
95+
@click.option("--page", type=int, default=1, help="Page number to display.")
9296
@pass_ctx
93-
def skills(ctx: Context, query):
97+
def skills(ctx: Context, query, page):
9498
"""Search for Skills."""
9599
item_type = "skill"
96-
_output_search_results(item_type, search_items(ctx, item_type, query))
100+
_output_search_results(item_type, *search_items(ctx, item_type, query, page), page)
97101

98102

99103
@search.command()
100104
@click.option("--query", default="", help="Query string to search Agents by name.")
105+
@click.option("--page", type=int, default=1, help="Page number to display.")
101106
@pass_ctx
102-
def agents(ctx: Context, query):
107+
def agents(ctx: Context, query, page):
103108
"""Search for Agents."""
104109
item_type = "agent"
105-
_output_search_results(item_type, search_items(ctx, item_type, query))
110+
_output_search_results(item_type, *search_items(ctx, item_type, query, page), page)
106111

107112

108113
def setup_search_ctx(ctx: Context, local: bool) -> None:
@@ -198,33 +203,55 @@ def _search_items_locally(ctx, item_type_plural):
198203
return sorted(result, key=lambda k: k["name"])
199204

200205

201-
def search_items(ctx: Context, item_type: str, query: str) -> List:
206+
def search_items(
207+
ctx: Context, item_type: str, query: str, page: int
208+
) -> Tuple[List, int]:
202209
"""
203210
Search items by query and click.echo results.
204211
205212
:param ctx: Context object.
206213
:param item_type: item type.
207214
:param query: query string.
208215
209-
:return: None
216+
:return: (List of items, int items total count).
210217
"""
211218
click.echo('Searching for "{}"...'.format(query))
212219
item_type_plural = item_type + "s"
213220
if ctx.config.get("is_local"):
214-
return _search_items_locally(ctx, item_type_plural)
215-
return request_api("GET", "/{}".format(item_type_plural), params={"search": query})
221+
results = _search_items_locally(ctx, item_type_plural)
222+
count = len(results)
223+
else:
224+
resp = request_api(
225+
"GET",
226+
"/{}".format(item_type_plural),
227+
params={"search": query, "page": page},
228+
)
229+
results = resp["results"]
230+
count = resp["count"]
231+
return results, count
216232

217233

218-
def _output_search_results(item_type: str, results: List[Dict]) -> None:
234+
def _output_search_results(
235+
item_type: str, results: List[Dict], count: int, page: int
236+
) -> None:
219237
"""
220238
Output search results.
221239
222-
:param results: list of found items
240+
:param item_type: str item type.
241+
:param results: list of found items.
242+
:param count: items total count.
223243
224244
"""
225245
item_type_plural = item_type + "s"
226-
if len(results) == 0:
246+
len_results = len(results)
247+
if len_results == 0:
227248
click.echo("No {} found.".format(item_type_plural)) # pragma: no cover
228249
else:
229250
click.echo("{} found:\n".format(item_type_plural.title()))
230251
click.echo(format_items(results))
252+
if count > len_results:
253+
click.echo(
254+
"{} {} out of {}.\nPage {}".format(
255+
len_results, item_type_plural, count, page
256+
)
257+
) # pragma: no cover

aea/cli_gui/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ def get_registered_items(item_type: str):
121121
ctx = Context(cwd=app_context.agents_dir)
122122
try:
123123
cli_setup_search_ctx(ctx, local=app_context.local)
124-
result = cli_search_items(ctx, item_type, query="")
124+
result, _ = cli_search_items(ctx, item_type, query="", page=1)
125125
except ClickException:
126126
return {"detail": "Failed to search items."}, 400 # 400 Bad request
127127
else:
@@ -135,7 +135,7 @@ def search_registered_items(item_type: str, search_term: str):
135135
ctx = Context(cwd=app_context.agents_dir)
136136
try:
137137
cli_setup_search_ctx(ctx, local=app_context.local)
138-
result = cli_search_items(ctx, item_type, query=search_term)
138+
result, _ = cli_search_items(ctx, item_type, query=search_term, page=1)
139139
except ClickException:
140140
return {"detail": "Failed to search items."}, 400 # 400 Bad request
141141
else:

aea/configurations/base.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1296,6 +1296,7 @@ def __init__(
12961296
max_reactions: Optional[int] = None,
12971297
decision_maker_handler: Optional[Dict] = None,
12981298
skill_exception_policy: Optional[str] = None,
1299+
connection_exception_policy: Optional[str] = None,
12991300
default_routing: Optional[Dict] = None,
13001301
loop_mode: Optional[str] = None,
13011302
runtime_mode: Optional[str] = None,
@@ -1332,7 +1333,9 @@ def __init__(
13321333
self.period: Optional[float] = period
13331334
self.execution_timeout: Optional[float] = execution_timeout
13341335
self.max_reactions: Optional[int] = max_reactions
1336+
13351337
self.skill_exception_policy: Optional[str] = skill_exception_policy
1338+
self.connection_exception_policy: Optional[str] = connection_exception_policy
13361339

13371340
self.decision_maker_handler = (
13381341
decision_maker_handler if decision_maker_handler is not None else {}
@@ -1504,6 +1507,8 @@ def json(self) -> Dict:
15041507
config["decision_maker_handler"] = self.decision_maker_handler
15051508
if self.skill_exception_policy is not None:
15061509
config["skill_exception_policy"] = self.skill_exception_policy
1510+
if self.connection_exception_policy is not None:
1511+
config["connection_exception_policy"] = self.skill_exception_policy
15071512
if self.default_routing != {}:
15081513
config["default_routing"] = {
15091514
str(key): str(value) for key, value in self.default_routing.items()
@@ -1537,6 +1542,9 @@ def from_json(cls, obj: Dict):
15371542
max_reactions=cast(int, obj.get("max_reactions")),
15381543
decision_maker_handler=cast(Dict, obj.get("decision_maker_handler", {})),
15391544
skill_exception_policy=cast(str, obj.get("skill_exception_policy")),
1545+
connection_exception_policy=cast(
1546+
str, obj.get("connection_exception_policy")
1547+
),
15401548
default_routing=cast(Dict, obj.get("default_routing", {})),
15411549
loop_mode=cast(str, obj.get("loop_mode")),
15421550
runtime_mode=cast(str, obj.get("runtime_mode")),

aea/configurations/schemas/aea-config_schema.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,9 @@
115115
"skill_exception_policy": {
116116
"$ref": "definitions.json#/definitions/skill_exception_policy"
117117
},
118+
"connection_exception_policy": {
119+
"$ref": "definitions.json#/definitions/connection_exception_policy"
120+
},
118121
"default_routing": {
119122
"type": "object",
120123
"uniqueItems": true,

0 commit comments

Comments
 (0)