Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
27 additions
and
0 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 | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,25 @@ | |||
import tests.settings as settings | |||
|
|||
from sleeping import worker | |||
|
|||
def task_listener(gearman_worker, gearman_job): | |||
''' | |||
Per each poll from gearman node, | |||
worker will call this function and give context params: worker and job | |||
''' | |||
done = gearman_job.data[::-1] | |||
|
|||
# Log result of string reversing in order to control worker activity | |||
# TODO: logging! | |||
print 'Done <%s>' % done | |||
return done | |||
|
|||
# Setting client ID can be useful for analyzing information | |||
# from gearman admin client, which show list of | |||
# currently connected workers by its CLIENT ID | |||
worker.set_client_id(settings.STUB_WORKERS_ID_FORMAT % {'task': 'reverse'}) | |||
worker.register_task('reverse', task_listener) | |||
|
|||
# Run worker in infinitive loop | |||
worker.work() | |||
|
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