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
8efe556a
Commit
8efe556a
authored
3 years ago
by
shinedday
Browse files
Options
Downloads
Patches
Plain Diff
Add : amas method to share metrics
parent
49ec7aa9
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
dist/iotAmak-0.0.3-py3-none-any.whl
+0
-0
0 additions, 0 deletions
dist/iotAmak-0.0.3-py3-none-any.whl
iotAmak/amas.py
+6
-0
6 additions, 0 deletions
iotAmak/amas.py
iotAmak/scheduler.py
+3
-3
3 additions, 3 deletions
iotAmak/scheduler.py
with
9 additions
and
3 deletions
dist/iotAmak-0.0.3-py3-none-any.whl
+
0
−
0
View file @
8efe556a
No preview for this file type
This diff is collapsed.
Click to expand it.
iotAmak/amas.py
+
6
−
0
View file @
8efe556a
...
@@ -83,6 +83,12 @@ class Amas(Schedulable, SSHClient):
...
@@ -83,6 +83,12 @@ class Amas(Schedulable, SSHClient):
)
)
print
(
"
Amas, push agent done
"
)
print
(
"
Amas, push agent done
"
)
def
agent_neighbour
(
self
,
id_agent1
:
int
,
id_agent2
:
int
)
->
None
:
"""
share the metric of agent 2 to agent 1
"""
self
.
publish
(
"
amas/agent/
"
+
str
(
id_agent1
)
+
"
/neighbor
"
,
self
.
agents_metric
[
id_agent2
])
def
agent_log
(
self
,
client
,
userdata
,
message
)
->
None
:
def
agent_log
(
self
,
client
,
userdata
,
message
)
->
None
:
"""
"""
Called when the amas receive a log from any agent, print it in stdout
Called when the amas receive a log from any agent, print it in stdout
...
...
This diff is collapsed.
Click to expand it.
iotAmak/scheduler.py
+
3
−
3
View file @
8efe556a
...
@@ -61,7 +61,7 @@ class Scheduler(Schedulable):
...
@@ -61,7 +61,7 @@ class Scheduler(Schedulable):
Function called whenever the amas/env have finished an action and is waiting
Function called whenever the amas/env have finished an action and is waiting
"""
"""
self
.
schedulable_semaphore
.
release
()
self
.
schedulable_semaphore
.
release
()
print
(
"
__Schedulable is waiting
"
)
#
print("__Schedulable is waiting")
def
update_nbr_agent
(
self
,
client
,
userdata
,
message
)
->
None
:
def
update_nbr_agent
(
self
,
client
,
userdata
,
message
)
->
None
:
"""
"""
...
@@ -70,14 +70,14 @@ class Scheduler(Schedulable):
...
@@ -70,14 +70,14 @@ class Scheduler(Schedulable):
"""
"""
self
.
nbr_agent
+=
1
self
.
nbr_agent
+=
1
self
.
subscribe
(
"
agent/
"
+
str
(
message
.
payload
.
decode
(
"
utf-8
"
))
+
"
/cycle_done
"
,
self
.
agent_done
)
self
.
subscribe
(
"
agent/
"
+
str
(
message
.
payload
.
decode
(
"
utf-8
"
))
+
"
/cycle_done
"
,
self
.
agent_done
)
print
(
"
__Update agent :
"
,
self
.
nbr_agent
,
str
(
message
.
payload
.
decode
(
"
utf-8
"
)))
#
print("__Update agent : ", self.nbr_agent, str(message.payload.decode("utf-8")))
def
agent_done
(
self
,
client
,
userdata
,
message
)
->
None
:
def
agent_done
(
self
,
client
,
userdata
,
message
)
->
None
:
"""
"""
Called whenever an agent have done an action and is waiting
Called whenever an agent have done an action and is waiting
"""
"""
self
.
agent_semaphore
.
release
()
self
.
agent_semaphore
.
release
()
print
(
"
__Agent done
"
)
#
print("__Agent done")
def
wait_agent
(
self
)
->
None
:
def
wait_agent
(
self
)
->
None
:
"""
"""
...
...
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