forked from unbit/uwsgi
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
new option --import, new api function uwsgi.signal_registered
- Loading branch information
roberto@sirius
committed
Jul 1, 2011
1 parent
19c567c
commit 750bbd6
Showing
8 changed files
with
147 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,51 @@ | ||
import uwsgi | ||
from uwsgidecorators import * | ||
|
||
from uwsgicc import app as application | ||
|
||
import time | ||
|
||
|
||
# register rpc function helloworld | ||
@rpc("helloworld") | ||
def hello_world(): | ||
return "Hello World" | ||
|
||
# register signal 1 | ||
@signal(1) | ||
def what_time_is_it(num): | ||
print(time.asctime()) | ||
|
||
|
||
@timer(2, 3) | ||
# a 3 seconds timer | ||
@timer(3) | ||
def salut(num): | ||
print("Salut !!! 3 seconds elapsed and signal %d raised" % num) | ||
|
||
@rbtimer(3, 10) | ||
# a 10 seconds red black timer | ||
@rbtimer(10) | ||
def tenseconds(num): | ||
print("red black timer !!! 10 seconds elapsed and signal %d raised" % num) | ||
|
||
@filemon(4, "/tmp") | ||
# monitor /tmp directory | ||
@filemon("/tmp") | ||
def tmpmodified(num): | ||
print("/tmp has been modified") | ||
|
||
|
||
# spool a long running task | ||
@spool | ||
def a_long_task(vars): | ||
for i in xrange(1,10): | ||
print(i) | ||
time.sleep(1) | ||
|
||
# continuosly spool a long task | ||
@spool | ||
def an_infinite_task(vars): | ||
for i in xrange(1,4): | ||
print("infinite: %d" % i) | ||
time.sleep(1) | ||
|
||
|
||
a_long_task.spool(foo='bar') | ||
an_infinite_task.spool(foo='bar') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters