Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
algorand
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
nilak
algorand
Commits
0c4d374f
Commit
0c4d374f
authored
Apr 22, 2019
by
THAKARE AKSHAY HARIBHAU
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
resume task with list datastructure
parent
f636f76c
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
20 additions
and
3 deletions
+20
-3
Network.py
Network.py
+1
-1
Node.py
Node.py
+13
-0
OverlayNode.py
OverlayNode.py
+2
-1
TestCases.py
TestCases.py
+4
-1
No files found.
Network.py
View file @
0c4d374f
...
...
@@ -62,7 +62,7 @@ class Network():
def
simulate
(
self
,
time
):
# logger.info("simulating .. ")
self
.
networkClockTime
=
time
# Note links should be simulated before nodes
# Note links should be simulated before nodes
elf.ResumeTasks.append(("nextOn", self.startNodeLifeCycleGenerator,))s
# in order to receive the messge which is supposed to be received in this tick
for
link
in
self
.
links
.
values
():
link
.
simulate
(
time
)
...
...
Node.py
View file @
0c4d374f
...
...
@@ -86,6 +86,19 @@ class Node(SystemEntity):
# check if main ba* has to be resumed or not
try
:
ResumeTask
=
self
.
ResumeTasks
.
pop
(
0
)
command
=
self
.
commands
.
get
(
ResumeTask
[
0
])
ResumeOut
=
command
(
time
,
ResumeTask
[
1
:])
if
ResumeOut
and
ResumeOut
[
0
]
==
"resume"
:
self
.
logger
.
info
(
"resume has been called"
)
self
.
ResumeTasks
.
append
((
"nextOn"
,
self
.
startNodeLifeCycleGenerator
,))
except
KeyError
as
ke
:
# not task pending at this time
pass
except
StopIteration
as
si
:
pass
# TODO : perform task from todolist which are relevant for current tick
...
...
OverlayNode.py
View file @
0c4d374f
...
...
@@ -10,7 +10,8 @@ class OverlayNode(Node):
Node
.
__init__
(
self
,
id
,
network
,
weight
)
self
.
startNodeLifeCycleGenerator
=
self
.
startNodeLifeCycle
()
# adding initial task of bootstraping node.
self
.
todoList
[
'0'
]
.
append
((
"nextOn"
,
self
.
startNodeLifeCycleGenerator
,))
self
.
ResumeTasks
.
append
((
"nextOn"
,
self
.
startNodeLifeCycleGenerator
,))
# self.todoList['0'].append(("nextOn", self.startNodeLifeCycleGenerator,))
self
.
commands
.
update
({})
def
processMessage
(
self
,
time
,
payload
):
...
...
TestCases.py
View file @
0c4d374f
...
...
@@ -42,6 +42,9 @@ def simulateNetwork(net):
if
__name__
==
'__main__'
:
logging
.
basicConfig
(
filename
=
'TestCases.log'
,
level
=
logging
.
INFO
)
# populateTodolist(None)
simulateNetwork
(
None
)
# simulateNetwork(None)
ak
=
[
'hello'
,
'ramesh'
]
ak
.
append
(
'rao'
)
print
(
ak
.
pop
())
pass
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment