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
7dce87f8
Commit
7dce87f8
authored
3 years ago
by
shinedday
Browse files
Options
Downloads
Patches
Plain Diff
fix the update
parent
64911e7f
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
iotAmak/ihm.py
+20
-3
20 additions, 3 deletions
iotAmak/ihm.py
iotAmak/tool/ssh_client.py
+3
-3
3 additions, 3 deletions
iotAmak/tool/ssh_client.py
with
23 additions
and
6 deletions
iotAmak/ihm.py
+
20
−
3
View file @
7dce87f8
...
@@ -16,7 +16,9 @@ from iotAmak.tool.ssh_client import SSHClient, Cmd
...
@@ -16,7 +16,9 @@ from iotAmak.tool.ssh_client import SSHClient, Cmd
class
Ihm
(
MqttClient
,
SSHClient
):
class
Ihm
(
MqttClient
,
SSHClient
):
def
__init__
(
self
,
config_path
):
def
__init__
(
self
,
config_path
,
experiment_name
,
version
=
"
0.0.1
"
):
self
.
version
=
version
self
.
experiment_name
=
experiment_name
self
.
broker_ip
=
read_broker
(
config_path
)
self
.
broker_ip
=
read_broker
(
config_path
)
MqttClient
.
__init__
(
self
,
self
.
broker_ip
,
"
Ihm
"
)
MqttClient
.
__init__
(
self
,
self
.
broker_ip
,
"
Ihm
"
)
SSHClient
.
__init__
(
self
,
read_ssh
(
config_path
))
SSHClient
.
__init__
(
self
,
read_ssh
(
config_path
))
...
@@ -117,7 +119,22 @@ class Ihm(MqttClient, SSHClient):
...
@@ -117,7 +119,22 @@ class Ihm(MqttClient, SSHClient):
if
cmd
.
lower
()
==
"
update
"
:
if
cmd
.
lower
()
==
"
update
"
:
commands
=
[
commands
=
[
Cmd
(
Cmd
(
cmd
=
"
rm -r Desktop/mqtt_goyon/iotamak-core
"
cmd
=
"
cd Desktop/mqtt_goyon/iotamak-core
"
),
Cmd
(
cmd
=
"
git pull
"
),
Cmd
(
cmd
=
"
git checkout core_to_module
"
),
Cmd
(
cmd
=
"
python3 -m pip install --force-reinstall dist/iotAmak-
"
+
self
.
version
+
"
-py3-none-any.whl
"
),
Cmd
(
cmd
=
"
cd ../../../
"
),
Cmd
(
cmd
=
"
rm -r Desktop/mqtt_goyon/example/
"
+
self
.
experiment_name
)
)
]
]
...
@@ -125,7 +142,7 @@ class Ihm(MqttClient, SSHClient):
...
@@ -125,7 +142,7 @@ class Ihm(MqttClient, SSHClient):
print
(
"
Hostname :
"
,
self
.
clients
[
i_client
].
hostname
,
"
User :
"
,
self
.
clients
[
i_client
].
user
)
print
(
"
Hostname :
"
,
self
.
clients
[
i_client
].
hostname
,
"
User :
"
,
self
.
clients
[
i_client
].
user
)
self
.
run_cmd
(
i_client
,
commands
)
self
.
run_cmd
(
i_client
,
commands
)
self
.
update
()
self
.
update
(
self
.
experiment_name
)
# Crée les processus amas/env/scheduler de l'experience chargé
# Crée les processus amas/env/scheduler de l'experience chargé
if
cmd
.
lower
()
==
"
start
"
:
if
cmd
.
lower
()
==
"
start
"
:
...
...
This diff is collapsed.
Click to expand it.
iotAmak/tool/ssh_client.py
+
3
−
3
View file @
7dce87f8
...
@@ -44,13 +44,13 @@ class SSHClient:
...
@@ -44,13 +44,13 @@ class SSHClient:
print
(
"
pxssh failed on login.
"
)
print
(
"
pxssh failed on login.
"
)
print
(
e
)
print
(
e
)
def
update
(
self
):
def
update
(
self
,
experiment_name
):
for
client
in
self
.
clients
:
for
client
in
self
.
clients
:
transport
=
paramiko
.
Transport
((
client
.
hostname
,
22
))
transport
=
paramiko
.
Transport
((
client
.
hostname
,
22
))
transport
.
connect
(
username
=
client
.
user
,
password
=
client
.
password
)
transport
.
connect
(
username
=
client
.
user
,
password
=
client
.
password
)
sftp
=
MySFTPClient
.
from_transport
(
transport
)
sftp
=
MySFTPClient
.
from_transport
(
transport
)
sftp
.
mkdir
(
"
./
Desktop/mqtt_goyon/
iotamak-core
"
,
ignore_existing
=
True
)
sftp
.
mkdir
(
"
Desktop/mqtt_goyon/
example/
"
+
experiment_name
,
ignore_existing
=
True
)
sftp
.
put_dir
(
"
/mnt/d/work/stage m1/iotamak-core
"
,
"
./
Desktop/mqtt_goyon/
iotamak-core
"
)
sftp
.
put_dir
(
"
../
"
+
experiment_name
,
"
Desktop/mqtt_goyon/
example/
"
+
experiment_name
)
sftp
.
close
()
sftp
.
close
()
class
MySFTPClient
(
paramiko
.
SFTPClient
):
class
MySFTPClient
(
paramiko
.
SFTPClient
):
...
...
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