Skip to content

Commit

Permalink
Merge branch 'develop' of github.com:fetchai/agents-aea into fix/libp…
Browse files Browse the repository at this point in the history
…2p_slow_dht_lookups
  • Loading branch information
solarw committed Dec 10, 2021
2 parents d4bdacb + f164977 commit cf55072
Show file tree
Hide file tree
Showing 122 changed files with 2,127 additions and 1,368 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/upload_docker_images.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Build and upload develop-image to docker hub

on:
push:
branches: [ main ]

jobs:
build:
env:
BASE_TAG: fetchai/aea-develop
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up tag
run: echo export TAG=${BASE_TAG}:$(python3 -c "from setup import about; print(about[\"__version__\"])") > env.sh
- name: docker login
env:
DOCKER_USER: ${{secrets.DOCKER_USER}}
DOCKER_PASSWORD: ${{secrets.DOCKER_PASSWORD}}
run: |
docker login -u $DOCKER_USER -p $DOCKER_PASSWORD
- name: Build the Docker image
run: |
source env.sh
docker build . -f ./develop-image/Dockerfile --tag $TAG
- name: Tag to latest
run: |
source env.sh
docker tag $TAG $BASE_TAG:latest
- name: Docker Push
run: |
source env.sh
docker push $TAG
docker push $BASE_TAG:latest
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ lint:
isort aea benchmark examples packages plugins scripts tests
flake8 aea benchmark examples packages plugins scripts tests
vulture aea scripts/whitelist.py --exclude "*_pb2.py"
darglint aea benchmark examples libs packages/fetchai/connections packages/fetchai/contracts packages/fetchai/skills plugins scripts
darglint aea benchmark examples libs packages plugins scripts

.PHONY: pylint
pylint:
Expand Down
8 changes: 5 additions & 3 deletions aea/manager/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,9 @@ def stop_event_thread() -> None:
t.start()
loop = asyncio.get_event_loop()
aea.runtime.set_loop(loop)
aea.start()
aea.runtime.start()
loop.run_until_complete(aea.runtime.wait_completed())

except BaseException as e: # pylint: disable=broad-except
print(
f"Exception in agent subprocess task at {datetime.datetime.now()}:\n{format_exc()}"
Expand All @@ -291,8 +293,8 @@ def stop_event_thread() -> None:
run_stop_thread = False
if t:
t.join(10)

result_queue.put(r)
result_queue.put(r)
aea.logger.debug("process task stopped")

def stop(self) -> None:
"""Stop the task."""
Expand Down
21 changes: 14 additions & 7 deletions aea/protocols/generator/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -746,6 +746,7 @@ def _message_class_str(self) -> str:
cls_str += self.indent + ":param dialogue_reference: the dialogue reference.\n"
cls_str += self.indent + ":param target: the message target.\n"
cls_str += self.indent + ":param performative: the message performative.\n"
cls_str += self.indent + ":param **kwargs: extra options.\n"
cls_str += self.indent + '"""\n'

cls_str += self.indent + "super().__init__(\n"
Expand Down Expand Up @@ -965,7 +966,10 @@ def _valid_replies_str(self) -> str:
:return: the `valid replies` dictionary string
"""
valid_replies_str = self.indent + "VALID_REPLIES = {\n"
valid_replies_str = (
self.indent
+ "VALID_REPLIES: Dict[Message.Performative, FrozenSet[Message.Performative]] = {\n"
)
self._change_indent(1)
for performative in sorted(self.spec.reply.keys()):
valid_replies_str += (
Expand Down Expand Up @@ -1067,7 +1071,7 @@ def _dialogue_class_str(self) -> str:
# Imports
cls_str += self.indent + "from abc import ABC\n"
cls_str += (
self.indent + "from typing import Callable, FrozenSet, Type, cast\n\n"
self.indent + "from typing import Callable, Dict, FrozenSet, Type, cast\n\n"
)
cls_str += self.indent + "from aea.common import Address\n"
cls_str += self.indent + "from aea.protocols.base import Message\n"
Expand Down Expand Up @@ -1111,11 +1115,11 @@ def _dialogue_class_str(self) -> str:
)
cls_str += (
self.indent
+ "INITIAL_PERFORMATIVES = frozenset({"
+ "INITIAL_PERFORMATIVES: FrozenSet[Message.Performative] = frozenset({"
+ initial_performatives_str
+ "})\n"
+ self.indent
+ "TERMINAL_PERFORMATIVES = frozenset({"
+ "TERMINAL_PERFORMATIVES: FrozenSet[Message.Performative] = frozenset({"
+ terminal_performatives_str
+ "})\n"
+ self._valid_replies_str()
Expand Down Expand Up @@ -1153,7 +1157,7 @@ def _dialogue_class_str(self) -> str:
self.indent
+ ":param role: the role of the agent this dialogue is maintained for\n"
)
cls_str += self.indent + ":return: None\n"
cls_str += self.indent + ":param message_class: the message class used\n"
cls_str += self.indent + '"""\n'
cls_str += self.indent + "Dialogue.__init__(\n"
cls_str += self.indent + "self,\n"
Expand Down Expand Up @@ -1216,7 +1220,11 @@ def _dialogue_class_str(self) -> str:
self.indent
+ ":param self_address: the address of the entity for whom dialogues are maintained\n"
)
cls_str += self.indent + ":return: None\n"
cls_str += self.indent + ":param dialogue_class: the dialogue class used\n"
cls_str += (
self.indent
+ ":param role_from_first_message: the callable determining role from first message\n"
)
cls_str += self.indent + '"""\n'
cls_str += self.indent + "Dialogues.__init__(\n"
self._change_indent(1)
Expand Down Expand Up @@ -1303,7 +1311,6 @@ def _custom_types_module_str(self) -> str:
_camel_case_to_snake_case(custom_type)
)
)
cls_str += self.indent + ":return: None\n"
cls_str += self.indent + '"""\n'
cls_str += self.indent + "raise NotImplementedError\n\n"
self._change_indent(-1)
Expand Down
10 changes: 5 additions & 5 deletions develop-image/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ubuntu:19.10
FROM ubuntu:20.04

RUN apt-get update && \
apt-get install -y dialog && \
Expand All @@ -18,8 +18,7 @@ RUN HOME=/home/default && \
usermod -a -G sudo default && \
echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers


RUN apt-get install -y \
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y \
build-essential \
software-properties-common \
vim \
Expand Down Expand Up @@ -49,18 +48,19 @@ ENV LC_ALL C.UTF-8
ENV LANG C.UTF-8

RUN apt-get install -y tox
RUN python3.7 -m pip install -U pipenv
RUN python3 -m pip install -U pipenv==2021.5.29

ENV PATH="/usr/local/bin:${PATH}"
USER default

RUN sudo mkdir /build
WORKDIR /build
COPY . /build
RUN sudo chown -R default /build

RUN sudo make clean

RUN pipenv --python python3.7
RUN pipenv --python python3.8
RUN pipenv run pip3 install --upgrade pip
RUN pipenv install --dev --skip-lock
RUN pipenv run pip3 install .[all]
Expand Down
Loading

0 comments on commit cf55072

Please sign in to comment.