Skip to content

Commit e7dffa0

Browse files
committed
docs(getting-started): Clean up + Archive update
1 parent 203af14 commit e7dffa0

File tree

2 files changed

+16
-13
lines changed

2 files changed

+16
-13
lines changed

docs/script/getting_started.tar.gz

12.8 KB
Binary file not shown.

docs/script/getting_started/start.py

+16-13
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,6 @@
3131
import csv
3232
import os
3333
import sys
34-
import signal
35-
from subprocess import call
3634
import subprocess
3735
import json
3836

@@ -47,21 +45,18 @@
4745
["Zen 3", "Zen 4"]]
4846

4947

50-
def signal_handler(sig, frame):
51-
print('You sent SIGINT signal, stoping docker compose stack')
52-
call("./stop.sh")
53-
54-
5548
def docker_start(time):
49+
"""
50+
Start the docker compose stack and the logs
51+
:param time: The duration of the demo
52+
"""
5653
id1 = os.popen("id -u").read()
5754
id2 = os.popen("id -g").read()
58-
with open('env_template', 'r') as firstfile, open('.env', 'a') as secondfile:
55+
with open('env_template', 'r', encoding='UTF-8') as firstfile, open('.env', 'a', encoding='UTF-8') as secondfile:
5956
for line in firstfile:
6057
secondfile.write(line)
6158
secondfile.write("UID=" + id1)
6259
secondfile.write("GUID=" + id2)
63-
64-
print("docker compose up -d")
6560
os.system("docker compose up -d")
6661
os.system("docker compose logs sensor -f &")
6762
os.system("docker compose logs formula -f &")
@@ -70,10 +65,13 @@ def docker_start(time):
7065

7166

7267
def docker_stop():
68+
"""
69+
Stop the docker compose stack and clean the environment
70+
"""
7371
os.system("set -ueo pipefail")
7472
os.system("set +x")
7573
os.system("docker compose down")
76-
open('.env', 'w').close()
74+
open('.env', 'w', encoding='UTF-8').close()
7775

7876

7977
def load_data():
@@ -170,9 +168,9 @@ def find_cpu(data):
170168
option = []
171169
line = "cat /proc/cpuinfo | grep 'model name'"
172170
result = subprocess.check_output(line, shell=True, text=True).split("\n")
173-
print("The CPU found is" + result[0].split(":")[1] )
171+
print("The CPU found is" + result[0].split(":")[1])
174172
parse = parse_processor_name(result[0])
175-
for row in data :
173+
for row in data:
176174
if parse[0] in row["Name"] and row["Manufacturer"] == parse[1]:
177175
option.append(row)
178176

@@ -193,6 +191,11 @@ def find_cpu(data):
193191

194192

195193
def parse_processor_name(name):
194+
"""
195+
Parse the processor name to extract the id and the brand
196+
:param name: Name of the processor, extracted from /proc/cpuinfo
197+
:return: id adn brand of the processor
198+
"""
196199
if "Intel" in name:
197200
brand = "Intel"
198201
elif "AMD" in name:

0 commit comments

Comments
 (0)