24 Commits

Author SHA1 Message Date
hasslesstech d215e527ed add lines
Test Agent / test-agent-run (push) Successful in 5m25s
2026-03-03 18:54:42 +02:00
hasslesstech 340706c7e5 test commit
Test Agent / test-agent-run (push) Successful in 5m25s
2026-02-26 16:10:13 +02:00
hasslesstech ff502c3be8 test commit
Test Agent / test-agent-run (push) Has been cancelled
2026-02-26 16:09:17 +02:00
hasslesstech ad976c8074 test commit
Test Agent / test-agent-run (push) Has been cancelled
2026-02-26 16:07:03 +02:00
hasslesstech 91cca10a04 test commit
Test Agent / test-agent-run (push) Has been cancelled
2026-02-26 16:06:47 +02:00
bacant150 dbd6e88de8 Remove unnecessary rewind after file open
Test Agent / test-agent-run (push) Successful in 18s
2026-02-26 15:35:01 +02:00
bacant150 eee4743d4d Remove unused _detect_header_and_buffer method and related fields 2026-02-26 13:15:15 +02:00
bacant150 b3162e11bd Refactor FileDatasource: remove unused header detection variables 2026-02-26 13:15:15 +02:00
bacant150 12f6b9871f Refactor file rewind logic to skip header row and remove unnecessary buffers 2026-02-26 13:15:15 +02:00
bacant150 ceb9037dc4 Refactor file rewinding logic to skip header row after seek(0) 2026-02-26 13:15:15 +02:00
bacant150 2935a9349d Refactor row reading logic for clarity and efficiency 2026-02-26 13:15:15 +02:00
bacant150 b772848d4c Optimize CSV parsing by adding skipinitialspace=True to csv.reader and removing unnecessary strip() calls 2026-02-26 13:15:15 +02:00
bacant150 722d45b2a1 Restore input validation for accelerometer parsing 2026-02-26 13:15:15 +02:00
bacant150 ad07896ba3 Simplify accelerometer parsing and remove int16-specific leftovers 2026-02-26 13:15:15 +02:00
bacant150 4ff31c0884 Remove int16 binding from datasource 2026-02-26 13:15:15 +02:00
bacant150 de8d2516f6 Remove int16 range check per review 2026-02-26 13:15:15 +02:00
bacant150 c291f150af Parse accelerometer values as int16 (remove float conversion) 2026-02-26 13:15:15 +02:00
bacant150 2cdd8d1bd0 Add mosquitto runtime folders to gitignore 2026-02-26 13:15:15 +02:00
bacant150 9276239d41 Fix timestamp field in AggregatedData 2026-02-26 13:15:15 +02:00
bacant150 a9673c1070 Реалізовую базовий FileReader та переношу sleep до FileDatasource.read() 2026-02-26 13:15:12 +02:00
hasslesstech 9a4aeec6cb lab1: implement UART reader alongside with the file writer usage example 2026-02-26 13:14:13 +02:00
hasslesstech d1be717490 lab1: add stm32f4 uart reader project and source code 2026-02-26 13:14:13 +02:00
hasslesstech b330180909 lab1: add CI/CD testing
Test Agent / test-agent-run (push) Successful in 5m24s
2026-02-24 10:16:28 +02:00
VladiusVostokus b2c7427af0 Merge pull request #1 from Rhinemann/lab1_shved
updated compose file
2026-02-23 16:10:12 +00:00
7 changed files with 85 additions and 5 deletions
+29
View File
@@ -0,0 +1,29 @@
name: Test Agent
on: [push, workflow_dispatch]
concurrency:
cancel-in-progress: false
jobs:
test-agent-run:
runs-on: arch-x86_64
steps:
- name: Fetch the repository
run: git clone --revision ${{ gitea.sha }} --depth 1 ${{ gitea.server_url }}/${{ gitea.repository }}
- name: Build containers
run: docker-compose -f docker-compose-test.yaml build
working-directory: sem8-iot-test/agent/docker
- name: Start MQTT broker
run: docker-compose -f docker-compose-test.yaml up -d mqtt
working-directory: sem8-iot-test/agent/docker
- name: Start agent
run: docker-compose -f docker-compose-test.yaml run fake_agent
working-directory: sem8-iot-test/agent/docker
- name: Clean up
if: always()
run: docker-compose -f docker-compose-test.yaml down
working-directory: sem8-iot-test/agent/docker
+4
View File
@@ -10,3 +10,7 @@ RUN pip install -r requirements.txt
COPY src/ . COPY src/ .
# command to run on container start # command to run on container start
CMD ["python", "main.py"] CMD ["python", "main.py"]
+34
View File
@@ -0,0 +1,34 @@
version: "3.3"
#name: "road_vision"
services:
mqtt:
image: eclipse-mosquitto
container_name: mqtt
volumes:
- ./mosquitto:/mosquitto
- ./mosquitto/data:/mosquitto/data
- ./mosquitto/log:/mosquitto/log
ports:
- 1883:1883
- 9001:9001
networks:
mqtt_network:
fake_agent:
container_name: agent
build: ../
depends_on:
- mqtt
environment:
MQTT_BROKER_HOST: "mqtt"
MQTT_BROKER_PORT: 1883
MQTT_TOPIC: "agent_data_topic"
DELAY: 0.1
MAX_SENDS: 30
networks:
mqtt_network:
networks:
mqtt_network:
+2 -1
View File
@@ -1,4 +1,5 @@
name: "road_vision" version: "3.3"
#name: "road_vision"
services: services:
mqtt: mqtt:
image: eclipse-mosquitto image: eclipse-mosquitto
+3
View File
@@ -16,3 +16,6 @@ MQTT_TOPIC = os.environ.get("MQTT_TOPIC") or "agent"
# Delay for sending data to mqtt in seconds # Delay for sending data to mqtt in seconds
DELAY = try_parse(float, os.environ.get("DELAY")) or 1 DELAY = try_parse(float, os.environ.get("DELAY")) or 1
# Testing switches for CI/CD
MAX_SENDS = try_parse(int, os.environ.get("MAX_SENDS"))
+10 -2
View File
@@ -22,9 +22,13 @@ def connect_mqtt(broker, port):
return client return client
def publish(client, topic, datasource): def publish(client, topic, datasource, max_sends = None):
datasource.startReading() datasource.startReading()
i = 0
while True: while True:
i += 1
data = datasource.read() data = datasource.read()
msg = AggregatedDataSchema().dumps(data) msg = AggregatedDataSchema().dumps(data)
result = client.publish(topic, msg) result = client.publish(topic, msg)
@@ -32,6 +36,10 @@ def publish(client, topic, datasource):
if status != 0: if status != 0:
print(f"Failed to send message to topic {topic}") print(f"Failed to send message to topic {topic}")
if max_sends and i >= max_sends:
# display test success
exit(0)
def run(): def run():
# Prepare mqtt client # Prepare mqtt client
@@ -39,7 +47,7 @@ def run():
# Prepare datasource # Prepare datasource
datasource = FileDatasource("data/accelerometer.csv", "data/gps.csv") datasource = FileDatasource("data/accelerometer.csv", "data/gps.csv")
# Infinity publish data # Infinity publish data
publish(client, config.MQTT_TOPIC, datasource) publish(client, config.MQTT_TOPIC, datasource, getattr(config, "MAX_SENDS", None))
if __name__ == "__main__": if __name__ == "__main__":
+1
View File
@@ -13,6 +13,7 @@ services:
- 19001:9001 - 19001:9001
networks: networks:
mqtt_network: mqtt_network:
user: 1000:1000
edge: edge: