Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Switch to GitLab Next
Sign in / Register
Toggle navigation
Open sidebar
team-simpy
simpy
Commits
e5aa09cf
Commit
e5aa09cf
authored
Aug 05, 2013
by
Ontje Lünsdorf
Browse files
Added the trigger method to events.
parent
442b8927
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
0 deletions
+10
-0
simpy/core.py
simpy/core.py
+10
-0
No files found.
simpy/core.py
View file @
e5aa09cf
...
...
@@ -156,6 +156,16 @@ class Event(object):
raise
RuntimeError
(
'Value of %s is not yet available'
%
self
)
return
self
.
_value
def
trigger
(
self
,
event
):
"""Triggers the event with value of the provided ``event``.
This method can be used directly as a callback function.
"""
self
.
ok
=
event
.
ok
self
.
_value
=
event
.
_value
self
.
env
.
schedule
(
self
,
DEFAULT_PRIORITY
)
def
succeed
(
self
,
value
=
None
):
"""Schedule the event and mark it as successful.
...
...
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