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
9cd7e771
Commit
9cd7e771
authored
3 years ago
by
shinedday
Browse files
Options
Downloads
Patches
Plain Diff
Greatly improved wait
parent
dce535f8
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
+71
-0
71 additions, 0 deletions
README.md
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/tool/schedulable.py
+5
-6
5 additions, 6 deletions
iotAmak/tool/schedulable.py
setup.py
+1
-1
1 addition, 1 deletion
setup.py
with
77 additions
and
7 deletions
README.md
+
71
−
0
View file @
9cd7e771
...
@@ -175,3 +175,74 @@ Pour ajouter des attributs a l'initialisation aux agents il suffit de rajouter d
...
@@ -175,3 +175,74 @@ Pour ajouter des attributs a l'initialisation aux agents il suffit de rajouter d
**A AJOUTER**
**A AJOUTER**
un .config dans les experience avec la version du coeur
un .config dans les experience avec la version du coeur
# diagrame de classe
```
mermaid
classDiagram
class Amas{
int next_id
List~Cmd~ agent_cmd
List~Dict~ agents_metrics
on_initialization()
on_initial_agents_creation()
add_agent()
push_agent()
agent_log()
agent_metric()
on_cycle_begin()
on_cycle_end()
run()
}
class Agent{
List~Dict~ neighbors
List~Dict~ next_neighbors
on_initialization()
on_cycle_begin()
on_cycle_end()
add_neighbor()
log(message)
publish()
on_perceive()
on_decide()
on_act()
send_metric() Dict
run()
}
class Env{
on_initialization()
on_cycle_begin()
on_cycle_end()
run()
}
class Scheduler
class MqttClient{
~Paho mqtt client~ client
subscribe(topic, fun)
publish(topic, message)
}
class Schedulable{
int exit_bool
int nbr_cycle
int wait_delay
int wake_up_token
wake_up()
wait()
exit_procedure()
}
class SSHClient
MqttClient <|-- Schedulable
Schedulable <|-- Scheduler
Schedulable <|-- Agent
Schedulable <|-- Env
Schedulable <|-- Amas
SSHClient <|-- Amas
```
\ No newline at end of file
This diff is collapsed.
Click to expand it.
dist/iotAmak-0.0.3-py3-none-any.whl
0 → 100644
+
0
−
0
View file @
9cd7e771
File added
This diff is collapsed.
Click to expand it.
iotAmak/tool/schedulable.py
+
5
−
6
View file @
9cd7e771
...
@@ -5,6 +5,7 @@ from time import sleep
...
@@ -5,6 +5,7 @@ from time import sleep
import
sys
import
sys
import
pathlib
import
pathlib
import
threading
sys
.
path
.
insert
(
0
,
str
(
pathlib
.
Path
(
__file__
).
parent
.
parent
))
sys
.
path
.
insert
(
0
,
str
(
pathlib
.
Path
(
__file__
).
parent
.
parent
))
...
@@ -23,14 +24,14 @@ class Schedulable(MqttClient):
...
@@ -23,14 +24,14 @@ class Schedulable(MqttClient):
self
.
subscribe
(
"
ihm/exit
"
,
self
.
exit_procedure
)
self
.
subscribe
(
"
ihm/exit
"
,
self
.
exit_procedure
)
self
.
nbr_cycle
:
int
=
0
self
.
nbr_cycle
:
int
=
0
self
.
wait_delay
:
float
=
0.01
self
.
wake_up_token
:
int
=
0
self
.
semaphore
=
threading
.
Semaphore
(
0
)
def
wake_up
(
self
,
client
,
userdata
,
message
)
->
None
:
def
wake_up
(
self
,
client
,
userdata
,
message
)
->
None
:
"""
"""
Called by the scheduler to wake up the schedulable
Called by the scheduler to wake up the schedulable
"""
"""
self
.
wake_up_token
+=
1
self
.
semaphore
.
release
()
# print("Waked up")
# print("Waked up")
def
wait
(
self
)
->
None
:
def
wait
(
self
)
->
None
:
...
@@ -38,9 +39,7 @@ class Schedulable(MqttClient):
...
@@ -38,9 +39,7 @@ class Schedulable(MqttClient):
Basic wait method
Basic wait method
"""
"""
# print("Waiting")
# print("Waiting")
while
self
.
wake_up_token
==
0
:
self
.
semaphore
.
release
()
sleep
(
self
.
wait_delay
)
self
.
wake_up_token
-=
1
# print("End wait")
# print("End wait")
def
exit_procedure
(
self
,
client
,
userdata
,
message
)
->
None
:
def
exit_procedure
(
self
,
client
,
userdata
,
message
)
->
None
:
...
...
This diff is collapsed.
Click to expand it.
setup.py
+
1
−
1
View file @
9cd7e771
...
@@ -3,7 +3,7 @@ from setuptools import setup, find_packages
...
@@ -3,7 +3,7 @@ from setuptools import setup, find_packages
setup
(
setup
(
name
=
'
iotAmak
'
,
name
=
'
iotAmak
'
,
packages
=
find_packages
(),
packages
=
find_packages
(),
version
=
'
0.0.
2
'
,
version
=
'
0.0.
3
'
,
description
=
'
AmakFramework in python
'
,
description
=
'
AmakFramework in python
'
,
author
=
'
SMAC - GOYON Sebastien
'
,
author
=
'
SMAC - GOYON Sebastien
'
,
install_requires
=
[],
install_requires
=
[],
...
...
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