Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
iotamak-core
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SMAC
AMAK
Python
IoTAMAK
iotamak-core
Commits
16fe7a33
Commit
16fe7a33
authored
3 years ago
by
shinedday
Browse files
Options
Downloads
Patches
Plain Diff
Add ping to the ihm to check if the raspberry's are available
parent
12d638cd
No related branches found
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
README.md
+0
-5
0 additions, 5 deletions
README.md
ihm.py
+17
-1
17 additions, 1 deletion
ihm.py
philosophers/amas.py
+3
-2
3 additions, 2 deletions
philosophers/amas.py
tool/config.json
+15
-0
15 additions, 0 deletions
tool/config.json
with
35 additions
and
8 deletions
README.md
+
0
−
5
View file @
16fe7a33
...
@@ -40,11 +40,6 @@ WSL (pour pouvoir démarer l'amas)
...
@@ -40,11 +40,6 @@ WSL (pour pouvoir démarer l'amas)
# Random note
# Random note
Programme de la semaine :
*
Surcouche mqtt pour le framework
*
décision dela forme du framewor (module python ?)
*
Implementation d'un 2nd example
Start procédure :
Start procédure :
1.
start broker
1.
start broker
...
...
This diff is collapsed.
Click to expand it.
ihm.py
+
17
−
1
View file @
16fe7a33
...
@@ -3,9 +3,14 @@ from subprocess import Popen
...
@@ -3,9 +3,14 @@ from subprocess import Popen
from
os
import
path
from
os
import
path
from
time
import
sleep
from
time
import
sleep
import
platform
# For getting the operating system name
import
subprocess
# For executing a shell command
import
pathlib
from
tool.confi_reader
import
read_ssh
from
tool.mqtt_client
import
MqttClient
from
tool.mqtt_client
import
MqttClient
from
tool.ssh_client
import
SSHClient
,
Cmd
from
tool.ssh_client
import
SSHClient
,
Cmd
from
tool.remote_client
import
RemoteClient
from
tool.update
import
VersionManager
from
tool.update
import
VersionManager
class
Ihm
(
MqttClient
,
SSHClient
):
class
Ihm
(
MqttClient
,
SSHClient
):
...
@@ -116,6 +121,17 @@ class Ihm(MqttClient, SSHClient):
...
@@ -116,6 +121,17 @@ class Ihm(MqttClient, SSHClient):
if
cmd
.
lower
()
in
[
"
s
"
,
"
step
"
]:
if
cmd
.
lower
()
in
[
"
s
"
,
"
step
"
]:
self
.
client
.
publish
(
"
ihm/step
"
)
self
.
client
.
publish
(
"
ihm/step
"
)
if
cmd
.
lower
()
==
"
ping
"
:
for
client
in
read_ssh
(
str
(
pathlib
.
Path
(
__file__
).
parent
.
resolve
())
+
"
/tool/config.json
"
)
:
param
=
'
-n
'
if
platform
.
system
().
lower
()
==
'
windows
'
else
'
-c
'
command
=
[
'
ping
'
,
param
,
'
1
'
,
client
.
hostname
]
result
=
subprocess
.
call
(
command
,
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
PIPE
)
==
0
print
(
"
Hostname :
"
,
client
.
hostname
,
"
Responded :
"
,
result
)
self
.
client
.
publish
(
"
ihm/step
"
)
self
.
client
.
publish
(
"
ihm/step
"
)
sleep
(
2
)
sleep
(
2
)
...
...
This diff is collapsed.
Click to expand it.
philosophers/amas.py
+
3
−
2
View file @
16fe7a33
...
@@ -29,8 +29,9 @@ class PhiAmas(Amas):
...
@@ -29,8 +29,9 @@ class PhiAmas(Amas):
self
.
client
.
publish
(
"
amas/agent/new
"
,
self
.
next_id
)
self
.
client
.
publish
(
"
amas/agent/new
"
,
self
.
next_id
)
self
.
next_id
+=
1
self
.
next_id
+=
1
self
.
run_cmd
(
0
,
agents
)
self
.
run_cmd
(
0
,
[
agents
[
0
]])
# self.run_cmd(1, agents[2:])
self
.
run_cmd
(
1
,
[
agents
[
1
]])
self
.
run_cmd
(
2
,
[
agents
[
2
]])
if
__name__
==
'
__main__
'
:
if
__name__
==
'
__main__
'
:
s
=
PhiAmas
(
3
)
s
=
PhiAmas
(
3
)
...
...
This diff is collapsed.
Click to expand it.
tool/config.json
+
15
−
0
View file @
16fe7a33
...
@@ -5,6 +5,21 @@
...
@@ -5,6 +5,21 @@
"hostname"
:
"192.168.24.18"
,
"hostname"
:
"192.168.24.18"
,
"user"
:
"pi"
,
"user"
:
"pi"
,
"password"
:
"raspberry"
"password"
:
"raspberry"
},
{
"hostname"
:
"192.168.24.61"
,
"user"
:
"pi"
,
"password"
:
"raspberry"
},
{
"hostname"
:
"192.168.24.227"
,
"user"
:
"pi"
,
"password"
:
"raspberry"
},
{
"hostname"
:
"192.168.24.75"
,
"user"
:
"pi"
,
"password"
:
"raspberry"
}
}
]
]
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment