Skip to content

Commit

Permalink
address PR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
marcofavorito committed Jul 14, 2020
1 parent ceb059e commit ebcc69e
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 13 deletions.
20 changes: 10 additions & 10 deletions aea/aea_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -880,12 +880,12 @@ def build(self, connection_ids: Optional[Collection[PublicId]] = None,) -> AEA:
copy(self.private_key_paths), copy(self.connection_private_key_paths)
)
identity = self._build_identity_from_wallet(wallet)
self._load_and_add_components(ComponentType.PROTOCOL, resources, identity)
self._load_and_add_components(ComponentType.CONTRACT, resources, identity)
self._load_and_add_components(ComponentType.PROTOCOL, resources, identity.name)
self._load_and_add_components(ComponentType.CONTRACT, resources, identity.name)
self._load_and_add_components(
ComponentType.CONNECTION,
resources,
identity,
identity.name,
identity=identity,
crypto_store=wallet.connection_cryptos,
)
Expand All @@ -910,7 +910,7 @@ def build(self, connection_ids: Optional[Collection[PublicId]] = None,) -> AEA:
**deepcopy(self._context_namespace),
)
self._load_and_add_components(
ComponentType.SKILL, resources, identity, agent_context=aea.context
ComponentType.SKILL, resources, identity.name, agent_context=aea.context
)
self._build_called = True
self._populate_contract_registry()
Expand Down Expand Up @@ -1351,15 +1351,15 @@ def _load_and_add_components(
self,
component_type: ComponentType,
resources: Resources,
aea_identity: Identity,
agent_name: str,
**kwargs,
) -> None:
"""
Load and add components added to the builder to a Resources instance.
:param component_type: the component type for which
:param resources: the resources object to populate.
:param aea_identity: the identity of the AEA.
:param agent_name: the AEA name for logging purposes.
:param kwargs: keyword argument to forward to the component loader.
:return: None
"""
Expand All @@ -1376,7 +1376,7 @@ def _load_and_add_components(
configuration = deepcopy(configuration)
component = load_component_from_config(configuration, **kwargs)

_set_logger_to_component(component, configuration, aea_identity)
_set_logger_to_component(component, configuration, agent_name)
resources.add_component(component)

def _populate_contract_registry(self):
Expand Down Expand Up @@ -1424,21 +1424,21 @@ def _check_we_can_build(self):


def _set_logger_to_component(
component: Component, configuration: ComponentConfiguration, identity: Identity,
component: Component, configuration: ComponentConfiguration, agent_name: str,
) -> None:
"""
Set the logger to the component.
:param component: the component instance.
:param configuration: the component configuration
:param identity: the identity object of the AEA.
:param agent_name: the agent name
:return: None
"""
if configuration.component_type == ComponentType.SKILL:
# skip because skill object already have their own logger from the skill context.
return
logger_name = f"aea.packages.{configuration.author}.{configuration.component_type.to_plural()}.{configuration.name}"
logger = AgentLoggerAdapter(logging.getLogger(logger_name), identity.name)
logger = AgentLoggerAdapter(logging.getLogger(logger_name), agent_name)
component.logger = logger


Expand Down
1 change: 0 additions & 1 deletion packages/fetchai/connections/http_client/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ def __init__(
self._tasks: Set[Task] = set()

self.logger = logger
# TODO logger at this point is the module-level one, not with the agent name.
self.logger.info("Initialised the HTTP client channel")

async def connect(self, loop: AbstractEventLoop) -> None:
Expand Down
2 changes: 1 addition & 1 deletion packages/fetchai/connections/http_client/connection.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ license: Apache-2.0
aea_version: '>=0.5.0, <0.6.0'
fingerprint:
__init__.py: QmPdKAks8A6XKAgZiopJzPZYXJumTeUqChd8UorqmLQQPU
connection.py: QmZVEzoHKi5qRabE3fWF1zJYphcU4frxJQo9dWXnbDV5RL
connection.py: QmVYurcnjuRTK6CnuEc6qNbSykmZEzRMkjyGhknJKzKRQt
fingerprint_ignore_patterns: []
protocols:
- fetchai/http:0.3.0
Expand Down
2 changes: 1 addition & 1 deletion packages/hashes.csv
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ fetchai/agents/thermometer_client,QmbcVyNwpHAwY8NPcgd2bdDpGhLLZLTyg6o78o67RXrNC1
fetchai/agents/weather_client,QmemjFHEFE32mXjP48NEX7prqaAHfW9wTM8mBAPfM4dUeA
fetchai/agents/weather_station,QmQ8vVjVB4xDqjZwd5SH2skaqXFMkkBSX69j7VXM3ru2ez
fetchai/connections/gym,QmXpTer28dVvxeXqsXzaBqX551QToh9w5KJC2oXcStpKJG
fetchai/connections/http_client,QmcvCouzByryadF1H9YbgDotRmV26F9QhrxFSdGmRgcdNV
fetchai/connections/http_client,QmUjtATHombNqbwHRonc3pLUTfuvQJBxqGAj4K5zKT8beQ
fetchai/connections/http_server,QmXuGssPAahvRXHNmYrvtqYokgeCqavoiK7x9zmjQT8w23
fetchai/connections/ledger,QmVXceMJCioA1Hro9aJgBwrF9yLgToaVXifDz6EVo6vTXn
fetchai/connections/local,QmZKciQTgE8LLHsgQX4F5Ecc7rNPp9BBSWQHEEe7jEMEmJ
Expand Down

0 comments on commit ebcc69e

Please sign in to comment.