Skip to content
Snippets Groups Projects
Commit 8fadd690 authored by shinedday's avatar shinedday
Browse files

Reformat framework

parent 18f22866
No related branches found
No related tags found
No related merge requests found
...@@ -2,7 +2,7 @@ import sys ...@@ -2,7 +2,7 @@ import sys
from ast import literal_eval from ast import literal_eval
from typing import Dict from typing import Dict
from schedulable import Schedulable from tool.schedulable import Schedulable
class Agent(Schedulable): class Agent(Schedulable):
......
...@@ -2,10 +2,9 @@ ...@@ -2,10 +2,9 @@
Amas class Amas class
""" """
from ast import literal_eval from ast import literal_eval
from pexpect import pxssh
from schedulable import Schedulable from tool.schedulable import Schedulable
from ssh_client import SSHClient, Cmd from tool.ssh_client import SSHClient, Cmd
class Amas(Schedulable, SSHClient): class Amas(Schedulable, SSHClient):
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
Environment class Environment class
""" """
from schedulable import Schedulable from tool.schedulable import Schedulable
class Environment(Schedulable): class Environment(Schedulable):
......
...@@ -3,9 +3,9 @@ from subprocess import Popen ...@@ -3,9 +3,9 @@ from subprocess import Popen
from os import path from os import path
from time import sleep from time import sleep
from mqtt_client import MqttClient from tool.mqtt_client import MqttClient
from ssh_client import SSHClient, Cmd, RemoteClient from tool.ssh_client import SSHClient, Cmd, RemoteClient
from update import VersionManager from tool.update import VersionManager
class Ihm(MqttClient, SSHClient): class Ihm(MqttClient, SSHClient):
......
...@@ -4,7 +4,7 @@ import pathlib ...@@ -4,7 +4,7 @@ import pathlib
sys.path.insert(0, str(pathlib.Path(__file__).parent.parent)) sys.path.insert(0, str(pathlib.Path(__file__).parent.parent))
from amas import Amas from amas import Amas
from ssh_client import Cmd from tool.ssh_client import Cmd
class PhiAmas(Amas): class PhiAmas(Amas):
...@@ -33,5 +33,5 @@ class PhiAmas(Amas): ...@@ -33,5 +33,5 @@ class PhiAmas(Amas):
# self.run_cmd(1, agents[2:]) # self.run_cmd(1, agents[2:])
if __name__ == '__main__': if __name__ == '__main__':
s = PhiAmas(3) s = PhiAmas(100)
s.run() s.run()
\ No newline at end of file
...@@ -65,5 +65,5 @@ class PhiEnv(Environment): ...@@ -65,5 +65,5 @@ class PhiEnv(Environment):
if __name__ == '__main__': if __name__ == '__main__':
s = PhiEnv(3) s = PhiEnv(100)
s.run() s.run()
\ No newline at end of file
import sys import sys
from time import sleep from time import sleep
from schedulable import Schedulable from tool.schedulable import Schedulable
class Scheduler(Schedulable): class Scheduler(Schedulable):
......
import json
from tool.ssh_client import RemoteClient
def read_ssh(path):
with open(path, 'r', encoding='utf-8') as f:
dict = json.load(f)
res = []
for client in dict.get("clients_ssh"):
res.append(RemoteClient(
hostname=client.get("hostname"),
user=client.get("user"),
password=client.get("password")
))
return res
def read_broker(path):
with open(path, 'r', encoding='utf-8') as f:
dict = json.load(f)
return dict.get("broker")
\ No newline at end of file
{
"broker" : "192.168.1.1",
"clients_ssh" : [
{
"hostname" : "192.168.1.1",
"user" : "pi",
"password" : "raspberry"
},
{
"hostname" : "192.168.1.1",
"user" : "pi",
"password" : "raspberry"
},
{
"hostname" : "192.168.1.1",
"user" : "pi",
"password" : "raspberry"
},
{
"hostname" : "192.168.1.1",
"user" : "pi",
"password" : "raspberry"
}
]
}
\ No newline at end of file
File moved
...@@ -3,7 +3,7 @@ Tool class that implement basic interaction that help to finish processes ...@@ -3,7 +3,7 @@ Tool class that implement basic interaction that help to finish processes
""" """
from time import sleep from time import sleep
from mqtt_client import MqttClient from tool.mqtt_client import MqttClient
class Schedulable(MqttClient): class Schedulable(MqttClient):
......
File moved
import paramiko import paramiko
import os import os
from ssh_client import RemoteClient from tool.ssh_client import RemoteClient
class VersionManager: class VersionManager:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment